Skip to main content
POST
Some image models are reachable over the Chat Completions endpoint: you 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[].
Routing changed. wan2.7-image and wan2.7-image-pro no longer serve this route — calling them here returns 400 model_route_not_supported. They now use POST /v1/images/generations and POST /v1/images/edits. seedream-5-0-260128 and gpt-image-2 are on /v1/images/generations as well.
Gemini-compatible generateContent requests use /v1beta/models/{model}:generateContent.

Supported models

The multimodal request and response shapes below document how the gateway wraps image generation on the chat route. They were captured from the Wan models while those served this endpoint — re-verify against an actual response before depending on field-level details.

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".

Request fields

Response shape

  • 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. For the Wan models this workflow now lives on POST /v1/images/edits:

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.
  • 400 model_route_not_supported — the model does not serve this endpoint. The error body lists the routes it does serve; wan2.7-image, wan2.7-image-pro, seedream-5-0-260128, and gpt-image-2 all belong on /v1/images/generations.
  • 502 no available channel — the route exists but the upstream has no capacity right now. Retry, or use an image model on /v1/images/generations.
  • 500 model_not_found — your workspace isn’t provisioned for this model family. Contact support.
See Error Codes and Rate Limits for more.

OpenAI Chat

The same endpoint used for text models.

Gemini generateContent

Gemini-compatible generateContent 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 on the chat route. seedream-4-5-251128 is billed at $0.036 per request. Wan and gpt-image-2 models use /v1/images/generations instead.

Available options:
seedream-4-5-251128
messages
object[]
required

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

n
integer

Number of images to generate. Each image is billed separately; pass 1 unless you want candidates.

Required range: x >= 1

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:

"seedream-4-5-251128"

choices
object[]

One entry per generated image.

usage
object