{"openapi":"3.1.0","info":{"title":"Alibaba: Wan 2.7: Image To Image","version":"sha256:2722f07dee24dc8f72215dc3b407d65bf0a4e977bc8e634c17deeee8c0942c8d","description":"Alibaba's Wan 2.7 edits and transforms images with plain-text instructions, using up to 4 reference images. Refer to them as image 1 to image 4 to restyle, combine or retouch, with optional prompt expansion, negative prompts, custom sizes, seeds and up to 4 results per request.","x-model":{"id":"alibaba/wan-2.7/image-to-image","category":"image-to-image","group":{"id":"alibaba/wan-2.7","name":"Alibaba: Wan 2.7"},"model_url":"https://www.musespan.com/models/alibaba/wan-2.7/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. Price: $0.03 per image. Billed by the number of images actually generated. Each request temporarily reserves $0.03; 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":"alibaba/wan-2.7/image-to-image"},"input":{"allOf":[{"not":{"required":["enable_safety_checker"]}}],"properties":{"enable_prompt_expansion":{"default":true,"description":"Enable DashScope prompt expansion. Supported only for image edit mode.","title":"Enable Prompt Expansion","type":"boolean"},"image_size":{"anyOf":[{"$ref":"#/components/schemas/Input_ImageSize"},{"enum":["square_hd","square","portrait_4_3","portrait_16_9","landscape_4_3","landscape_16_9"],"type":"string"}],"default":"square_hd","title":"Image Size"},"image_urls":{"description":"Reference images for editing (1-4 images required). Order matters: reference them as image 1, image 2, image 3, image 4 in the prompt.","items":{"type":"string"},"title":"Image Urls","type":"array"},"negative_prompt":{"anyOf":[{"maxLength":500,"type":"string"},{"type":"null"}],"default":"","description":"Content to avoid in the generated image. Max 500 characters.","title":"Negative Prompt"},"num_images":{"default":1,"description":"Number of images to generate (1-4).","maximum":4,"minimum":1,"title":"Num Images","type":"integer"},"output_format":{"default":"jpeg","description":"The format of the generated images.","enum":["jpeg","png","webp"],"title":"Output Format","type":"string"},"prompt":{"description":"Text prompt describing the desired image edit. Supports Chinese and English.","examples":["Turn image 1 into a watercolor painting."],"maxLength":2000,"minLength":1,"title":"Prompt","type":"string"},"seed":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Random seed for reproducibility (0-2147483647).","title":"Seed"}},"required":["prompt","image_urls"],"title":"Wan27ImageEditInput","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_WanV27EditOutput"},"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":"alibaba/wan-2.7/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":"alibaba/wan-2.7/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":"alibaba/wan-2.7/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."}}}}}]},"Input_ImageSize":{"properties":{"height":{"default":512,"description":"The height of the generated image.","exclusiveMinimum":0,"maximum":14142,"title":"Height","type":"integer"},"width":{"default":512,"description":"The width of the generated image.","exclusiveMinimum":0,"maximum":14142,"title":"Width","type":"integer"}},"title":"ImageSize","type":"object"},"Output_File":{"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"},"url":{"description":"The URL where the file can be downloaded from.","title":"Url","type":"string"}},"required":["url"],"title":"File","type":"object"},"Output_WanV27EditOutput":{"properties":{"images":{"description":"Generated images.","items":{"$ref":"#/components/schemas/Output_File"},"title":"Images","type":"array"},"seed":{"description":"The seed used for generation.","title":"Seed","type":"integer"}},"required":["images","seed"],"title":"Wan27ImageEditOutput","type":"object"}}}}