Image Generation API

Text-to-image APIs come in two styles depending on the model: the OpenAI Images API style (Doubao Seedream) and the Gemini generateContent style; image editing accepts both multipart/form-data file uploads and the OpenAI Images Edits application/json request body.

Text-to-Image (OpenAI Style, Seedream)

POST/api/v3/images/generations

图片生成

Bearer API KeyUse the Authorization: Bearer sk_live_... header; x-api-key is also supported.
Confirm the model call name firstFirst filter models that support this endpoint format on the Models page, then open a model detail page to copy its call name. Your account's final availability also depends on organization permissions.

Request structure

The section below confirms the method, URL and authentication scheme. It is an HTTP structure snippet, not a standalone runnable example.

HTTP
POST https://silvamux.io/api/v3/images/generations
Authorization: Bearer $SILVAMUX_API_KEY
Content-Type: application/json

Request body

application/json · ImageGenerationRequest · Required

FieldTypeRequiredDescription
modelstringYes从模型广场选择支持当前图片接口的模型并复制调用名。
nintegerNo—
promptstringYes—
response_formatstringNo—
sizestringNo可用尺寸由模型决定;Seedream 5.0 的首次调用示例使用 2048x2048。

Response

200图片生成或编辑响应。

application/json · ImageResponse

FieldTypeDescription
createdinteger (int64)—
dataarray<object>—
data.b64_jsonstring—
data.urlstring (uri)—

defaultVolcengine 兼容错误。

application/json · VolcengineError

FieldTypeDescription
errorFreeFormObject—

Examples

curl https://silvamux.io/api/v3/images/generations \
  -H "Authorization: Bearer $SILVAMUX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedream-5-0-260128",
    "prompt": "A shiba inu wearing sunglasses sitting in a café",
    "size": "2048x2048",
    "n": 1
  }'

Response:

{
  "created": 1234567890,
  "data": [{"url": "https://..."}],
  "usage": {"output_images": 1}
}

https://silvamux.io/api/v3 is the /api/v3 path under the access domain, routing to /api/v3/images/generations.

Text-to-Image (Gemini Style, Contract Example)

Gemini generateContent style, for Gemini image models.

There are currently no publicly discoverable Gemini image models in the model list or the Model Plaza. The content below only illustrates the request structure and cannot be executed directly; <MODEL_CALL_NAME> must be replaced with a real call name published later on the Model Plaza — do not guess model names.
POST /api/v1beta/models/{model}:generateContent

Authentication: Authorization: Bearer <API_KEY> or x-api-key: <API_KEY>

curl https://silvamux.io/api/v1beta/models/<MODEL_CALL_NAME>:generateContent \
  -H "Authorization: Bearer $SILVAMUX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [
      {"role": "user", "parts": [{"text": "Draw a cat sitting on a windowsill"}]}
    ],
    "generationConfig": {
      "responseModalities": ["TEXT", "IMAGE"],
      "imageConfig": {"aspectRatio": "1:1", "imageSize": "1K"}
    }
  }'

Responses keep the Gemini format; billing fields are in usageMetadata.

Image Editing (Image-to-Image)

Image editing is compatible with the OpenAI Images Edits style and accepts two request bodies:

  • multipart/form-data: upload original images via image / image[]; the universal form for every image editing model.
  • application/json: reference input images in an images array, where each item provides either image_url or file_id; this is the OpenAI Images Edits JSON protocol and applies to GPT Image models.
POST/api/v3/images/edits

编辑图片(Volcengine v3)

支持两种请求体:multipart/form-data(image/image[] 上传文件)或 application/json(images 数组,每项用 image_url 或 file_id 引用输入图; OpenAI Images Edits JSON 协议)。请求体通过 #/components/requestBodies/ImageEdit 定义;两种形态下 model 与 prompt 均必填。

No publicly discoverable models yetThe current model list and Models page provide no public call names for this endpoint; this page is for OpenAPI contract reference only and is not a standalone runnable example. Do not guess model names — once matching models are published, use the call name from their detail page.
Bearer API KeyUse the Authorization: Bearer sk_live_... header; x-api-key is also supported.
Confirm the model call name firstFirst filter models that support this endpoint format on the Models page, then open a model detail page to copy its call name. Your account's final availability also depends on organization permissions.

Request structure

The section below confirms the method, URL and authentication scheme. It is an HTTP structure snippet, not a standalone runnable example.

HTTP
POST https://silvamux.io/api/v3/images/edits
Authorization: Bearer $SILVAMUX_API_KEY
Content-Type: application/json

Request body

application/json · ImageEditJSONRequest · Required

图片编辑 v1/v3 共用的必填请求体。支持 multipart/form-data(model、prompt、 image 必填,image 为单个或多个二进制文件)与 application/json(model、prompt、 images 必填,images 为 1–16 个 {file_id | image_url} 引用,可选 mask/markup)。

