Skip to main content
POST
/
chat
/
completions
curl --request POST \
  --url https://api.aisa.one/v1/chat/completions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "wan2.7-image",
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "A cute red panda, ultra-detailed, cinematic lighting"
        }
      ]
    }
  ],
  "n": 1
}
'
{
  "id": "chatcmpl-fcc86dfd-9424-9523-b0bd-cdf07383bee2",
  "object": "chat.completion",
  "created": 1776495713,
  "model": "wan2.7-image",
  "choices": [
    {
      "index": 0,
      "finish_reason": "stop",
      "message": {
        "role": "assistant",
        "content": [
          {
            "type": "image",
            "image": "https://cdn.aisa.one/images/wan2.7/20260418-abc.png"
          }
        ]
      }
    }
  ],
  "usage": {
    "prompt_tokens": 104,
    "completion_tokens": 8,
    "total_tokens": 112
  }
}
Wan 2.7 image models are exposed through the Chat Completions endpoint, not the OpenAI-style /v1/images/generations path. Send a standard chat request with a multimodal content array containing a text prompt, and AIsa returns generated images as {type: "image"} parts inside choices[].message.content[].
Looking for Seedream (seedream-4-5-251128)? It uses a different route — /v1/images/generations. Gemini image previews use /v1/models/{model}:generateContent. This page only covers the Wan 2.7 family.

Supported models

ModelCost per imageTypical use
wan2.7-image$0.030Fast, general-purpose image generation
wan2.7-image-pro$0.075Higher fidelity; also supports image-to-video via separate flow

Request

The request schema is the same POST /v1/chat/completions you already use for text — the only differences are which model you pass and how content is structured. Critical rule: messages[].content must be an array of typed parts. Passing a plain string returns 400 invalid_parameter_error with the message "Input should be a valid list: messages[*].content".
curl -sS -X POST "https://api.aisa.one/v1/chat/completions" \
  -H "Authorization: Bearer $AISA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "wan2.7-image",
    "messages": [
      {
        "role": "user",
        "content": [
          { "type": "text", "text": "A cute red panda, ultra-detailed, cinematic lighting" }
        ]
      }
    ],
    "n": 1
  }'

Request fields

FieldTypeRequiredNotes
modelstringyeswan2.7-image or wan2.7-image-pro
messages[].rolestringyesuser for the prompt turn
messages[].contentarrayyesMust be an array, not a string
messages[].content[].typestringyestext for prompt parts; image_url for image-to-image inputs
messages[].content[].textstringwhen type=textThe prompt
messages[].content[].image_url.urlstringwhen type=image_urlReference image URL
nintegernoNumber of images. Default is 4 for wan2.7-image; pass 1 to save cost

Response shape

{
  "id": "chatcmpl-fcc86dfd-...",
  "object": "chat.completion",
  "created": 1776495713,
  "model": "wan2.7-image",
  "choices": [
    {
      "index": 0,
      "finish_reason": "stop",
      "message": {
        "role": "assistant",
        "content": [
          { "type": "image", "image": "https://cdn.aisa.one/images/wan2.7/..." }
        ]
      }
    }
  ],
  "usage": {
    "prompt_tokens": 104,
    "completion_tokens": 8,
    "total_tokens": 112
  }
}
  • One choice per image. If n=4, you get 4 entries in choices.
  • Every choice.message.content is an array with a single { "type": "image", "image": "..." } part.
  • image is a short-lived URL (download it soon) or base64 data, depending on your workspace configuration.
  • usage.total_tokens reflects the small token cost of the request framing — billing is per-image at the rate in the table above, not per token.

Image-to-image

Prepend an image_url part to the content array and follow it with a text instruction:
{
  "model": "wan2.7-image-pro",
  "messages": [
    {
      "role": "user",
      "content": [
        { "type": "image_url", "image_url": { "url": "https://example.com/reference.jpg" } },
        { "type": "text", "text": "Transform into an oil painting in the style of Van Gogh" }
      ]
    }
  ],
  "n": 1
}

Why the playground shows the Chat Completions path

The playground sends exactly the same POST /v1/chat/completions request the standard OpenAI Chat endpoint uses — only the model and content shape are tuned for images. Your existing OpenAI-compatible SDK code works without modification; just swap the model and content shape.

Common 4xx causes

  • 400 invalid_parameter_error — Input should be a valid list: messages[*].contentcontent was passed as a string; wrap in an array of typed parts.
  • 400 referencing messages — you sent the Gemini-style contents/parts. Use messages with OpenAI multimodal parts for Wan models.
  • 404 openai_error on /v1/images/generations — wrong endpoint. Wan models do not route through that path.
  • 500 model_not_found — your workspace isn’t provisioned for the Wan family. Contact support.
See Error Codes and Rate Limits for more.

OpenAI Chat

The same endpoint used for text models.

Gemini generateContent

Image preview through the Gemini 3 Pro endpoint.

Media Gen skill

Agent skill that wraps image + video generation.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
model
enum<string>
required

Image-generation model. wan2.7-image ($0.030/image) for standard quality, wan2.7-image-pro ($0.075/image) for higher fidelity.

Available options:
wan2.7-image,
wan2.7-image-pro
messages
object[]
required

Conversation messages. Image prompts go in the last user message's content array as {type: "text"} parts.

n
integer
default:4

Number of images to generate. wan2.7-image returns 4 by default; pass 1 to save cost.

Required range: 1 <= x <= 4

Response

Images generated. Returned as Chat Completion with message.content[] image parts.

id
string
Example:

"chatcmpl-fcc86dfd-9424-9523-b0bd-cdf07383bee2"

object
string
Example:

"chat.completion"

created
integer
Example:

1776495713

model
string
Example:

"wan2.7-image"

choices
object[]

One entry per generated image.

usage
object