{"openapi":"3.1.0","info":{"title":"Google: Nano Banana: Image To Image","version":"sha256:36297939e7fc8c77d83f792eaa3dbc7dfacad88b30f42e4416d721263aa0dd95","description":"Google Nano Banana (Gemini 2.5 Flash Image) edits photos from a written instruction while keeping faces, products and characters recognizable. Combine up to 10 reference images to change outfits, backgrounds or styles, with auto or 10 fixed aspect ratios and up to 4 results per call.","x-model":{"id":"google/nano-banana/image-to-image","category":"image-to-image","group":{"id":"google/nano-banana","name":"Google: Nano Banana"},"model_url":"https://www.musespan.com/models/google/nano-banana/image-to-image","catalog_url":"https://www.musespan.com/v1/models"}},"servers":[{"url":"https://api.musespan.com"}],"security":[{"bearerAuth":[]}],"paths":{"/v1/model-tasks":{"post":{"operationId":"createNativeTask","summary":"Create a native result task","description":"Put model parameters inside input. Maximum request body: 4 MiB. Reuse X-Request-Id only with the same body. Completion does not imply final billing settlement. A model task may first wait in our queue (status queued, with an estimated queue_position) while the account or the platform is at its limit of tasks running at once; one still waiting 5 minutes after it was submitted ends as failed with error.code queue_timeout and is not charged. Once sent, a task with no result 15 minutes after it was accepted, or whose submission is still not confirmed 15 minutes after it was sent, ends as failed with error.code generation_timeout and is not charged (any hold is refunded in full); poll for up to 25 minutes to see the final status. To try again, submit a new task with a new X-Request-Id: the old ID keeps returning the failed task. A task still waiting in the queue (status queued with queue_position) can be cancelled with POST /v1/model-tasks/{id}/cancel and the same API key: it ends as failed with error.code cancelled and its hold is refunded in full. A task no longer waiting in the queue (being sent, sent, or ended) cannot be cancelled (409 task_not_cancellable). A task that could not be started because generation is temporarily unavailable ends at once as failed with error.code upstream_unavailable and is not charged (any hold is refunded in full); it does not mean your input was wrong. Try again later with a new X-Request-Id: the old ID keeps returning the failed task. Task objects may gain fields in later versions: ignore fields you do not know. Billed by actual usage; there is no fixed unit price. Typically about $0.0398 per image at default settings. Each request temporarily reserves $0.0398; you are charged for actual usage, usually within a minute: any unused amount is released and any usage above it is charged to your balance, even if that takes it below zero; while your balance is below zero, new requests are paused until a top-up covers it. Failed generations are not charged.","parameters":[{"name":"X-Request-Id","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,128}$"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","input"],"additionalProperties":false,"properties":{"model":{"const":"google/nano-banana/image-to-image"},"input":{"allOf":[{"not":{"required":["limit_generations"]}},{"not":{"required":["safety_tolerance"]}},{"not":{"required":["sync_mode"]}}],"properties":{"aspect_ratio":{"anyOf":[{"enum":["auto","21:9","16:9","3:2","4:3","5:4","1:1","4:5","3:4","2:3","9:16"],"type":"string"},{"type":"null"}],"default":"auto","description":"The aspect ratio of the generated image.","title":"Aspect Ratio"},"image_urls":{"description":"The URLs of the images to use for image-to-image generation or image editing.","items":{"type":"string"},"maxItems":10,"title":"Image URLs","type":"array"},"num_images":{"default":1,"description":"The number of images to generate.","maximum":4,"minimum":1,"title":"Number of Images","type":"integer"},"output_format":{"default":"png","description":"The format of the generated image.","enum":["jpeg","png","webp"],"title":"Output Format","type":"string"},"prompt":{"description":"The prompt for image editing.","examples":["make a photo of the man driving the car down the california coastline"],"maxLength":50000,"minLength":3,"title":"Prompt","type":"string"},"seed":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"The seed for the random number generator.","title":"Seed"}},"required":["prompt","image_urls"],"title":"NanoBananaImageToImageInput","type":"object"}}}}}},"responses":{"202":{"description":"Owned task. Only completed tasks include output; null and empty results can be successful.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NativeTask"}}}},"400":{"description":"Invalid request: missing or malformed X-Request-Id, or input that does not match the model schema. Nothing was created. native_model_unavailable: this model is served on a different endpoint; read its openapi_url in GET /v1/models, and use an ID from suggested_models there.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}},"401":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}},"402":{"description":"Insufficient balance. Nothing was created; top up and resend with the same X-Request-Id.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}},"403":{"description":"This API key cannot use this model.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}},"404":{"description":"model_not_found: this ID cannot be called with this API key. Nothing was created. Do not resend it unchanged: use an ID from suggested_models or an id from GET /v1/models.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}},"409":{"description":"request_id_conflict: this X-Request-Id was used with a different request body (another spelling of the model ID also counts as a different body). Resend byte-identical bytes, or use a new X-Request-Id.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}},"429":{"description":"Too many requests, or too many of your tasks already waiting in the queue (too_many_active_tasks). Tasks beyond the number your account may run at once wait in the queue instead of being refused; this means the queue itself is full. Back off a moment, then resend with the same X-Request-Id.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}},"503":{"description":"Temporarily unavailable. Retry later with the same X-Request-Id.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}}}}},"/v1/model-tasks/{id}":{"get":{"operationId":"getNativeTask","summary":"Get an owned task","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Owned task. Only completed tasks include output; null and empty results can be successful.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NativeTask"}}}},"401":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}},"404":{"description":"task_not_found: no task with this ID exists for this API key. If the POST may not have arrived, resend the exact same body with the same X-Request-Id instead of polling.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}},"429":{"description":"Too many requests. Back off, then query the same task again.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}},"503":{"description":"Temporarily unavailable. Query the same task again later.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}}}}},"/v1/model-tasks/{id}/cancel":{"post":{"operationId":"cancelNativeTask","summary":"Cancel a task still waiting in the queue","description":"A task still waiting in the queue (status queued with queue_position) can be cancelled with POST /v1/model-tasks/{id}/cancel and the same API key: it ends as failed with error.code cancelled and its hold is refunded in full. A task no longer waiting in the queue (being sent, sent, or ended) cannot be cancelled (409 task_not_cancellable).","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The cancelled task: status failed with error.code cancelled. Cancelling it again returns the same task.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NativeTask"}}}},"401":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}},"404":{"description":"task_not_found: no task with this ID exists for this API key.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}},"409":{"description":"task_not_cancellable: the task is no longer waiting in the queue (being sent, sent, or ended). The body includes its current status; keep polling it.","content":{"application/json":{"schema":{"type":"object","required":["error","status"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}},"status":{"enum":["queued","running","completed","failed"],"description":"The task status now; keep polling the task."}}}}}},"429":{"description":"Too many requests. Back off, then try again.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}},"503":{"description":"Temporarily unavailable. Try again later.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}}}}},"/v1/model-tasks/{id}/artifacts/{index}":{"get":{"operationId":"downloadNativeArtifact","summary":"Download a declared result file using the task owner API key","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"index","in":"path","required":true,"schema":{"type":"integer","minimum":0}}],"responses":{"200":{"description":"Attachment download. Never execute SVG/HTML result bytes.","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"401":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}},"404":{"description":"artifact_not_found: the task is not completed yet, the index is not one the completed task declares, or the task was submitted with another API key. Poll GET /v1/model-tasks/{id} until status is completed, then download only the indexes its output declares, with the API key that submitted the task.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}},"429":{"description":"Too many requests or downloads at once. Back off, then download the same file again.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}},"503":{"description":"Temporarily unavailable. Download the same file again later.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"type":{"type":"string"},"param":{"anyOf":[{"type":"string"},{"enum":[null]}]},"suggested_models":{"type":"array","items":{"type":"string"},"description":"With model_not_found or native_model_unavailable: IDs this API key can call instead (ids from GET /v1/models). Empty when nothing is close."}}}}}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API key"}},"schemas":{"NativeOutput":{"$ref":"#/components/schemas/Output_NanoBananaEditOutput"},"NativeTask":{"description":"Task objects may gain fields in later versions: ignore fields you do not know.","anyOf":[{"type":"object","required":["id","model","status"],"additionalProperties":true,"properties":{"id":{"type":"string"},"model":{"const":"google/nano-banana/image-to-image"},"status":{"enum":["queued","running"]},"queue_position":{"type":"integer","minimum":1,"description":"Only while the task waits in the queue: its estimated place (1 = next). An estimate that can change; the account may also be at its own limit of tasks running at once, in which case its tasks wait in order for one of its own to finish."}}},{"type":"object","required":["id","model","status","output"],"additionalProperties":true,"properties":{"id":{"type":"string"},"model":{"const":"google/nano-banana/image-to-image"},"status":{"const":"completed"},"output":{"$ref":"#/components/schemas/NativeOutput"}}},{"type":"object","required":["id","model","status","error"],"additionalProperties":true,"properties":{"id":{"type":"string"},"model":{"const":"google/nano-banana/image-to-image"},"status":{"const":"failed"},"error":{"type":"object","required":["code"],"properties":{"code":{"type":"string","description":"Stable machine-readable failure code; keep a branch for unknown codes. A failed task is not charged, and a retry needs a new X-Request-Id. generation_timeout: no result 15 minutes after the task was accepted, or the submission was not confirmed within 15 minutes. upstream_unavailable: generation was temporarily unavailable and the task was not started; try again later. invalid_parameters: the input was rejected; error.issues lists each rejected field and its rule code. Fix them and submit a new task. Model tasks only, ended before they were sent: cancelled: you cancelled the queued task. queue_timeout: still waiting in the queue 5 minutes after submission. model_unavailable_while_queued: the model became unavailable while the task was queued. insufficient_balance: the balance went below zero while the task was queued; top up first."},"message":{"type":"string"},"issues":{"type":"array","maxItems":8,"items":{"type":"object","required":["field","rule"],"additionalProperties":false,"properties":{"field":{"type":"string","maxLength":256},"rule":{"type":"string","enum":["required","string","integer","number","boolean","array","object","allowed_value","range","length","multiple","invalid","unsupported_value","file_size","file_format","file_unreadable","duration","content_policy"]}}},"description":"Present only with code invalid_parameters: each rejected input field (field is its path in input, for example voice or image_urls[0]) and a rule code. Free-form error text is never returned."}}}}}]},"Output_ImageFile":{"properties":{"content_type":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The mime type of the file.","examples":["image/png"],"title":"Content Type"},"file_name":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The name of the file. It will be auto-generated if not provided.","examples":["z9RV14K95DvU.png"],"title":"File Name"},"file_size":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"The size of the file in bytes.","examples":[4404019],"title":"File Size"},"height":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"The height of the image","title":"Height"},"url":{"description":"The URL where the file can be downloaded from.","title":"Url","type":"string"},"width":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"The width of the image","title":"Width"}},"required":["url"],"title":"ImageFile","type":"object"},"Output_NanoBananaEditOutput":{"properties":{"description":{"description":"The description of the generated images.","title":"Description","type":"string"},"images":{"description":"The edited images.","items":{"$ref":"#/components/schemas/Output_ImageFile"},"title":"Images","type":"array"}},"required":["images","description"],"title":"NanoBananaImageToImageOutput","type":"object"}}}}