FieldTypeRequiredDescription
backgroundstring (auto | transparent | opaque)No—
imagesarray<ImageEditImageReference>Yes输入图数组,1–16 项;每项恰好提供 file_id 或 image_url 之一。
images.file_idstringNoFiles API 上传后的文件 ID(file-...)。
images.image_urlstring (uri)No图片的 HTTPS URL 或 base64 data URL;长度上限 20,971,520 字符。
markupImageEditImageReferenceNo输入图引用;file_id 与 image_url 恰好提供其一。
markup.file_idstringNoFiles API 上传后的文件 ID(file-...)。
markup.image_urlstring (uri)No图片的 HTTPS URL 或 base64 data URL;长度上限 20,971,520 字符。
maskImageEditImageReferenceNo输入图引用;file_id 与 image_url 恰好提供其一。
mask.file_idstringNoFiles API 上传后的文件 ID(file-...)。
mask.image_urlstring (uri)No图片的 HTTPS URL 或 base64 data URL;长度上限 20,971,520 字符。
modelstringYes模型调用名;必须从模型广场或模型列表获取。
moderationstring (auto | low)No—
nintegerNo—
output_compressionintegerNo—
output_formatstring (png | webp | jpeg | gif | svg)No—
partial_imagesintegerNo—
promptstringYes编辑指令。
qualitystring (auto | low | medium | high | xhigh | max)No—
safety_identifierstringNo—
sizestringNo尺寸,如 1024x1024;可用值由模型决定。
streambooleanNo流式输出;JSON 形态下的流式事件需以实际上游为准。

Response

200图片生成或编辑响应。

application/json · ImageResponse

FieldTypeDescription
createdinteger (int64)—
dataarray<object>—
data.b64_jsonstring—
data.urlstring (uri)—

defaultOpenAI 兼容错误。

application/json · OpenAIError

FieldTypeDescription
errorobject—
error.codestring | integer—
error.messagestring—
error.typestring—

Key Parameters (multipart/form-data)

ParameterTypeRequiredDescription
modelstringYesModel call name; must come from the Model Plaza or the model list
imagefileYesInput images, up to 16 (repeat image[]=@...; use image=@... for a single image)
promptstringYesEditing instruction
sizestringNoSize, e.g. 1024x1024
maskfileNoMask image
nintegerNoNumber of output images

Key Parameters (application/json)

ParameterTypeRequiredDescription
modelstringYesModel call name; must come from the Model Plaza or the model list
promptstringYesEditing instruction (1–32,000 characters)
imagesarrayYesInput images, 1–16 items; each item provides exactly one of image_url or file_id
image_urlstringNoField of an images item: HTTPS link or base64 data URL, up to 20,971,520 characters
file_idstringNoField of an images item: file ID returned by the Files API
maskobjectNoMask reference with the same shape as an images item (file_id or image_url)
markupobjectNoTransparent overlay reference (GPT Image 2.5 and later), same shape as an images item; cannot be combined with mask
sizestringNoSize; GPT Image 2.5 and later accept arbitrary dimensions (multiples of 16, aspect ratio 1:3–3:1, longest edge ≤ 3840px)
nintegerNoNumber of output images (1–10)
qualitystringNoauto / low / medium / high; GPT Image 2.5 and later also support xhigh / max
backgroundstringNoauto / transparent / opaque
output_formatstringNopng / webp / jpeg / gif / svg
output_compressionintegerNoCompression level (0–100) for jpeg / webp output
partial_imagesintegerNoNumber of streaming partial images (0–3); only meaningful with stream=true
moderationstringNoauto / low; moderation level for GPT Image models
safety_identifierstringNoStable end-user identifier (≤128 characters) for safety monitoring
streambooleanNoStreaming output; the JSON streaming event shape needs to be verified against the upstream

The official JSON body also supports complexity (GPT Image 2.6 reasoning level), input_fidelity (GPT Image 1.5), frame_count / frame_duration_ms (GIF output), svg (SVG authoring model), and similar fields. They are model pass-through fields; whether they are supported follows the details of future public models.

The official JSON body allows omitting model (the official service picks a default model), but SilvaMux needs model to route to the matching upstream line, so model is required when calling this endpoint.

OpenAPI Contract Notes

Image edit v1 and v3 share the #/components/requestBodies/ImageEdit request body in the OpenAPI. That request body declares both multipart/form-data (#/components/schemas/ImageEditRequest) and application/json (#/components/schemas/ImageEditJSONRequest) media types. Reading the contract or generating an SDK requires recursive resolution of local $refs; fields are not inlined directly under the endpoint node, which does not mean the request body is missing.

  • multipart form: model, prompt, and image are required, and image is one or more binary files.
  • JSON form: model, prompt, and images are required, and images holds 1–16 {file_id | image_url} references.

Examples

There are currently no publicly discoverable image editing models in the model list or the Model Plaza. The content below is a request structure example and cannot be executed directly; <MODEL_CALL_NAME> must be replaced with a real call name published later on the Model Plaza — do not guess model names.

Upload files with multipart:

curl https://silvamux.io/api/v3/images/edits \
  -H "Authorization: Bearer $SILVAMUX_API_KEY" \
  -F "model=<MODEL_CALL_NAME>" \
  -F "image[]=@photo.png" \
  -F "prompt=Add some decorative text to the image" \
  -F "size=1024x1024"

Reference input images with JSON (image_url or file_id, exactly one):

curl https://silvamux.io/api/v3/images/edits \
  -H "Authorization: Bearer $SILVAMUX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "<MODEL_CALL_NAME>",
    "prompt": "Replace the background with a snowy mountain scene",
    "images": [
      {"image_url": "https://example.com/photo.png"}
    ],
    "size": "1024x1024"
  }'

Upload Limits

Request bodies must not exceed 512 MB. Larger requests return 413 (REQUEST_TOO_LARGE).

Available Models

Sample models usable today: doubao-seedream-5-0-260128 (Seedream). There are no publicly discoverable call names for Gemini image models or image editing models yet; usable call names must come from the Model Plaza or the model list API.

Billing

Text-to-image and image-to-image are both billed per generated image; check current unit prices on the corresponding model detail page in the Model Plaza.