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)
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/v3is the/api/v3path under the access domain, routing to/api/v3/images/generations.
Text-to-Image (Gemini Style, Contract Example)
Gemini generateContent style, for Gemini image models.
<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 viaimage/image[]; the universal form for every image editing model.application/json: reference input images in animagesarray, where each item provides eitherimage_urlorfile_id; this is the OpenAI Images Edits JSON protocol and applies to GPT Image models.
Key Parameters (multipart/form-data)
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model call name; must come from the Model Plaza or the model list |
image | file | Yes | Input images, up to 16 (repeat image[]=@...; use image=@... for a single image) |
prompt | string | Yes | Editing instruction |
size | string | No | Size, e.g. 1024x1024 |
mask | file | No | Mask image |
n | integer | No | Number of output images |
Key Parameters (application/json)
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model call name; must come from the Model Plaza or the model list |
prompt | string | Yes | Editing instruction (1–32,000 characters) |
images | array | Yes | Input images, 1–16 items; each item provides exactly one of image_url or file_id |
image_url | string | No | Field of an images item: HTTPS link or base64 data URL, up to 20,971,520 characters |
file_id | string | No | Field of an images item: file ID returned by the Files API |
mask | object | No | Mask reference with the same shape as an images item (file_id or image_url) |
markup | object | No | Transparent overlay reference (GPT Image 2.5 and later), same shape as an images item; cannot be combined with mask |
size | string | No | Size; GPT Image 2.5 and later accept arbitrary dimensions (multiples of 16, aspect ratio 1:3–3:1, longest edge ≤ 3840px) |
n | integer | No | Number of output images (1–10) |
quality | string | No | auto / low / medium / high; GPT Image 2.5 and later also support xhigh / max |
background | string | No | auto / transparent / opaque |
output_format | string | No | png / webp / jpeg / gif / svg |
output_compression | integer | No | Compression level (0–100) for jpeg / webp output |
partial_images | integer | No | Number of streaming partial images (0–3); only meaningful with stream=true |
moderation | string | No | auto / low; moderation level for GPT Image models |
safety_identifier | string | No | Stable end-user identifier (≤128 characters) for safety monitoring |
stream | boolean | No | Streaming 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 needsmodelto route to the matching upstream line, somodelis 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, andimageare required, andimageis one or more binary files. - JSON form:
model,prompt, andimagesare required, andimagesholds 1–16{file_id | image_url}references.
Examples
<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.