Multimodal Model API Guide
Image, video, vision, audio, embedding, code and math model endpoints with ready-to-run examples.
- Base URL:
https://token.bytomdao.com/v1- Routing follows the standard OpenAI conventions
- Authentication:
Authorization: Bearer YOUR_API_TOKEN- For basic usage of text models, see the Text Models API Guide
Part 1: Image generation models (IMAGE)
1.1 Supported Models
| Model | Description | Highlights |
|---|---|---|
| GPT-Image-2.5 | Latest image model in the GPT-Image-2 series | Custom resolutions from 1K to 4K, quality enum (auto/low/medium/high), text-to-image and image-to-image share /v1/images/generations, accepts URL and Base64 image input, returns image URLs by default |
| GPT-Image-2 | Latest GPT-Image-2 image model (stable official channel) | Text-to-image and image editing; /v1/images/generations can edit via images, and /v1/images/edits is also supported; up to 10 reference images, returns image URLs by default |
| GPT-Image-2-4K | 4K high-resolution model in the GPT-Image-2 series | Custom resolutions from 1K to 4K, quality enum (auto/low/medium/high), supports base64 and URL responses |
| GPT-Image-2-Spot | Latest OpenAI image model (off-peak capacity edition) | 1.5K resolution only, no custom resolution or quality parameter, supports base64 and URL responses, lower price |
| GPT-Image-2-Flash | Latest OpenAI image model (simplified edition) | 1K resolution and URL responses only, lower price |
| Nano-Banana | Gemini 2.5 Flash Image | Fast, strong editing ability, great value |
| Nano-Banana-2 | Efficient Gemini visual generation | Fast interactive responses, high-concurrency image output |
| Nano-Banana-2.1 | Next-generation Nano-Banana image model | 1k / 2k / 4k quality tiers, URL/Base64 image input and URL/Base64 output |
| Nano-Banana-2-Lite | Gemini 3.1 Flash Lite Image | Ultra-low-latency chat mode, multi-turn local edits, interleaved generation |
| Nano-Banana-Pro | Gemini 3 Pro Image | Complex multi-turn image generation and editing with reasoning ability |
| Nano-Banana-Spot | Nano-Banana off-peak capacity | Cheap; stability may fluctuate |
| Nano-Banana-2-Spot | Nano-Banana-2 off-peak capacity | Cheap, great value |
| Nano-Banana-Pro-Spot | Nano-Banana-Pro off-peak capacity | Cheap, high quality |
| Qwen-Image-2.0 | Qwen text-to-image | Outstanding Chinese text rendering, strong Asian portraits |
| Qwen-Image-2.0-Pro | Qwen text-to-image, professional edition | Enhanced Chinese text rendering |
| Doubao-Seedream-4.0 | Doubao image creation | Multi-image fusion, image-set generation, subject consistency |
| Doubao-Seedream-4.5 | Doubao image creation, upgraded | Portrait retouching, improved image aesthetics |
| Doubao-Seedream-5.0-pro | Doubao image creation, professional edition | High-quality creation; supports 1K, 1.5K, 2K |
| Doubao-Seedream-5.0-lite | Latest Doubao image creation | Web retrieval, precise parsing of complex instructions |
| Wan2.7 | Wan 2.7 image generation and editing | Multi-image reference, subject consistency |
| Wan2.7-pro | Wan 2.7 flagship edition | Better complex-instruction following and text rendering |
About Spot models: Spot (off-peak capacity) models are cheaper, but their stability may fluctuate with supply. They suit scenarios that do not require a very high success rate.
1.2 Endpoints
Image models are called through the standard OpenAI endpoints. Use the generations endpoint for text-to-image, and the edits endpoint for editing / image-to-image scenarios that take an image input.
POST https://token.bytomdao.com/v1/images/generations
POST https://token.bytomdao.com/v1/images/editsNote: Request parameter formats differ between model series, so refer to the parameter description for the model you use. Image-to-image / editing for the original Nano-Banana, Qwen-Image and Wan2.7 series uses
/v1/images/edits. Nano-Banana Spot, Doubao-Seedream and GPT-Image-2.5 follow the upstream docs and use/v1/images/generations, passingimagein the same request body. GPT-Image-2 supports both/v1/images/generationsand/v1/images/edits: the generations endpoint accepts reference images through theimagesarray and can also perform edits directly.
1.3 GPT-Image-2.5
GPT-Image-2.5 is the latest image model in the GPT-Image-2 series. It supports custom resolutions from 1K to 4K and a quality enum. Text-to-image and image-to-image share the same endpoint, /v1/images/generations; for image-to-image, simply add an image field to the request body (URL and Base64 input are supported, as are multiple images). Image links are returned as URLs by default (data[].url), together with the image width and height, the prompt as rewritten by the model, and the token usage of the request.
Note: The response format of GPT-Image-2.5 differs from other models in the same series: it returns an image URL by default instead of Base64 data. The
usagefield in the response can be used to verify the token consumption of the request.
Request parameters
Text-to-image / image-to-image (POST /v1/images/generations)
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | — | Model name, fixed to GPT-Image-2.5 |
prompt | string | Yes | — | Text description of the desired image, up to 5000 characters |
size | string | No | auto | Image size; custom pixel resolutions are supported (see below) |
quality | string | No | auto | Image quality: auto, low, medium, high |
image | array[string] | No | — | Reference images for image-to-image. URL and Base64 are supported; for multiple images use ["url","url"] or ["base64","base64"] |
The size parameter
GPT-Image-2.5 accepts any pixel resolution in the size parameter, as long as the following constraints are met.
Common resolutions (by aspect ratio):
| Ratio | 1K | 2K | 4K |
|---|---|---|---|
| 1:1 | 1024x1024 | 2048x2048 | 2880x2880 |
| 2:3 | 816x1232 | 1360x2048 | 2352x3520 |
| 3:2 | 1232x816 | 2048x1360 | 3520x2352 |
| 3:4 | 880x1184 | 1552x2080 | 2336x3120 |
| 4:3 | 1184x880 | 2080x1552 | 3120x2336 |
| 16:9 | 1360x768 | 2048x1152 | 3536x1984 |
| 9:16 | 768x1360 | 1152x2048 | 1984x3536 |
| auto | — | — | — |
Note: In the table above,
automeans the model picks the best size automatically.
Size limits:
- The longest side must be at most 3840px
- Both width and height must be multiples of 16px
- The ratio of the long side to the short side must not exceed 3:1
- The total pixel count must be at least 655,360 and at most 8,294,400
Note: All resolutions in the table above satisfy these constraints. If you use a custom size, make sure it meets every limit listed here.
Examples
Text-to-image (returns a URL by default)
curl example
curl https://token.bytomdao.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "GPT-Image-2.5",
"prompt": "Promotional poster combining Black Myth Zhong Kui & Black Myth Wukong, English text",
"size": "3536x1984",
"quality": "high"
}'Python example
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_TOKEN",
base_url="https://token.bytomdao.com/v1"
)
response = client.images.generate(
model="GPT-Image-2.5",
prompt="Promotional poster combining Black Myth Zhong Kui & Black Myth Wukong, English text",
size="3536x1984",
quality="high"
)
# Returns an image URL by default; you can open it directly or download and save it
print(response.data[0].url)Image-to-image (reference image passed as a URL)
curl example
curl https://token.bytomdao.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "GPT-Image-2.5",
"prompt": "Change the character in the image to an eating pose",
"size": "1024x1024",
"image": [
"https://example.com/reference_image.jpg"
],
"quality": "high"
}'Python example
response = client.images.generate(
model="GPT-Image-2.5",
prompt="Change the character in the image to an eating pose",
size="1024x1024",
image=["https://example.com/reference_image.jpg"],
quality="high"
)
print(response.data[0].url)Image-to-image (local image passed as Base64)
curl example
curl https://token.bytomdao.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "GPT-Image-2.5",
"prompt": "Change the character in the image to an eating pose",
"size": "1024x1024",
"image": [
"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQ..."
],
"quality": "high"
}'Python example
import base64
# Convert the local image to Base64 and pass it in
with open("reference.jpg", "rb") as f:
image_base64 = base64.b64encode(f.read()).decode("utf-8")
response = client.images.generate(
model="GPT-Image-2.5",
prompt="Change the character in the image to an eating pose",
size="1024x1024",
image=[f"data:image/jpeg;base64,{image_base64}"],
quality="high"
)
print(response.data[0].url)Multi-image reference (fuse several images)
curl example
curl https://token.bytomdao.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "GPT-Image-2.5",
"prompt": "Blend the styles of these two images into a new image",
"size": "2048x1152",
"image": [
"https://example.com/image1.jpg",
"https://example.com/image2.jpg"
],
"quality": "high"
}'Python example
response = client.images.generate(
model="GPT-Image-2.5",
prompt="Blend the styles of these two images into a new image",
size="2048x1152",
image=[
"https://example.com/image1.jpg",
"https://example.com/image2.jpg"
],
quality="high"
)Response format
By default an image URL is returned, together with the image width and height, the rewritten prompt and the token usage of this request:
{
"created": 1789028868,
"data": [
{
"url": "https://example.com/generated_image.png",
"revised_prompt": "Change the product image to a white background without altering any other details, including patterns and text",
"width": 1024,
"height": 1536
}
],
"usage": {
"input_tokens": 2509,
"output_tokens": 1056,
"total_tokens": 3565,
"input_tokens_details": {
"text_tokens": 20,
"image_tokens": 2489,
"cached_tokens": 0
},
"output_tokens_details": {
"text_tokens": 0,
"image_tokens": 1056,
"reasoning_tokens": 0
}
}
}| Field | Type | Description |
|---|---|---|
created | integer | Unix timestamp of when the response was created |
data | array | Array of generated results |
data[].url | string | URL of the generated image (returned by default) |
data[].revised_prompt | string | The prompt actually used by the model, which may be a rewrite of your input |
data[].width | integer | Width of the generated image (pixels) |
data[].height | integer | Height of the generated image (pixels) |
usage | object | Token consumption of this request |
usage.input_tokens | integer | Total input tokens |
usage.output_tokens | integer | Total output tokens |
usage.total_tokens | integer | Total input and output tokens |
usage.input_tokens_details | object | Input breakdown: text_tokens, image_tokens, cached_tokens |
usage.output_tokens_details | object | Output breakdown: text_tokens, image_tokens, reasoning_tokens |
1.4 GPT-Image-2
GPT-Image-2 supports text-to-image, image-to-image and image editing. Both the generations and the edits endpoints can be used:
POST /v1/images/generations: supports plain text generation, and image editing by passing reference images throughimages; for local editing you can also passextends.edit.mask.POST /v1/images/edits: supports image-to-image or editing by uploading local images with multipart/form-data.
The GPT-Image-2 generations endpoint returns image URLs together with token usage statistics for the request. Routes and authentication are as follows:
POST https://token.bytomdao.com/v1/images/generations
POST https://token.bytomdao.com/v1/images/edits/images/generations request parameters
This endpoint supports text-to-image and image editing with reference images. The request body is JSON.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | — | Model name, fixed to GPT-Image-2 |
prompt | string | Yes | — | Prompt for image generation or editing; length must be between 1 and 32000 |
images | string<url>[] | No | — | Array of reference images, up to 10. When provided, you can perform image editing, style transfer or multi-image fusion |
extends.edit.mask | string<url> | No | — | URL of the local-edit mask; transparent areas are regenerated. Only used together with images |
quality | enum<string> | No | medium | Image quality: high, low or medium |
size | enum<string> | No | auto | Output size: 1024x1024, 1024x1536, 1536x1024, 2048x1152, 2048x2048, 2160x3840, 3840x2160 or auto |
Note:
imagesis an array that accepts up to 10 image URLs. Even though the endpoint is calledgenerations, passingimageslets you perform image editing or image-to-image. For inpainting, also passextends.edit.mask.
/images/generations examples
Text-to-image
curl example
curl https://token.bytomdao.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "GPT-Image-2",
"prompt": "A cute orange cat sitting on a windowsill, sunlight filtering through the curtains onto it, watercolor style",
"quality": "medium",
"size": "1024x1024"
}'Python example
import requests
response = requests.post(
"https://token.bytomdao.com/v1/images/generations",
headers={
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
},
json={
"model": "GPT-Image-2",
"prompt": "A cute orange cat sitting on a windowsill, sunlight filtering through the curtains onto it, watercolor style",
"quality": "medium",
"size": "1024x1024"
}
)
response.raise_for_status()
print(response.json()["data"][0]["url"])Edit an image with the generations endpoint
curl https://token.bytomdao.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "GPT-Image-2",
"prompt": "Change the character in the image to an eating pose while keeping the character's appearance and the composition unchanged",
"images": [
"https://example.com/reference_image.jpg"
],
"quality": "high",
"size": "1024x1024"
}'Local editing with a mask
curl https://token.bytomdao.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "GPT-Image-2",
"prompt": "Add a red hat to the person; modify only the masked area",
"images": [
"https://example.com/person.jpg"
],
"extends": {
"edit": {
"mask": "https://example.com/mask.png"
}
},
"quality": "high",
"size": "1024x1024"
}'Multi-image fusion
curl https://token.bytomdao.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Accept: application/json" \
-d '{
"model": "GPT-Image-2",
"prompt": "Merge the main features of these images into one natural, cinematic group photo",
"images": [
"https://example.com/image1.jpg",
"https://example.com/image2.jpg"
],
"quality": "high",
"size": "1536x1024"
}'/images/edits examples
The edits endpoint uses multipart/form-data and is suited to uploading local image files directly. Unlike the generations endpoint, images are uploaded as form fields; for local editing you can also upload a mask file.
Image editing
curl https://token.bytomdao.com/v1/images/edits \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-F "model=GPT-Image-2" \
-F "prompt=Change the character in the image to an eating pose, keeping other details unchanged" \
-F "image=@reference.jpg" \
-F "quality=high" \
-F "size=1024x1024"Local editing with a mask
curl https://token.bytomdao.com/v1/images/edits \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-F "model=GPT-Image-2" \
-F "prompt=Add a red hat to the person" \
-F "image=@person.jpg" \
-F "mask=@mask.png" \
-F "quality=high" \
-F "size=1024x1024"Choosing an endpoint: For remote reference images, JSON requests and multi-image editing, prefer
/images/generations. Use/images/editswhen you need to upload local files or use multipart/form-data. Both endpoints support the image editing capabilities of GPT-Image-2.
Response format
GPT-Image-2 returns image URLs and reports input, output and total tokens in usage. A typical response looks like this:
{
"created": 1790589315,
"data": [
{
"url": "https://mtpcloud.obs.cn-east-3.myhuaweicloud.com/maze/res/image/20260928/6502bbb0-a672-45fc-8284-065b62f94e0f_0.png"
}
],
"usage": {
"input_tokens": 1532,
"input_tokens_details": {
"image_tokens": 1517,
"text_tokens": 15
},
"output_tokens": 196,
"output_tokens_details": {
"image_tokens": 196,
"text_tokens": 0
},
"total_tokens": 1728
}
}| Field | Type | Description |
|---|---|---|
created | integer | Unix timestamp of when the response was created |
data | array | Array of generated or edited results |
data[].url | string | URL of the generated image |
usage.input_tokens | integer | Total input tokens |
usage.input_tokens_details.image_tokens | integer | Input image tokens |
usage.input_tokens_details.text_tokens | integer | Input text tokens |
usage.output_tokens | integer | Total output tokens |
usage.output_tokens_details.image_tokens | integer | Output image tokens |
usage.output_tokens_details.text_tokens | integer | Output text tokens |
usage.total_tokens | integer | Total input and output tokens |
1.5 GPT-Image-2-4K
GPT-Image-2-4K is the 4K high-resolution model in the GPT-Image-2 series. It supports custom resolutions from 1K to 4K and a quality enum, and can output Base64 (b64_json) or URLs. It suits scenarios that need flexibility in resolution and output format.
Request parameters
Text-to-image (POST /v1/images/generations)
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | — | Model name, fixed to GPT-Image-2-4K |
prompt | string | Yes | — | Text description of the image, up to 5000 characters |
size | string | No | auto | Image size; custom pixel resolutions are supported (see below) |
quality | string | No | auto | Image quality: auto, low, medium, high |
response_format | string | No | url | Response format: url (temporary link) or base64 (Base64-encoded data) |
image | string / array | No | — | Reference image(s) for image-to-image. URL or Base64; pass a string for a single image or an array ["url1", "url2"] for several |
The size parameter
GPT-Image-2-4K accepts any pixel resolution in the size parameter, as long as the following constraints are met.
Common resolutions (by aspect ratio):
| Ratio | 1K | 2K | 4K |
|---|---|---|---|
| 1:1 | 1024x1024 | 2048x2048 | 2880x2880 |
| 2:3 | 816x1232 | 1360x2048 | 2352x3520 |
| 3:2 | 1232x816 | 2048x1360 | 3520x2352 |
| 3:4 | 880x1184 | 1552x2080 | 2336x3120 |
| 4:3 | 1184x880 | 2080x1552 | 3120x2336 |
| 16:9 | 1360x768 | 2048x1152 | 3536x1984 |
| 9:16 | 768x1360 | 1152x2048 | 1984x3536 |
| auto | — | — | — |
Note: In the table above,
automeans the model picks the best size automatically.
Size limits:
- The longest side must be at most 3840px
- Both width and height must be multiples of 16px
- The ratio of the long side to the short side must not exceed 3:1
- The total pixel count must be at least 655,360 and at most 8,294,400
Note: All resolutions in the table above satisfy these constraints. If you use a custom size, make sure it meets every limit listed here.
Examples
Text-to-image (URL response)
curl example
curl https://token.bytomdao.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "GPT-Image-2-4K",
"prompt": "A cute orange cat sitting on a windowsill, sunlight filtering through the curtains onto it, watercolor style",
"size": "1024x1024",
"quality": "auto",
"response_format": "url"
}'Python example
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_TOKEN",
base_url="https://token.bytomdao.com/v1"
)
response = client.images.generate(
model="GPT-Image-2-4K",
prompt="A cute orange cat sitting on a windowsill, sunlight filtering through the curtains onto it, watercolor style",
size="1024x1024",
quality="auto",
response_format="url"
)
# Get the image URL
print(response.data[0].url)Text-to-image (Base64 response)
curl example
curl https://token.bytomdao.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "GPT-Image-2-4K",
"prompt": "A concept art painting of a futuristic city",
"quality": "medium",
"response_format": "base64"
}'Python example
import base64
response = client.images.generate(
model="GPT-Image-2-4K",
prompt="A concept art painting of a futuristic city",
quality="medium",
response_format="base64"
)
# Decode the Base64 and save the image
image_data = base64.b64decode(response.data[0].b64_json)
with open("output.png", "wb") as f:
f.write(image_data)4K high-resolution generation
curl example
curl https://token.bytomdao.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "GPT-Image-2-4K",
"prompt": "An ultra-high-definition mountain landscape photo with rich detail",
"size": "3840x2160",
"quality": "high",
"response_format": "url"
}'Python example
response = client.images.generate(
model="GPT-Image-2-4K",
prompt="An ultra-high-definition mountain landscape photo with rich detail",
size="3840x2160",
quality="high",
response_format="url"
)
print(response.data[0].url)Image-to-image (edit with a reference image)
curl example
curl https://token.bytomdao.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "GPT-Image-2-4K",
"prompt": "Change the character in the image to an eating pose",
"image": "https://example.com/reference_image.jpg",
"size": "1024x1024",
"response_format": "url"
}'Python example
import base64
# Option 1: pass the reference image by URL
response = client.images.generate(
model="GPT-Image-2-4K",
prompt="Change the character in the image to an eating pose",
image="https://example.com/reference_image.jpg",
size="1024x1024",
response_format="url"
)
# Option 2: pass a local image as Base64
with open("reference.jpg", "rb") as f:
image_base64 = base64.b64encode(f.read()).decode("utf-8")
response = client.images.generate(
model="GPT-Image-2-4K",
prompt="Change the character in the image to an eating pose",
image=f"data:image/jpeg;base64,{image_base64}",
size="1024x1024",
response_format="url"
)
print(response.data[0].url)Multiple reference images
curl example
curl https://token.bytomdao.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "GPT-Image-2-4K",
"prompt": "Blend the styles of these two images into a new image",
"image": ["https://example.com/image1.jpg", "https://example.com/image2.jpg"],
"size": "1024x1024",
"response_format": "url"
}'Python example
response = client.images.generate(
model="GPT-Image-2-4K",
prompt="Blend the styles of these two images into a new image",
image=[
"https://example.com/image1.jpg",
"https://example.com/image2.jpg"
],
size="1024x1024",
response_format="url"
)
print(response.data[0].url)Response format
URL response (response_format: "url"):
{
"created": 1589478378,
"data": [
{ "url": "https://..." }
]
}Base64 response (response_format: "base64"):
{
"created": 1589478378,
"data": [
{ "b64_json": "iVBORw0KGgo..." }
]
}| Field | Type | Description |
|---|---|---|
created | integer | Unix timestamp of when the response was created |
data | array | Array of generated results; contains a url or b64_json field depending on response_format |
1.6 GPT-Image-2-Spot
GPT-Image-2-Spot is the off-peak capacity edition with a lower price. It supports 1.5K resolution only, does not support custom resolutions or the quality parameter, and supports both base64 and url response formats. It suits scenarios that do not require a very high success rate.
Request parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | — | Model name, fixed to GPT-Image-2-Spot |
prompt | string | Yes | — | Text description of the image, up to 5000 characters |
size | string | No | auto | Image size; only the fixed 1.5K resolutions are supported (see below) |
response_format | string | No | url | Response format: url (temporary link) or base64 (Base64-encoded data) |
image | string / array | No | — | Reference image(s) for image-to-image. URL or Base64; pass a string for a single image or an array ["url1", "url2"] for several |
The size parameter
GPT-Image-2-Spot supports 1.5K resolution only and does not support custom resolutions or the quality parameter. It uses auto by default so the model picks the best aspect ratio.
Supported ratios and resolutions:
| Ratio | Resolution |
|---|---|
| 1:1 | 1254x1254 |
| 2:3 | 1024x1536 |
| 3:2 | 1536x1024 |
| 3:4 | 1086x1448 |
| 4:3 | 1448x1086 |
| 4:5 | 1122x1402 |
| 5:4 | 1402x1122 |
| 16:9 | 1672x941 |
| 9:16 | 941x1672 |
| 21:9 | 1915x821 |
| 9:21 | 821x1915 |
| auto | Chosen automatically |
Note: When you pass
autoor leavesizeempty, the model automatically picks the aspect ratio and resolution that best fit the prompt. Thequalityparameter is not supported and has no effect even if passed.
Examples
Text-to-image (URL response)
curl example
curl https://token.bytomdao.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "GPT-Image-2-Spot",
"prompt": "A cute orange cat sitting on a windowsill, sunlight filtering through the curtains onto it, watercolor style",
"size": "1254x1254",
"response_format": "url"
}'Python example
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_TOKEN",
base_url="https://token.bytomdao.com/v1"
)
response = client.images.generate(
model="GPT-Image-2-Spot",
prompt="A cute orange cat sitting on a windowsill, sunlight filtering through the curtains onto it, watercolor style",
size="1254x1254",
response_format="url"
)
# Get the image URL
print(response.data[0].url)Text-to-image (Base64 response)
curl example
curl https://token.bytomdao.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "GPT-Image-2-Spot",
"prompt": "A concept art painting of a futuristic city",
"response_format": "base64"
}'Python example
import base64
response = client.images.generate(
model="GPT-Image-2-Spot",
prompt="A concept art painting of a futuristic city",
response_format="base64"
)
# Decode the Base64 and save the image
image_data = base64.b64decode(response.data[0].b64_json)
with open("output.png", "wb") as f:
f.write(image_data)Image-to-image (edit with a reference image)
curl example
curl https://token.bytomdao.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "GPT-Image-2-Spot",
"prompt": "Change the character in the image to an eating pose",
"image": "https://example.com/reference_image.jpg",
"size": "1254x1254",
"response_format": "url"
}'Python example
import base64
# Option 1: pass the reference image by URL
response = client.images.generate(
model="GPT-Image-2-Spot",
prompt="Change the character in the image to an eating pose",
image="https://example.com/reference_image.jpg",
size="1254x1254",
response_format="url"
)
# Option 2: pass a local image as Base64
with open("reference.jpg", "rb") as f:
image_base64 = base64.b64encode(f.read()).decode("utf-8")
response = client.images.generate(
model="GPT-Image-2-Spot",
prompt="Change the character in the image to an eating pose",
image=f"data:image/jpeg;base64,{image_base64}",
size="1254x1254",
response_format="url"
)
print(response.data[0].url)Multiple reference images
curl example
curl https://token.bytomdao.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "GPT-Image-2-Spot",
"prompt": "Blend the styles of these two images into a new image",
"image": ["https://example.com/image1.jpg", "https://example.com/image2.jpg"],
"size": "1254x1254",
"response_format": "url"
}'Python example
response = client.images.generate(
model="GPT-Image-2-Spot",
prompt="Blend the styles of these two images into a new image",
image=[
"https://example.com/image1.jpg",
"https://example.com/image2.jpg"
],
size="1254x1254",
response_format="url"
)
print(response.data[0].url)Response format
URL response (response_format: "url"):
{
"created": 1589478378,
"data": [
{ "url": "https://..." }
]
}Base64 response (response_format: "base64"):
{
"created": 1589478378,
"data": [
{ "b64_json": "iVBORw0KGgo..." }
]
}| Field | Type | Description |
|---|---|---|
created | integer | Unix timestamp of when the response was created |
data | array | Array of generated results; contains a url or b64_json field depending on response_format |
1.7 GPT-Image-2-Flash
A simplified, discounted edition of the latest OpenAI model. Its response parameters are simplified, making it suitable for quick integration when you have no special requirements for advanced parameters or resolution.
Request parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | — | Model name, fixed to GPT-Image-2-Flash |
prompt | string | Yes | — | Text description of the image, up to 5000 characters |
size | string | No | auto | Image size; both ratio formats and pixel formats are supported (see below) |
image | string / array | No | — | Reference image(s) for image-to-image. URL or Base64; pass a string for a single image or an array ["url1", "url2"] for several |
The size parameter
GPT-Image-2-Flash supports custom pixel resolutions; supported resolution: 1K:
Custom resolution:
- Width and height must be multiples of 16
- The ratio of the long side to the short side must not exceed 3:1
Common resolutions: 1024x1024, 1536x1024, 1024x1536, auto
Examples
Text-to-image
curl example
curl https://token.bytomdao.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "GPT-Image-2-Flash",
"prompt": "A cute orange cat sitting on a windowsill, sunlight filtering through the curtains onto it, watercolor style",
"size": "1024x1024"
}'Python example
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_TOKEN",
base_url="https://token.bytomdao.com/v1"
)
response = client.images.generate(
model="GPT-Image-2-Flash",
prompt="A cute orange cat sitting on a windowsill, sunlight filtering through the curtains onto it, watercolor style",
size="1024x1024"
)
# Get the image URL
print(response.data[0].url)Image-to-image (edit with a reference image)
curl example
curl https://token.bytomdao.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "GPT-Image-2-Flash",
"prompt": "Change the character in the image to an eating pose",
"image": "https://example.com/reference_image.jpg",
"size": "1024x1024"
}'Python example
from openai import OpenAI
import base64
client = OpenAI(
api_key="YOUR_API_TOKEN",
base_url="https://token.bytomdao.com/v1"
)
# Option 1: pass the reference image by URL
response = client.images.generate(
model="GPT-Image-2-Flash",
prompt="Change the character in the image to an eating pose",
image="https://example.com/reference_image.jpg",
size="1024x1024"
)
# Option 2: pass a local image as Base64
with open("reference.jpg", "rb") as f:
image_base64 = base64.b64encode(f.read()).decode("utf-8")
response = client.images.generate(
model="GPT-Image-2-Flash",
prompt="Change the character in the image to an eating pose",
image=f"data:image/jpeg;base64,{image_base64}",
size="1024x1024"
)
print(response.data[0].url)Multiple reference images
curl example
curl https://token.bytomdao.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "GPT-Image-2-Flash",
"prompt": "Blend the styles of these two images into a new image",
"image": ["https://example.com/image1.jpg", "https://example.com/image2.jpg"],
"size": "1024x1024"
}'Python example
response = client.images.generate(
model="GPT-Image-2-Flash",
prompt="Blend the styles of these two images into a new image",
image=[
"https://example.com/image1.jpg",
"https://example.com/image2.jpg"
],
size="1024x1024"
)
print(response.data[0].url)Response format
{
"created": 1589478378,
"data": [
{ "url": "https://..." }
]
}| Field | Type | Description |
|---|---|---|
created | integer | Unix timestamp of when the response was created |
data | array | Array of generated results; each item contains a url field |
1.8 Nano-Banana Series
The original Nano-Banana series includes several versions of the Gemini image models, covering fast 1K output, high-quality 2K/4K output and complex image editing. The endpoint usage is not identical across models: image-to-image / editing for Nano-Banana, Nano-Banana-Pro and Nano-Banana-2 uses /v1/images/edits; Nano-Banana-2.1 uses /v1/images/generations for both text and image input; see §1.9 for the Spot series.
Model mapping
| Platform model | Upstream model | Recommended for | Resolution |
|---|---|---|---|
Nano-Banana | gemini-2.5-flash-image | Fast text-to-image, basic image editing | 1K |
Nano-Banana-Pro | gemini-3.0-pro-image-preview | High-quality generation, complex instructions, multi-image editing | 2K / 4K supported |
Nano-Banana-2 | gemini-3.1-flash-image-preview | Next-generation fast, high-quality image generation and multi-image fusion | 2K / 4K supported |
Nano-Banana-2.1 | — | Image generation with optional image input | 1k / 2k / 4k supported |
Nano-Banana-2-Lite | gemini-3.1-flash-lite-image | Ultra-low-latency text-to-image, multi-turn local edits, interleaved generation | 1K only (1024px) |
Note:
Nano-Banana-2-Liteis called differently from the other Nano-Banana models. It supports Chat mode only (/v1/chat/completions). See §1.8.5 below for details.
Endpoints
Text-to-image: POST https://token.bytomdao.com/v1/images/generations
Image-to-image / image editing: POST https://token.bytomdao.com/v1/images/editsNote: The generation endpoint applies to
Nano-Banana,Nano-Banana-Pro,Nano-Banana-2andNano-Banana-2.1. The edit endpoint applies toNano-Banana,Nano-Banana-ProandNano-Banana-2, but not toNano-Banana-2.1.Nano-Banana-2-Liteuses the Chat Completions endpoint; see its dedicated section below.
Text-to-image request parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | — | Model name: Nano-Banana, Nano-Banana-Pro, Nano-Banana-2, Nano-Banana-2.1 |
prompt | string | Yes | — | Text description of the image. Clearly describe the subject, style, composition, lighting and intended output |
size | string | No | 1x1 | Aspect ratio in the format WxH (ratio units), such as 1x1, 16x9, 9x16 |
quality | string | No | — | Image quality tier: 1k, 2k, 4k. Nano-Banana-2.1 supports all three; other models accept values according to their own capabilities |
response_format | string | No | url | Response format: url (temporary image link) or b64_json (Base64-encoded) |
Image-to-image / image editing request parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | — | Model name, same as text-to-image |
image | string / array | Yes | — | Input image(s). Supports image URLs and Base64; pass a string for one image or an array for several |
prompt | string | Yes | — | Editing instruction, such as style transfer, local edits, subject fusion or scene replacement |
mask | string | No | — | Mask image for precise local edits; better suited to the Nano-Banana-Pro and Nano-Banana-2 series |
size | string | No | 1x1 | Output aspect ratio, same format as text-to-image |
quality | string | No | — | Image quality tier; same applicability as text-to-image |
response_format | string | No | url | Response format: url or b64_json |
The size parameter (Nano-Banana series)
The Nano-Banana series uses ratio format. Common ratios and their 1K reference resolutions:
| Value | Ratio | 1K reference resolution | Use case |
|---|---|---|---|
1x1 | 1:1 | 1024×1024 | Avatars, product images, general squares |
2x3 | 2:3 | 832×1248 | Portrait posters, portraits |
3x2 | 3:2 | 1248×832 | Landscape photography, cover images |
3x4 | 3:4 | 864×1184 | Portrait content images |
4x3 | 4:3 | 1184×864 | Landscape content images |
4x5 | 4:5 | 896×1152 | Portrait social media images |
5x4 | 5:4 | 1152×896 | Landscape social media images |
9x16 | 9:16 | 768×1344 | Phone wallpapers, short-video covers |
16x9 | 16:9 | 1344×768 | Landscape covers, presentation slides |
21x9 | 21:9 | 1536×672 | Ultra-wide banners |
Note:
sizehere is a ratio (e.g.16x9), not a pixel size (e.g.1344x768). For higher resolution, usequality: "2k"orquality: "4k"instead of changingsizeto a pixel resolution.
Response format
URL response (response_format: "url"):
{
"created": 1589478378,
"data": [
{ "url": "https://..." }
]
}Base64 response (response_format: "b64_json"):
{
"created": 1234567890,
"data": [
{ "b64_json": "iVBORw0KGgoAAAANSUhEUgA..." }
],
"output_format": "png",
"usage": {
"total_tokens": 5234,
"input_tokens": 1234,
"output_tokens": 4000,
"input_tokens_details": {
"text_tokens": 234,
"image_tokens": 1000
}
}
}| Field | Type | Description |
|---|---|---|
created | integer | Unix timestamp of when the response was created |
data | array | Array of generated results; contains a url or b64_json field depending on response_format |
output_format | string | Output image format, usually png; may appear in Base64 responses |
usage | object | Token usage; returned by some upstreams, with text and image token breakdown |
1.8.1 Nano-Banana
Nano-Banana maps to Gemini 2.5 Flash Image. It is suited to fast text-to-image and basic image editing, at a fixed 1K resolution.
Text-to-image
curl example
curl https://token.bytomdao.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Nano-Banana",
"prompt": "A cute orange cat sitting on a windowsill watching the sunset, photographic style, high-definition quality",
"size": "1x1",
"response_format": "url"
}'Python example
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_TOKEN",
base_url="https://token.bytomdao.com/v1"
)
response = client.images.generate(
model="Nano-Banana",
prompt="A cute orange cat sitting on a windowsill watching the sunset, photographic style, high-definition quality",
size="1x1",
response_format="url"
)
print(response.data[0].url)1.8.2 Nano-Banana-2
Nano-Banana-2 maps to Gemini 3.1 Flash Image Preview. It supports high-quality 2K / 4K output and multi-image fusion.
Text-to-image (2K)
curl example
curl https://token.bytomdao.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Nano-Banana-2",
"prompt": "A surrealist cityscape with buildings reflected in the water, vivid colors",
"size": "16x9",
"quality": "2k",
"response_format": "url"
}'Python example
response = client.images.generate(
model="Nano-Banana-2",
prompt="A surrealist cityscape with buildings reflected in the water, vivid colors",
size="16x9",
quality="2k",
response_format="url"
)
print(response.data[0].url)Multi-image fusion
curl example
curl https://token.bytomdao.com/v1/images/edits \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Nano-Banana-2",
"image": [
"https://example.com/cat1.png",
"https://example.com/cat2.png"
],
"prompt": "Place the characters from these two images in the same scene, keeping their appearance consistent",
"size": "3x2",
"quality": "4k",
"response_format": "url"
}'Python example
import requests
response = requests.post(
"https://token.bytomdao.com/v1/images/edits",
headers={
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
},
json={
"model": "Nano-Banana-2",
"image": [
"https://example.com/cat1.png",
"https://example.com/cat2.png"
],
"prompt": "Place the characters from these two images in the same scene, keeping their appearance consistent",
"size": "3x2",
"quality": "4k",
"response_format": "url"
}
)
response.raise_for_status()
print(response.json()["data"][0]["url"])1.8.3 Nano-Banana-Pro
Nano-Banana-Pro maps to Gemini 3.0 Pro Image Preview. It is suited to high-quality generation, complex instructions and multi-image editing, with 2K / 4K support.
Text-to-image (4K)
curl example
curl https://token.bytomdao.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Nano-Banana-Pro",
"prompt": "A cat in a spacesuit walking on the moon with Earth in the background, cinematic lighting, rich detail",
"size": "16x9",
"quality": "4k",
"response_format": "url"
}'Python example
response = client.images.generate(
model="Nano-Banana-Pro",
prompt="A cat in a spacesuit walking on the moon with Earth in the background, cinematic lighting, rich detail",
size="16x9",
quality="4k",
response_format="url"
)
print(response.data[0].url)Image-to-image / style transfer
curl example
curl https://token.bytomdao.com/v1/images/edits \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Nano-Banana-Pro",
"image": "https://example.com/reference_image.jpg",
"prompt": "Add a sunset effect to this scene and make the overall tone warmer",
"size": "1x1",
"response_format": "url"
}'Python example
import requests
response = requests.post(
"https://token.bytomdao.com/v1/images/edits",
headers={
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
},
json={
"model": "Nano-Banana-Pro",
"image": "https://example.com/reference_image.jpg",
"prompt": "Add a sunset effect to this scene and make the overall tone warmer",
"size": "1x1",
"response_format": "url"
}
)
response.raise_for_status()
print(response.json()["data"][0]["url"])Base64 input image
Python example
import base64
import requests
with open("reference.png", "rb") as f:
image_base64 = base64.b64encode(f.read()).decode("utf-8")
response = requests.post(
"https://token.bytomdao.com/v1/images/edits",
headers={
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
},
json={
"model": "Nano-Banana-Pro",
"image": f"data:image/png;base64,{image_base64}",
"prompt": "Turn the image into a watercolor illustration style, keeping the main composition",
"size": "1x1",
"response_format": "url"
}
)
response.raise_for_status()
print(response.json()["data"][0]["url"])1.8.4 Nano-Banana-2.1
Nano-Banana-2.1 uses the /v1/images/generations endpoint. A request may include an optional image input (URL or Base64). This document describes usage based only on the provided endpoint examples and does not infer additional model capabilities. quality can be 1k, 2k or 4k, and response_format selects whether to return an image URL or Base64 data.
Tip:
sizeuses ratio format (e.g.9x16), not pixel resolution.qualityselects the output quality tier;response_formatselects whether to return an image URL or Base64 data.
Request parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Fixed to Nano-Banana-2.1 |
prompt | string | Yes | Image generation prompt |
image | array[string] | No | Image input; URL and Base64 supported. A single image can also be passed as a string |
response_format | enum<string> | No | Response format: url or b64_json |
size | enum<string> | No | Size of the generated image; accepts ratio or resolution values supported by the endpoint, e.g. 9x16 |
quality | enum<string> | No | Output quality: 1k, 2k, 4k |
Text-to-image
curl example
curl https://token.bytomdao.com/v1/images/generations \\
-H "Content-Type: application/json" \\
-H "Authorization: Bearer YOUR_API_TOKEN" \\
-d '{
"model": "Nano-Banana-2.1",
"prompt": "Promotional poster combining Black Myth Zhong Kui & Black Myth Wukong, English text",
"size": "9x16",
"n": 1,
"quality": "2k"
}'Typical response (response_format defaults to url):
{
"created": 1791441382,
"data": [
{
"b64_json": "",
"revised_prompt": "",
"url": "https://example.com/generated-image.jpg"
}
]
}Request with image input
image is optional. The example below calls the same /v1/images/generations endpoint with a single image URL as input.
curl example (URL image input)
curl https://token.bytomdao.com/v1/images/generations \\
-H "Content-Type: application/json" \\
-H "Authorization: Bearer YOUR_API_TOKEN" \\
-d '{
"model": "Nano-Banana-2.1",
"prompt": "Change the text on the image to Chinese",
"image": [
"https://example.com/reference-image.jpg"
],
"size": "9x16",
"quality": "2k"
}'Response format
When response_format is url, data[].url in the response is the generated image link; when set to b64_json, data[].b64_json contains the Base64-encoded image data. Actual responses also include the created and revised_prompt fields.
1.8.5 Nano-Banana-2-Lite
Nano-Banana-2-Lite maps to the official Gemini 3.1 Flash Lite Image model. Unlike other Nano-Banana models, it supports Chat mode only (/v1/chat/completions), is billed per token, and returns images as Base64.
Key features:
- Under 2 seconds end-to-end latency, suited to real-time interaction
- Interleaved generation and editing: natively supports text → text + image, and image + text → text + image
- Optimized for 1K resolution (1024×1024 pixels); 2K and 4K are not supported
- Supports 14 discrete aspect ratios:
1:1,3:2,2:3,3:4,4:3,4:5,5:4,9:16,16:9,21:9, and more - Fast multi-turn local edits: swap colors, create stickers, adjust backgrounds
- High character alignment accuracy
- SynthID (always on) + C2PA watermarking
Endpoints
POST https://token.bytomdao.com/v1/chat/completionsRequest parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | — | Model name, fixed to Nano-Banana-2-Lite |
messages | array | Yes | — | Conversation messages. Plain text input is supported (text-to-image), and content may mix text and image_url (image-to-image / editing) |
temperature | number | No | 1.0 | Sampling randomness (0–2) |
max_tokens | integer | No | Model default | Maximum number of output tokens |
Image input format in messages (image-to-image):
{
"role": "user",
"content": [
{ "type": "text", "text": "Replace the cat in this image with a dog" },
{ "type": "image_url", "image_url": { "url": "https://example.com/cat.jpg" } }
]
}Examples
Text-to-image (text-only input)
curl https://token.bytomdao.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Nano-Banana-2-Lite",
"messages": [
{
"role": "user",
"content": "Generate an image of a cute orange cat sitting on a windowsill with sunlight streaming through the curtains, watercolor style"
}
]
}'from openai import OpenAI
import base64
client = OpenAI(
api_key="YOUR_API_TOKEN",
base_url="https://token.bytomdao.com/v1"
)
response = client.chat.completions.create(
model="Nano-Banana-2-Lite",
messages=[
{
"role": "user",
"content": "Generate an image of a cute orange cat sitting on a windowsill with sunlight streaming through the curtains, watercolor style"
}
]
)
# Output contains Base64-encoded image data
print(response.choices[0].message.content)Image-to-image / image editing (text + image input)
curl https://token.bytomdao.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Nano-Banana-2-Lite",
"messages": [
{
"role": "user",
"content": [
{ "type": "text", "text": "Change the background of this image to a beach sunset" },
{ "type": "image_url", "image_url": { "url": "https://example.com/product.jpg" } }
]
}
]
}'response = client.chat.completions.create(
model="Nano-Banana-2-Lite",
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "Change the background of this image to a beach sunset"},
{"type": "image_url", "image_url": {"url": "https://example.com/product.jpg"}}
]
}
]
)
print(response.choices[0].message.content)Local image as Base64 input
import base64
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_TOKEN",
base_url="https://token.bytomdao.com/v1"
)
with open("local_image.jpg", "rb") as f:
image_base64 = base64.b64encode(f.read()).decode("utf-8")
response = client.chat.completions.create(
model="Nano-Banana-2-Lite",
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "Add a santa hat to the character in this image"},
{
"type": "image_url",
"image_url": {"url": f"data:image/jpeg;base64,{image_base64}"}
}
]
}
]
)
print(response.choices[0].message.content)Response format
Nano-Banana-2-Lite returns through the Chat Completions endpoint. The image data is in choices[0].message.content, Base64-encoded:
{
"id": "chatcmpl-xxx",
"object": "chat.completion",
"created": 1589478378,
"model": "Nano-Banana-2-Lite",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "<base64 encoded image data>"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 1234,
"completion_tokens": 4000,
"total_tokens": 5234
}
}| Field | Type | Description |
|---|---|---|
id | string | Unique identifier of this request |
choices[0].message.content | string | Base64-encoded output image data |
usage | object | Token usage; billed per token |
1.9 Nano-Banana Spot series
The Nano-Banana Spot series uses off-peak resources at lower prices, but success rate and stability may fluctuate with upstream resources. Spot models are called differently from the originals: both text-to-image and image-to-image / multi-image fusion use /v1/images/generations, and image input is passed through the image field in the request body. /v1/images/edits is not used.
Model mapping
| Platform model | Upstream model | Recommended for | Resolution |
|---|---|---|---|
Nano-Banana-Spot | gemini-2.5-flash-image | Low-cost off-peak basic image generation where stability fluctuation is acceptable | 1K |
Nano-Banana-Pro-Spot | gemini-3.0-pro-image-preview | Low-cost off-peak high-quality generation and editing | 2K / 4K supported |
Nano-Banana-2-Spot | gemini-3.1-flash-image-preview | Low-cost off-peak next-generation high-quality generation and multi-image fusion | 2K / 4K supported |
Endpoints
POST https://token.bytomdao.com/v1/images/generationsRequest parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | — | Spot model name: Nano-Banana-Spot, Nano-Banana-Pro-Spot, Nano-Banana-2-Spot |
prompt | string | Yes | — | Image generation or editing instruction. Clearly describe the subject, style, composition, lighting and the desired changes |
image | string / array | No | — | Reference image(s). Omit for text-to-image; for image-to-image / multi-image fusion pass image URL(s) or Base64: a string for one image, an array for several |
size | string | No | 1x1 | Aspect ratio in the format WxH (ratio units), such as 1x1, 16x9, 9x16. The Spot upstream examples also support very elongated ratios such as 1x8 |
quality | string | No | — | Image quality tier: 2k, 4k. The base Spot model is usually fixed at 1K; Pro / 2 Spot accept values according to model capabilities |
response_format | string | No | url | Response format. The Spot upstream examples use url; keeping url is recommended |
The size parameter (Spot series)
The Spot series uses ratio format (WxH in ratio units), same as the original Nano-Banana, but image input still goes through /v1/images/generations.
| Value | Ratio | Use case |
|---|---|---|
1x1 | 1:1 | Avatars, product images, general squares |
2x3 | 2:3 | Portrait posters, portraits |
3x2 | 3:2 | Landscape photography, cover images |
3x4 | 3:4 | Portrait content images |
4x3 | 4:3 | Landscape content images |
9x16 | 9:16 | Phone wallpapers, short-video covers |
16x9 | 16:9 | Landscape covers, presentation slides |
1x8 | 1:8 | Very tall images, long strips; from the Spot upstream examples |
Note:
sizehere is a ratio, not a pixel resolution. For higher resolution, usequality: "2k"orquality: "4k".
Response format
{
"created": 1589478378,
"data": [
{ "url": "https://..." }
]
}| Field | Type | Description |
|---|---|---|
created | integer | Unix timestamp of when the response was created |
data | array | Array of generated results; each item contains a url field |
1.9.1 Nano-Banana-Spot
Nano-Banana-Spot maps to the off-peak version of Gemini 2.5 Flash Image. It suits basic image generation where stability fluctuation is acceptable, at a fixed 1K resolution.
Text-to-image
curl example
curl https://token.bytomdao.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Nano-Banana-Spot",
"prompt": "A cute orange cat sitting on a windowsill watching the sunset, photographic style, high-definition quality",
"size": "1x1",
"response_format": "url"
}'Python example
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_TOKEN",
base_url="https://token.bytomdao.com/v1"
)
response = client.images.generate(
model="Nano-Banana-Spot",
prompt="A cute orange cat sitting on a windowsill watching the sunset, photographic style, high-definition quality",
size="1x1",
response_format="url"
)
print(response.data[0].url)1.9.2 Nano-Banana-2-Spot
Nano-Banana-2-Spot maps to the off-peak version of Gemini 3.1 Flash Image Preview. It supports high-quality 2K / 4K output and multi-image fusion at a better price.
Multi-image fusion / image-to-image
curl example
curl https://token.bytomdao.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Nano-Banana-2-Spot",
"prompt": "The two figures in the image and a beautiful young artist dressed in a bunny cosplay outfit are copying the image on a computer screen onto a canvas by hand, creating an oil painting",
"image": [
"https://example.com/cat_3.png",
"https://example.com/cat_4.png"
],
"size": "1x8",
"quality": "4k",
"response_format": "url"
}'Python example
import requests
response = requests.post(
"https://token.bytomdao.com/v1/images/generations",
headers={
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
},
json={
"model": "Nano-Banana-2-Spot",
"prompt": "The two figures in the image and a beautiful young artist dressed in a bunny cosplay outfit are copying the image on a computer screen onto a canvas by hand, creating an oil painting",
"image": [
"https://example.com/cat_3.png",
"https://example.com/cat_4.png"
],
"size": "1x8",
"quality": "4k",
"response_format": "url"
}
)
response.raise_for_status()
print(response.json()["data"][0]["url"])1.9.3 Nano-Banana-Pro-Spot
Nano-Banana-Pro-Spot maps to the off-peak version of Gemini 3.0 Pro Image Preview. It supports high-quality 2K / 4K generation and editing at a better price. The endpoint and parameters are the same as the Spot models above; just set model to Nano-Banana-Pro-Spot.
1.10 Qwen-Image series
The Qwen-Image series comes from Alibaba Cloud Model Studio's Qwen image models. It suits Chinese text rendering, posters / slides / infographics, complex text-and-image layouts and general image editing. Text-to-image and image-to-image use different upstream request structures, so call them separately as described below.
Model mapping
| Platform model | Upstream model | Recommended for | Notes |
|---|---|---|---|
Qwen-Image-2.0-Pro | qwen-image-2.0-pro | Complex text rendering, posters, infographics, mixed text-and-image layouts | Preferred choice |
Qwen-Image-2.0 | qwen-image-2.0 | General text-to-image and image editing | Balances quality and cost |
Endpoints
Text-to-image: POST https://token.bytomdao.com/v1/images/generations
Image-to-image / image editing: POST https://token.bytomdao.com/v1/images/editsText-to-image request parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | — | Model name: Qwen-Image-2.0 or Qwen-Image-2.0-Pro |
prompt | string | Yes | — | Positive prompt. Qwen-Image works well when you clearly describe the subject, text content, layout, font, material and composition |
response_format | string | No | url | Response format: url or b64_json |
parameters.size | string | No | 2048*2048 | Output resolution. When using native parameters, pass width*height in Alibaba's format |
parameters.n | integer | No | 1 | Number of images to generate. The Qwen-Image-2.0 series supports 1–6 |
parameters.watermark | boolean | No | false | Whether to add a Qwen-Image watermark |
parameters.negative_prompt | string | No | — | Negative prompt, up to 500 characters |
parameters.prompt_extend | boolean | No | true | Whether to enable intelligent prompt rewriting |
parameters.seed | integer | No | — | Random seed in [0, 2147483647], used to improve result stability |
Recommended resolutions for Qwen-Image-2.0
| Ratio | Recommended resolution |
|---|---|
| 1:1 | 2048x2048 |
| 4:3 | 2368x1728 |
| 3:4 | 1728x2368 |
| 16:9 | 2688x1536 |
| 9:16 | 1536x2688 |
Note: For the Qwen-Image-2.0 series, the total output pixels must be within the equivalent range of
512x512to2048x2048. The table usesxfor readability; when putting a value intoparameters.size, write it in Alibaba's nativewidth*heightformat.
Image-to-image / image editing request parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | — | Model name: Qwen-Image-2.0 or Qwen-Image-2.0-Pro |
prompt | string | Yes | — | Editing instruction. Qwen image editing supports Chinese and English; the 2.0 series is limited to roughly 1300 tokens |
input.messages[].content[].image | string | Yes | — | Image URL, temporary OSS URL or Base64; 1–3 images supported. With multiple images, the output ratio defaults to that of the last image |
parameters.size | string | No | Around 1K | Output resolution, such as 1024*1024 or 1536*1024. The actual output is aligned to the nearest multiple of 16 |
parameters.n | integer | No | 1 | Number of images to generate. The 2.0 series supports 1–6 |
parameters.watermark | boolean | No | false | Whether to add a watermark |
parameters.negative_prompt | string | No | — | Negative prompt |
parameters.prompt_extend | boolean | No | true | Whether to enable intelligent prompt rewriting |
parameters.seed | integer | No | — | Random seed |
Recommended resolutions for image-to-image:
| Ratio | Recommended resolution |
|---|---|
| 1:1 | 1024x1024, 1536x1536 |
| 2:3 | 768x1152, 1024x1536 |
| 3:2 | 1152x768, 1536x1024 |
| 3:4 | 960x1280, 1080x1440 |
| 4:3 | 1280x960, 1440x1080 |
| 9:16 | 720x1280, 1080x1920 |
| 16:9 | 1280x720, 1920x1080 |
| 21:9 | 1344x576, 2048x872 |
1.10.1 Qwen-Image-2.0-Pro
Qwen-Image-2.0-Pro maps to qwen-image-2.0-pro. It excels at complex text rendering, posters, infographics and mixed text-and-image layouts, and is the preferred choice.
Text-to-image
curl example
curl https://token.bytomdao.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Qwen-Image-2.0-Pro",
"prompt": "A tech launch event poster, main title: BytomDAO Token API, subtitle: Unified access to leading models, blue-purple gradient background, clean typography, modern design",
"response_format": "url",
"parameters": {
"size": "2048*2048",
"n": 1,
"watermark": false,
"negative_prompt": "Low quality, blurry text, typos, messy layout",
"prompt_extend": true,
"seed": 12345
}
}'Python example
import requests
response = requests.post(
"https://token.bytomdao.com/v1/images/generations",
headers={
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
},
json={
"model": "Qwen-Image-2.0-Pro",
"prompt": "A tech launch event poster, main title: BytomDAO Token API, subtitle: Unified access to leading models, blue-purple gradient background, clean typography, modern design",
"response_format": "url",
"parameters": {
"size": "2048*2048",
"n": 1,
"watermark": False,
"negative_prompt": "Low quality, blurry text, typos, messy layout",
"prompt_extend": True,
"seed": 12345
}
}
)
response.raise_for_status()
print(response.json()["data"][0]["url"])Image-to-image / multi-image editing
curl example
curl https://token.bytomdao.com/v1/images/edits \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Qwen-Image-2.0-Pro",
"prompt": "Keep the real street scene in the first image unchanged and draw the cartoon character from the second image next to the building, in a poster illustration style with sharp edges",
"input": {
"messages": [
{
"role": "user",
"content": [
{ "image": "https://example.com/street.png" },
{ "image": "https://example.com/character.png" },
{ "text": "Keep the real street scene in the first image unchanged and draw the cartoon character from the second image next to the building, in a poster illustration style with sharp edges" }
]
}
]
},
"parameters": {
"size": "1536*1024",
"n": 1,
"watermark": false,
"prompt_extend": true
}
}'Python example
import requests
prompt = "Keep the real street scene in the first image unchanged and draw the cartoon character from the second image next to the building, in a poster illustration style with sharp edges"
response = requests.post(
"https://token.bytomdao.com/v1/images/edits",
headers={
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
},
json={
"model": "Qwen-Image-2.0-Pro",
"prompt": prompt,
"input": {
"messages": [
{
"role": "user",
"content": [
{"image": "https://example.com/street.png"},
{"image": "https://example.com/character.png"},
{"text": prompt}
]
}
]
},
"parameters": {
"size": "1536*1024",
"n": 1,
"watermark": False,
"prompt_extend": True
}
}
)
response.raise_for_status()
print(response.json()["data"][0]["url"])1.10.2 Qwen-Image-2.0
Qwen-Image-2.0 maps to qwen-image-2.0. It suits general text-to-image and image editing, balancing quality and cost. The endpoint and parameters are the same as Qwen-Image-2.0-Pro; just set model to Qwen-Image-2.0.
1.11 Wan2.7 series
The Wan2.7 series suits image-set generation, multi-image reference, subject consistency, complex instruction following and stronger text rendering. Wan2.7-pro is more full-featured and suits quality-first scenarios; Wan2.7 suits regular image generation and editing.
Model mapping
| Platform model | Upstream model | Recommended for |
|---|---|---|
Wan2.7-pro | wan2.7-image-pro | High-quality image sets, complex editing, subject consistency, higher resolution |
Wan2.7 | wan2.7-image | General text-to-image, image-to-image and image editing |
Endpoints
Text-to-image: POST https://token.bytomdao.com/v1/images/generations
Image-to-image / image editing: POST https://token.bytomdao.com/v1/images/editsText-to-image request parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | — | Model name: Wan2.7 or Wan2.7-pro |
prompt | string | Yes | — | Positive prompt describing the content, style, composition and text requirements of the image |
parameters.size | string | No | 2K | Output size. Wan2.7 supports tiers such as 1K, 2K, 4K; specific resolutions can also be passed in some scenarios |
parameters.n | integer | No | 1 | Number of images to generate |
parameters.enable_sequential | boolean | No | false | Whether to enable image-set / sequential generation; set to true when you need several consecutive images |
parameters.negative_prompt | string | No | — | Negative prompt |
parameters.watermark | boolean | No | false | Whether to add a watermark |
parameters.seed | integer | No | — | Random seed |
Image-to-image / image editing request parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | — | Model name: Wan2.7 or Wan2.7-pro |
prompt | string | Yes | — | Editing instruction, such as subject replacement, style transfer, scene extension or image-set generation |
input.images | array | Yes | — | Array of reference image URLs or Base64 strings |
parameters.n | integer | No | 1 | Number of images to generate |
parameters.negative_prompt | string | No | — | Negative prompt |
parameters.watermark | boolean | No | false | Whether to add a watermark |
parameters.seed | integer | No | — | Random seed |
1.11.1 Wan2.7-pro
Wan2.7-pro maps to wan2.7-image-pro. It suits high-quality image sets, complex editing, subject consistency and higher-resolution scenarios.
Text-to-image
curl example
curl https://token.bytomdao.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Wan2.7-pro",
"prompt": "A set of key visuals for a Chinese-style tea drink brand, including product packaging, tea cups, bamboo leaves and an ink-wash background, with a consistent brand color, suitable for an e-commerce detail page",
"parameters": {
"size": "2K",
"n": 1,
"enable_sequential": false,
"negative_prompt": "Low quality, incorrect text, distorted subject",
"watermark": false,
"seed": 2026
}
}'Python example
import requests
response = requests.post(
"https://token.bytomdao.com/v1/images/generations",
headers={
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
},
json={
"model": "Wan2.7-pro",
"prompt": "A set of key visuals for a Chinese-style tea drink brand, including product packaging, tea cups, bamboo leaves and an ink-wash background, with a consistent brand color, suitable for an e-commerce detail page",
"parameters": {
"size": "2K",
"n": 1,
"enable_sequential": False,
"negative_prompt": "Low quality, incorrect text, distorted subject",
"watermark": False,
"seed": 2026
}
}
)
response.raise_for_status()
print(response.json()["data"][0]["url"])Image-to-image / reference image editing
curl example
curl https://token.bytomdao.com/v1/images/edits \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Wan2.7-pro",
"prompt": "Using these two images as reference, generate a scene of the same character reading in a cafe, keeping the facial features and clothing style consistent, with cinematic lighting",
"input": {
"prompt": "Using these two images as reference, generate a scene of the same character reading in a cafe, keeping the facial features and clothing style consistent, with cinematic lighting",
"images": [
"https://example.com/person.png",
"https://example.com/style.png"
],
"negative_prompt": "Distorted facial features, inconsistent clothing, low quality"
},
"parameters": {
"n": 1,
"watermark": false,
"seed": 2026
}
}'Python example
import requests
prompt = "Using these two images as reference, generate a scene of the same character reading in a cafe, keeping the facial features and clothing style consistent, with cinematic lighting"
response = requests.post(
"https://token.bytomdao.com/v1/images/edits",
headers={
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
},
json={
"model": "Wan2.7-pro",
"prompt": prompt,
"input": {
"prompt": prompt,
"images": [
"https://example.com/person.png",
"https://example.com/style.png"
],
"negative_prompt": "Distorted facial features, inconsistent clothing, low quality"
},
"parameters": {
"n": 1,
"watermark": False,
"seed": 2026
}
}
)
response.raise_for_status()
print(response.json()["data"][0]["url"])1.11.2 Wan2.7
Wan2.7 maps to wan2.7-image. It suits general text-to-image, image-to-image and image editing. The endpoint and parameters are the same as Wan2.7-pro; just set model to Wan2.7.
1.12 Doubao-Seedream series
The Doubao-Seedream series uses /v1/images/generations throughout. For text-to-image, only prompt is required; for image-to-image or multi-image fusion, pass reference images through the image field in the same request body.
Model mapping
| Platform model | Recommended for | Supported size tiers | Output format |
|---|---|---|---|
Doubao-Seedream-4.0 | General text-to-image, image-to-image, multi-image fusion | 1K, 2K, 4K | Fixed JPEG |
Doubao-Seedream-4.5 | Portraits, aesthetic enhancement, commercial visuals | 2K, 4K | Fixed JPEG |
Doubao-Seedream-5.0-pro | High-quality commercial creation, complex visual design | 1K, 1.5K, 2K | png, jpeg |
Doubao-Seedream-5.0-lite | Complex instructions, lightweight fast generation | 2K, 3K, 4K | png, jpeg |
Endpoints
POST https://token.bytomdao.com/v1/images/generationsRequest parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | — | Model name: Doubao-Seedream-4.0, Doubao-Seedream-4.5, Doubao-Seedream-5.0-pro or Doubao-Seedream-5.0-lite |
prompt | string | Yes | — | Text-to-image prompt or image-to-image editing instruction. When using size tiers, you can describe the aspect ratio, image shape or purpose in the prompt |
image | string / array | No | — | Reference image URL, Base64 string, or an array of them; only for image-to-image and multi-image fusion |
size | string | No | Model default | Either a resolution tier (e.g. 2K) or an explicit width×height in pixels (e.g. 2048x2048); the two styles cannot be mixed |
response_format | string | No | url | How the image is returned: url or b64_json |
output_format | string | No | Model default | Supported only by Doubao-Seedream-5.0-pro and Doubao-Seedream-5.0-lite; png or jpeg. Seedream 4.0/4.5 always output JPEG |
watermark | boolean | No | false | Whether to add a watermark. false adds none; true adds an "AI generated" label at the bottom-right of the image |
Unsupported parameters: Do not pass
n,seed,sequential_image_generationormax_images; they have no effect on the current endpoint. Each request returns one image. For multiple or consecutive images, send separate requests and state the subject, style and composition in each prompt.
Image size
size can be set in two ways:
- Resolution tier (recommended): pass a tier supported by the model (
1K,2K,3Kor4K) and describe the desired aspect ratio in theprompt. - Explicit pixel size: pass
widthxheight, e.g.2048x2048. The aspect ratio must be within[1/16, 16]and the total pixels must meet the model's limits.
Pixel sizes for common aspect ratios
| Model | Tier | 1:1 | 4:3 | 3:4 | 16:9 | 9:16 | 3:2 | 2:3 | 21:9 |
|---|---|---|---|---|---|---|---|---|---|
| Seedream 5.0 pro | 1K | 1024x1024 | 1152x864 | 864x1152 | 1424x800 | 800x1424 | 1248x832 | 832x1248 | 1568x672 |
| Seedream 5.0 pro | 1.5K | 1536x1536 | 1792x1344 | 1344x1792 | 2048x1152 | 1152x2048 | 1872x1248 | 1248x1872 | 2352x1008 |
| Seedream 5.0 pro | 2K | 2048x2048 | 2368x1776 | 1776x2368 | 2816x1584 | 1584x2816 | 2496x1664 | 1664x2496 | 3136x1344 |
| Seedream 5.0 lite | 2K | 2048x2048 | 2304x1728 | 1728x2304 | 2848x1600 | 1600x2848 | 2496x1664 | 1664x2496 | 3136x1344 |
| Seedream 5.0 lite | 3K | 3072x3072 | 3456x2592 | 2592x3456 | 4096x2304 | 2304x4096 | 3744x2496 | 2496x3744 | 4704x2016 |
| Seedream 5.0 lite | 4K | 4096x4096 | 4704x3520 | 3520x4704 | 5504x3040 | 3040x5504 | 4992x3328 | 3328x4992 | 6240x2656 |
| Seedream 4.5 | 2K | 2048x2048 | 2304x1728 | 1728x2304 | 2848x1600 | 1600x2848 | 2496x1664 | 1664x2496 | 3136x1344 |
| Seedream 4.5 | 4K | 4096x4096 | 4704x3520 | 3520x4704 | 5504x3040 | 3040x5504 | 4992x3328 | 3328x4992 | 6240x2656 |
| Seedream 4.0 | 1K | 1024x1024 | 1152x864 | 864x1152 | 1312x736 | 736x1312 | 1248x832 | 832x1248 | 1568x672 |
| Seedream 4.0 | 2K | 2048x2048 | 2304x1728 | 1728x2304 | 2848x1600 | 1600x2848 | 2496x1664 | 1664x2496 | 3136x1344 |
| Seedream 4.0 | 4K | 4096x4096 | 4704x3520 | 3520x4704 | 5504x3040 | 3040x5504 | 4992x3328 | 3328x4992 | 6240x2656 |
The table lists reference values for common aspect ratios only; the model supports aspect ratios beyond these standard ones.
Custom size limits
| Model | Total pixel range | Aspect ratio range |
|---|---|---|
Doubao-Seedream-5.0-pro | 921,600 (1280x720) – 4,624,220 (2048x2048, with model constraints) | [1/16, 16] |
Doubao-Seedream-5.0-lite | 3,686,400 (2560x1440) – 16,777,216 (4096x4096) | [1/16, 16] |
Doubao-Seedream-4.5 | 3,686,400 (2560x1440) – 16,777,216 (4096x4096) | [1/16, 16] |
Doubao-Seedream-4.0 | 921,600 (1280x720) – 16,777,216 (4096x4096) | [1/16, 16] |
Response format
When response_format is url, data contains the image download URLs:
{
"created": 1589478378,
"data": [
{ "url": "https://..." }
]
}When response_format is b64_json, data contains the Base64-encoded image data:
{
"created": 1589478378,
"data": [
{ "b64_json": "..." }
]
}1.12.1 Doubao-Seedream-4.0
Doubao-Seedream-4.0 suits general text-to-image, image-to-image and multi-image fusion. It supports the 1K, 2K and 4K tiers, and also accepts explicit pixel sizes that meet the constraints. Images are always output as JPEG.
curl example
curl https://token.bytomdao.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Doubao-Seedream-4.0",
"prompt": "A premium coffee brand poster, 3:2 landscape composition, a latte and coffee beans on a wooden table, warm natural light, commercial photography style",
"size": "2K",
"response_format": "url",
"watermark": false
}'Python example
import requests
response = requests.post(
"https://token.bytomdao.com/v1/images/generations",
headers={
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
},
json={
"model": "Doubao-Seedream-4.0",
"prompt": "A premium coffee brand poster, 3:2 landscape composition, a latte and coffee beans on a wooden table, warm natural light, commercial photography style",
"size": "2K",
"response_format": "url",
"watermark": False
}
)
response.raise_for_status()
print(response.json()["data"][0]["url"])1.12.2 Doubao-Seedream-4.5
Doubao-Seedream-4.5 is stronger at portraits, aesthetic enhancement and commercial visuals. It supports the 2K and 4K tiers, and also accepts explicit pixel sizes that meet the constraints. Images are always output as JPEG.
Image-to-image / multi-image fusion curl example
curl https://token.bytomdao.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Doubao-Seedream-4.5",
"prompt": "Using these images as reference, generate a 16:9 ad image of the same product in a summer outdoor scene, keeping the product appearance consistent, with a fresh, bright background",
"image": [
"https://example.com/product.png",
"https://example.com/style-reference.png"
],
"size": "2848x1600",
"response_format": "url",
"watermark": false
}'Python example
import requests
response = requests.post(
"https://token.bytomdao.com/v1/images/generations",
headers={
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
},
json={
"model": "Doubao-Seedream-4.5",
"prompt": "Using these images as reference, generate a 16:9 ad image of the same product in a summer outdoor scene, keeping the product appearance consistent, with a fresh, bright background",
"image": [
"https://example.com/product.png",
"https://example.com/style-reference.png"
],
"size": "2848x1600",
"response_format": "url",
"watermark": False
}
)
response.raise_for_status()
print(response.json()["data"][0]["url"])1.12.3 Doubao-Seedream-5.0-pro
Doubao-Seedream-5.0-pro targets high-quality commercial creation and complex visual design. It supports three size tiers: 1K, 1.5K and 2K. 1.5K costs the same as 1K, so 1.5K is usually the better choice; you can also pass an explicit pixel size that meets the total-pixel and aspect-ratio constraints. Use output_format to choose PNG or JPEG.
curl example
curl https://token.bytomdao.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Doubao-Seedream-5.0-pro",
"prompt": "Generate a commercial ad image of a premium smartwatch, 16:9 landscape composition, the product floating against a dark gradient background, clear metallic material details, studio-shot quality, suitable for a website homepage",
"size": "1.5K",
"response_format": "url",
"output_format": "png",
"watermark": false
}'Python example
import requests
response = requests.post(
"https://token.bytomdao.com/v1/images/generations",
headers={
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
},
json={
"model": "Doubao-Seedream-5.0-pro",
"prompt": "Generate a commercial ad image of a premium smartwatch, 16:9 landscape composition, the product floating against a dark gradient background, clear metallic material details, studio-shot quality, suitable for a website homepage",
"size": "1.5K",
"response_format": "url",
"output_format": "png",
"watermark": False
}
)
response.raise_for_status()
print(response.json()["data"][0]["url"])1.12.4 Doubao-Seedream-5.0-lite
Doubao-Seedream-5.0-lite suits complex instructions and high-frequency image generation. It supports the 2K, 3K and 4K tiers and explicit pixel sizes that meet the constraints, and output_format selects PNG or JPEG.
curl example
curl https://token.bytomdao.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Doubao-Seedream-5.0-lite",
"prompt": "Generate an ad image of a smartwatch, 9:16 portrait composition, the product floating against a dark gradient background, cool rim lighting, clean and modern look",
"size": "3K",
"response_format": "url",
"output_format": "png",
"watermark": false
}'Python example
import requests
response = requests.post(
"https://token.bytomdao.com/v1/images/generations",
headers={
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
},
json={
"model": "Doubao-Seedream-5.0-lite",
"prompt": "Generate an ad image of a smartwatch, 9:16 portrait composition, the product floating against a dark gradient background, cool rim lighting, clean and modern look",
"size": "3K",
"response_format": "url",
"output_format": "png",
"watermark": False
}
)
response.raise_for_status()
print(response.json()["data"][0]["url"])Part 2: Video generation models (VIDEO)
2.1 Supported models
| Model | Upstream Model ID | Description | Output specs |
|---|---|---|---|
| Seedance-2.5 | doubao-seedance-2-5-260628 | Next-generation video creation model; up to 30 seconds, multimodal references, video editing and extension | 480p / 720p; 4–30 s |
| Seedance-2.0 | doubao-seedance-2-0-260128 | Professional-grade video creation model for the highest generation quality | 480p / 720p / 1080p / 4k (10-bit); 4–15 s |
| Seedance-2.0-Fast | doubao-seedance-2-0-fast-260128 | Fast version with capabilities largely the same as 2.0, focused on speed and cost | 480p / 720p; 4–15 s |
| Seedance-2.0-Mini | doubao-seedance-2-0-mini-260615 | Lightweight version; usage, request parameters and output specs are identical to Seedance-2.0-Fast | 480p / 720p; 4–15 s |
| Omni-Flash | omni-flash | Google-family fast video model; supports text-to-video, reference-image-to-video, multi-image reference and video editing | 720p; 4 / 6 / 8 s |
| Veo-3.1 | — | Google-family video model; supports text-to-video and first/last-frame controlled generation | Fixed 8 s |
| Kling-3.0-Turbo | kling-video/kling-3.0-turbo | Kling 3.0 Turbo; supports text-to-video and first-frame image-to-video, with audio | std: 720p; pro: 1080p; 3–15 s |
| Grok-Imagine-Video-1.5-Fast | grok-imagine-video-1.5-fast | Grok 1.5 fast video model; supports text-to-video and generation from 0–7 reference images | 480p / 720p; 6–30 s |
| Grok-Imagine-Video-1.5 | grok-imagine-video-1.5 | Grok 1.5 high-quality image-to-video model; exactly 1 reference image is required | 480p / 720p / 1080p; 1–15 s |
| MiniMax-H3 | minimax-h3 | MiniMax video model; supports text-to-video, first/last-frame control and image / video / audio multimodal references | 768p / 2K; 5–15 s |
| MiniMax-H3-Max | — | Fast-generation version of MiniMax-H3; supports only text-to-video and first/last-frame image-to-video, no multimodal references | 480p / 768p; 5–15 s |
Parameter structures and capabilities differ between video models, so they are described below by model series.
Seedance 2.5 supports the following typical capabilities:
- Up to 30 seconds per generation: 4–30 seconds per request, or use
duration: -1to let the model choose a valid duration. - Large-scale multimodal references: up to 50 images, videos and audio clips combined in a single request.
- Video editing and extension: add, remove or modify objects, inpainting, audio editing, and extending a video forward or backward.
- First-frame / first-and-last-frame control: constrain generation with a first-frame image or a first and last image.
- Precise timestamp control: describe timing in the prompt to organize long narratives, shot transitions and editing goals.
The Seedance 2.0 series supports the following typical capabilities:
- Text-to-video: generate a video from a text prompt only.
- Image-to-video: generate a video from a first frame, last frame or several reference images.
- Multimodal reference: combine text, images, videos and audio as reference material.
- Video editing: subject replacement, adding / removing / modifying objects, inpainting and style adjustment on a reference video.
- Video extension: continue generating from one or more reference videos.
- Video with audio: set
generate_audio=trueto generate a video with sound.
Fast / Mini usage:
Seedance-2.0-FastandSeedance-2.0-Miniuse exactly the same endpoint, request parameters and asset formats. For any Seedance example below, just replacemodelwith the corresponding model name; both support480p,720pand 4–15 second videos.
2.2 Seedance 2.5
Seedance 2.5 uses the unified video generation endpoint of the Token gateway. Use the platform model name Seedance-2.5 in the request. Do not use the official Volcano Engine Model ID as the model value.
2.2.1 Endpoints
POST https://token.bytomdao.com/v1/video/generations
GET https://token.bytomdao.com/v1/video/generations/{task_id}Video creation is an asynchronous task. After a successful submission, save the id or task_id from the response, then use the query endpoint to get progress and results.
2.2.2 Building the request
The Token gateway uses a unified task format: the prompt goes in the top-level prompt, while the generation settings and multimodal content from the official API go in the top-level metadata.
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Fixed to Seedance-2.5 |
prompt | string | Yes | Video content, camera, action, dialogue, sound and editing intent; use @image1, @video1, @audio1 to reference assets |
metadata.content | array | No | Image, video and audio reference assets; array order corresponds to the asset numbers in the prompt |
metadata.ratio | string | No | 21:9, 16:9, 4:3, 1:1, 3:4, 9:16, adaptive |
metadata.resolution | string | No | 480p or 720p |
metadata.duration | integer | No | 4–30 seconds; -1 lets the model choose automatically within the valid range |
metadata.generate_audio | boolean | No | Whether to generate audio |
metadata.watermark | boolean | No | Whether to add a watermark |
metadata.return_last_frame | boolean | No | Whether to also return the last frame of the generated video |
metadata.content supports the following asset formats:
[
{
"type": "image_url",
"image_url": { "url": "https://example.com/image.jpg" },
"role": "reference_image"
},
{
"type": "video_url",
"video_url": { "url": "https://example.com/video.mp4" },
"role": "reference_video"
},
{
"type": "audio_url",
"audio_url": { "url": "https://example.com/audio.mp3" },
"role": "reference_audio"
}
]Images can also use the first_frame and last_frame roles. Asset URLs must be publicly accessible; images, videos and audio combined are limited to 50.
Task constraints are critical: Seedance 2.5 infers the task type from
content.roleand the prompt. If you violate theratio/durationconstraints for the task, the create endpoint may first return a task ID and then fail asynchronously when you query the task.
| Task type | How it is triggered | ratio / duration constraints |
|---|---|---|
| Text-to-video | No content | Any valid ratio and 4–30 s duration; duration: -1 also works |
| Reference-to-video | Assets use reference_image / reference_video / reference_audio, and the prompt describes the references | Any valid ratio and 4–30 s duration; avoid words like "edit, replace, extend, continue" in the prompt that may cause the task to be misclassified |
| Video editing | Pass reference assets and state an editing goal (add, remove, modify, replace) in the prompt | ratio must be adaptive and duration must be -1 |
| Video extension | Pass reference videos and state in the prompt that you want to extend forward / backward or continue | ratio must be adaptive; duration can be the added length or -1 for automatic |
| First-frame / first-and-last-frame to video | Use the first_frame image role, optionally with a last_frame image | ratio must be adaptive; duration can be 4–30 s or -1 |
2.3.3 Examples
Text-to-video (30 seconds)
curl https://token.bytomdao.com/v1/video/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Seedance-2.5",
"prompt": "A single-take sci-fi short film: an astronaut walks out of the base and discovers a glowing ruin in a storm; the camera pushes in from a wide shot to a close-up of the face, cinematic lighting",
"metadata": {
"ratio": "16:9",
"resolution": "720p",
"duration": 30,
"generate_audio": true,
"watermark": false
}
}'Multimodal reference to video
curl https://token.bytomdao.com/v1/video/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Seedance-2.5",
"prompt": "Keep the appearance of the character in @image1, follow the first-person camera movement of @video1, and use @audio1 as background music to generate a short film of a city night run",
"metadata": {
"content": [
{
"type": "image_url",
"image_url": { "url": "https://example.com/character.jpg" },
"role": "reference_image"
},
{
"type": "video_url",
"video_url": { "url": "https://example.com/camera.mp4" },
"role": "reference_video"
},
{
"type": "audio_url",
"audio_url": { "url": "https://example.com/music.mp3" },
"role": "reference_audio"
}
],
"ratio": "16:9",
"resolution": "720p",
"duration": 15,
"generate_audio": true
}
}'Video editing
curl https://token.bytomdao.com/v1/video/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Seedance-2.5",
"prompt": "Replace the cup held by the person in @video1 with the product in @image1, keeping the original camera movement, character actions and ambient lighting unchanged",
"metadata": {
"content": [
{
"type": "video_url",
"video_url": { "url": "https://example.com/source.mp4" },
"role": "reference_video"
},
{
"type": "image_url",
"image_url": { "url": "https://example.com/product.jpg" },
"role": "reference_image"
}
],
"ratio": "adaptive",
"duration": -1,
"generate_audio": true
}
}'Video extension
curl https://token.bytomdao.com/v1/video/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Seedance-2.5",
"prompt": "Extend @video1 backward: the train leaves the tunnel and enters a snowy mountain canyon, with the camera continuing the aerial movement and cool tones of the original video",
"metadata": {
"content": [
{
"type": "video_url",
"video_url": { "url": "https://example.com/source.mp4" },
"role": "reference_video"
}
],
"ratio": "adaptive",
"duration": 10,
"generate_audio": true
}
}'First-and-last-frame to video
curl https://token.bytomdao.com/v1/video/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Seedance-2.5",
"prompt": "Transition smoothly from the morning street in @image1 to the night scene in @image2, with the camera slowly pushing forward and the building structures staying consistent",
"metadata": {
"content": [
{
"type": "image_url",
"image_url": { "url": "https://example.com/first.jpg" },
"role": "first_frame"
},
{
"type": "image_url",
"image_url": { "url": "https://example.com/last.jpg" },
"role": "last_frame"
}
],
"ratio": "adaptive",
"resolution": "720p",
"duration": 8,
"return_last_frame": true
}
}'2.2.4 Query a task
curl https://token.bytomdao.com/v1/video/generations/YOUR_TASK_ID \
-H "Authorization: Bearer YOUR_API_TOKEN"Query every 15–30 seconds. A success status is usually SUCCESS or SUCCEEDED; read the video URL from data.result_url. A failure status is usually FAILURE or FAILED; read the reason from data.fail_reason or data.reason. For the full response fields and polling code, see "Task response and query" in the Seedance 2.0 section below.
2.3 Seedance 2.0 series
2.3.1 Endpoints
POST https://token.bytomdao.com/v1/video/generationsVideo generation is an asynchronous task. Creating a task returns a task ID immediately, and the client must use that ID to query progress and results:
GET https://token.bytomdao.com/v1/video/generations/{task_id}2.3.2 Request parameters
The Token gateway video endpoint uses a unified task format. The text prompt goes in the top-level prompt field; reference assets such as images, videos and audio go in metadata.content.
Top-level parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | — | Model name, such as Seedance-2.0, Seedance-2.0-Fast, Seedance-2.0-Mini |
prompt | string | Yes | — | Video generation prompt describing visuals, camera movement, action, sound, style, etc. |
metadata | object | No | — | Container for parameters passed through to the upstream video service, including reference assets, ratio, resolution and duration |
metadata parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
content | array | No | — | Array of multimodal reference assets. Only images, videos, audio and similar assets go here; put the text prompt in the top-level prompt |
ratio | string | No | 16:9 | Output aspect ratio: 21:9, 16:9, 4:3, 1:1, 3:4, 9:16 |
resolution | string | No | 720p | Output resolution. Seedance-2.0 supports 480p, 720p, 1080p; Seedance-2.0-Fast and Seedance-2.0-Mini support 480p, 720p |
duration | integer | No | 5 | Output video duration, 4–15 seconds |
generate_audio | boolean | No | false | Whether to generate a video with audio. Set to true if you need sound |
watermark | boolean | No | false | Whether to add a watermark to the result |
return_last_frame | boolean | No | false | Whether to also return the last frame of the video |
service_tier | string | No | — | Inference service tier. When the upstream supports flex offline inference, pass it according to your actual integration |
metadata.content array format
| type | Example field | role | Description |
|---|---|---|---|
image_url | { "type": "image_url", "image_url": { "url": "https://..." }, "role": "reference_image" } | reference_image / first_frame / last_frame | Reference image, first frame, last frame |
video_url | { "type": "video_url", "video_url": { "url": "https://..." }, "role": "reference_video" } | reference_video | Reference video, used for editing, extending, or inheriting camera movement, subject and style |
audio_url | { "type": "audio_url", "audio_url": { "url": "https://..." }, "role": "reference_audio" } | reference_audio | Reference audio, used to inherit timbre, music melody, dialogue, etc. |
Input limits: Multimodal references can combine text, images, videos and audio, but the text belongs in the top-level
prompt. 0–9 images, 0–3 videos and 0–3 audio clips are supported. Asset URLs must be publicly accessible. Do not use reference images containing real human faces, to avoid triggering content safety checks over personal privacy.
Billing: Video models use pre-authorization plus settlement refund. When a task is created, part of your balance is pre-charged based on the model, resolution, duration and input mode. After the task ends, the system settles based on actual token usage: any difference is refunded if actual usage is lower than the pre-charge, extra may be charged if it is higher, and the full pre-charge is refunded if the task fails.
2.3.3 Examples
The Python examples below use only the Python standard library, so no third-party dependencies are needed. With Python 3.8+, copy the shared helper functions below, append any scenario's Python payload example, and replace API_KEY with your own Token API Key to run it directly.
import json
import time
from urllib import error, request
BASE_URL = "https://token.bytomdao.com"
API_KEY = "YOUR_API_TOKEN"
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {API_KEY}",
}
def request_json(method: str, path: str, payload=None) -> dict:
data = None
if payload is not None:
data = json.dumps(payload, ensure_ascii=False).encode("utf-8")
req = request.Request(
f"{BASE_URL}{path}",
data=data,
headers=headers,
method=method,
)
try:
with request.urlopen(req, timeout=60) as resp:
body = resp.read().decode("utf-8")
except error.HTTPError as exc:
body = exc.read().decode("utf-8")
raise RuntimeError(f"HTTP {exc.code}: {body}") from exc
return json.loads(body) if body else {}
def submit_and_poll(payload: dict, interval: int = 30) -> dict:
task = request_json("POST", "/v1/video/generations", payload)
task_id = task.get("task_id") or task["id"]
while True:
result = request_json("GET", f"/v1/video/generations/{task_id}")
data = result.get("data", result)
upstream_data = data.get("data") or {}
content = upstream_data.get("content") or {}
status = str(data.get("status", "")).upper()
if status in ("SUCCESS", "SUCCEEDED"):
video_url = data.get("result_url") or content.get("video_url")
print("video url:", video_url)
return result
if status in ("FAILURE", "FAILED"):
print("failed reason:", data.get("fail_reason") or data.get("reason"))
return result
print("current status:", status, "progress:", data.get("progress"))
time.sleep(interval)Text-to-video
Pure text-to-video only needs prompt. Generation parameters such as ratio, resolution and duration go in metadata.
curl example
curl https://token.bytomdao.com/v1/video/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Seedance-2.0",
"prompt": "A golden retriever running on the beach, slow motion, afterglow of the sunset, cinematic shot",
"metadata": {
"ratio": "16:9",
"resolution": "720p",
"duration": 5,
"generate_audio": true,
"watermark": false
}
}'Python example
payload = {
"model": "Seedance-2.0",
"prompt": "A golden retriever running on the beach, slow motion, afterglow of the sunset, cinematic shot",
"metadata": {
"ratio": "16:9",
"resolution": "720p",
"duration": 5,
"generate_audio": True,
"watermark": False,
},
}
submit_and_poll(payload)Image-to-video (first and last frames)
Put the prompt in the top-level prompt, and the first-frame and last-frame images in metadata.content.
curl example
curl https://token.bytomdao.com/v1/video/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Seedance-2.0",
"prompt": "A first-person fruit tea ad: the first frame is image 1, showing a red apple with morning dew; the camera quickly cuts to a shaker and the fruit tea being made, and the last frame freezes on the finished fruit tea in image 2, fresh and natural look",
"metadata": {
"content": [
{
"type": "image_url",
"image_url": {
"url": "https://ark-project.tos-cn-beijing.volces.com/doc_image/r2v_tea_pic1.jpg"
},
"role": "first_frame"
},
{
"type": "image_url",
"image_url": {
"url": "https://ark-project.tos-cn-beijing.volces.com/doc_image/r2v_tea_pic2.jpg"
},
"role": "last_frame"
}
],
"ratio": "16:9",
"resolution": "720p",
"duration": 6
}
}'Python example
payload = {
"model": "Seedance-2.0",
"prompt": "A first-person fruit tea ad: the first frame is image 1, showing a red apple with morning dew; the camera quickly cuts to a shaker and the fruit tea being made, and the last frame freezes on the finished fruit tea in image 2, fresh and natural look",
"metadata": {
"content": [
{
"type": "image_url",
"image_url": {
"url": "https://ark-project.tos-cn-beijing.volces.com/doc_image/r2v_tea_pic1.jpg"
},
"role": "first_frame",
},
{
"type": "image_url",
"image_url": {
"url": "https://ark-project.tos-cn-beijing.volces.com/doc_image/r2v_tea_pic2.jpg"
},
"role": "last_frame",
},
],
"ratio": "16:9",
"resolution": "720p",
"duration": 6,
},
}
submit_and_poll(payload)Multimodal reference
Multimodal reference suits combining image, video and audio assets to inherit character appearance, visual style, composition, camera movement, action or sound.
curl example
curl https://token.bytomdao.com/v1/video/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Seedance-2.0",
"prompt": "Use the first-person composition of video 1 throughout and audio 1 as background music throughout. A first-person fruit tea ad, with image 1 as the first frame and image 2 as the last frame, fresh and natural look.",
"metadata": {
"content": [
{
"type": "image_url",
"image_url": { "url": "https://ark-project.tos-cn-beijing.volces.com/doc_image/r2v_tea_pic1.jpg" },
"role": "reference_image"
},
{
"type": "image_url",
"image_url": { "url": "https://ark-project.tos-cn-beijing.volces.com/doc_image/r2v_tea_pic2.jpg" },
"role": "reference_image"
},
{
"type": "video_url",
"video_url": { "url": "https://ark-project.tos-cn-beijing.volces.com/doc_video/r2v_tea_video1.mp4" },
"role": "reference_video"
},
{
"type": "audio_url",
"audio_url": { "url": "https://ark-project.tos-cn-beijing.volces.com/doc_audio/r2v_tea_audio1.mp3" },
"role": "reference_audio"
}
],
"ratio": "16:9",
"duration": 11,
"generate_audio": true,
"watermark": true
}
}'Python example
payload = {
"model": "Seedance-2.0",
"prompt": "Use the first-person composition of video 1 throughout and audio 1 as background music throughout. A first-person fruit tea ad, with image 1 as the first frame and image 2 as the last frame, fresh and natural look.",
"metadata": {
"content": [
{
"type": "image_url",
"image_url": {"url": "https://ark-project.tos-cn-beijing.volces.com/doc_image/r2v_tea_pic1.jpg"},
"role": "reference_image",
},
{
"type": "image_url",
"image_url": {"url": "https://ark-project.tos-cn-beijing.volces.com/doc_image/r2v_tea_pic2.jpg"},
"role": "reference_image",
},
{
"type": "video_url",
"video_url": {"url": "https://ark-project.tos-cn-beijing.volces.com/doc_video/r2v_tea_video1.mp4"},
"role": "reference_video",
},
{
"type": "audio_url",
"audio_url": {"url": "https://ark-project.tos-cn-beijing.volces.com/doc_audio/r2v_tea_audio1.mp3"},
"role": "reference_audio",
},
],
"ratio": "16:9",
"duration": 11,
"generate_audio": True,
"watermark": True,
},
}
submit_and_poll(payload)Video editing
Video editing usually takes the video to edit plus reference assets, then uses prompt to describe the replacement, addition / removal, repair or style adjustment you want.
curl example
curl https://token.bytomdao.com/v1/video/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Seedance-2.0",
"prompt": "Replace the perfume in the gift box in video 1 with the face cream in image 1, keeping the original camera movement and giving the product a natural texture",
"metadata": {
"content": [
{
"type": "image_url",
"image_url": { "url": "https://ark-project.tos-cn-beijing.volces.com/doc_image/r2v_edit_pic1.jpg" },
"role": "reference_image"
},
{
"type": "video_url",
"video_url": { "url": "https://ark-project.tos-cn-beijing.volces.com/doc_video/r2v_edit_video1.mp4" },
"role": "reference_video"
}
],
"ratio": "16:9",
"resolution": "720p",
"duration": 5,
"generate_audio": true,
"watermark": false
}
}'Python example
payload = {
"model": "Seedance-2.0",
"prompt": "Replace the perfume in the gift box in video 1 with the face cream in image 1, keeping the original camera movement and giving the product a natural texture",
"metadata": {
"content": [
{
"type": "image_url",
"image_url": {"url": "https://ark-project.tos-cn-beijing.volces.com/doc_image/r2v_edit_pic1.jpg"},
"role": "reference_image",
},
{
"type": "video_url",
"video_url": {"url": "https://ark-project.tos-cn-beijing.volces.com/doc_video/r2v_edit_video1.mp4"},
"role": "reference_video",
},
],
"ratio": "16:9",
"resolution": "720p",
"duration": 5,
"generate_audio": True,
"watermark": False,
},
}
submit_and_poll(payload)Video extension
Video extension usually takes one or more reference_video items, then uses prompt to describe the direction of extension (forward, backward) or how multiple clips are chained.
curl example
curl https://token.bytomdao.com/v1/video/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Seedance-2.0",
"prompt": "The arched window in video 1 opens, entering the interior of an art gallery, followed by video 2; the camera then moves into a painting, followed by video 3, with coherent cinematic camera movement throughout",
"metadata": {
"content": [
{
"type": "video_url",
"video_url": { "url": "https://ark-project.tos-cn-beijing.volces.com/doc_video/r2v_extend_video1.mp4" },
"role": "reference_video"
},
{
"type": "video_url",
"video_url": { "url": "https://ark-project.tos-cn-beijing.volces.com/doc_video/r2v_extend_video2.mp4" },
"role": "reference_video"
},
{
"type": "video_url",
"video_url": { "url": "https://ark-project.tos-cn-beijing.volces.com/doc_video/r2v_extend_video3.mp4" },
"role": "reference_video"
}
],
"ratio": "16:9",
"duration": 8,
"generate_audio": true,
"watermark": true
}
}'Python example
payload = {
"model": "Seedance-2.0",
"prompt": "The arched window in video 1 opens, entering the interior of an art gallery, followed by video 2; the camera then moves into a painting, followed by video 3, with coherent cinematic camera movement throughout",
"metadata": {
"content": [
{
"type": "video_url",
"video_url": {"url": "https://ark-project.tos-cn-beijing.volces.com/doc_video/r2v_extend_video1.mp4"},
"role": "reference_video",
},
{
"type": "video_url",
"video_url": {"url": "https://ark-project.tos-cn-beijing.volces.com/doc_video/r2v_extend_video2.mp4"},
"role": "reference_video",
},
{
"type": "video_url",
"video_url": {"url": "https://ark-project.tos-cn-beijing.volces.com/doc_video/r2v_extend_video3.mp4"},
"role": "reference_video",
},
],
"ratio": "16:9",
"duration": 8,
"generate_audio": True,
"watermark": True,
},
}
submit_and_poll(payload)2.3.4 Task response and query
Create-task response
After a successful creation, the endpoint returns a task ID. id and task_id refer to the same task; use either one for later queries.
{
"id": "task_yUvIeAeHbZSQ4dPJT6BA1f7SFUW6ErFh",
"task_id": "task_yUvIeAeHbZSQ4dPJT6BA1f7SFUW6ErFh",
"object": "video",
"model": "Seedance-2.0",
"status": "queued",
"progress": 0,
"created_at": 1780974847
}Query a task
curl https://token.bytomdao.com/v1/video/generations/task_yUvIeAeHbZSQ4dPJT6BA1f7SFUW6ErFh \
-H "Authorization: Bearer YOUR_API_TOKEN"Query every 15–30 seconds. Terminal statuses are SUCCESS or FAILURE; while the task is still generating you will usually see statuses such as SUBMITTED, QUEUED and IN_PROGRESS.
Query response
On success, the generated video URL is usually returned in data.result_url:
{
"code": "success",
"message": "",
"data": {
"task_id": "task_yUvIeAeHbZSQ4dPJT6BA1f7SFUW6ErFh",
"status": "SUCCESS",
"progress": "100%",
"result_url": "https://example.com/result.mp4",
"quota": 556000,
"finish_time": 1780975200
}
}On failure, the failure reason is returned:
{
"code": "success",
"message": "",
"data": {
"task_id": "task_yUvIeAeHbZSQ4dPJT6BA1f7SFUW6ErFh",
"status": "FAILURE",
"progress": "100%",
"fail_reason": "upstream error message"
}
}| Field | Type | Description |
|---|---|---|
code | string | Query response status; success on success |
message | string | Response message |
data.task_id | string | Video generation task ID |
data.status | string | Task status; common values: SUBMITTED, QUEUED, IN_PROGRESS, SUCCESS, FAILURE |
data.progress | string | Task progress, usually a percentage string |
data.result_url | string | Video URL after successful generation |
data.data.content.video_url | string | Original video URL returned by the upstream. Usually points to the same video as data.result_url and can be used as a fallback |
data.fail_reason | string | Reason for generation failure |
data.quota | integer | Final charged quota recorded for the task. Video models are settled based on actual usage after the task ends |
About escaped video URLs
The query endpoint returns JSON. The & in a video URL may appear as \u0026. This is normal JSON string escaping, not a broken link; a JSON parser restores the real URL automatically.
For example, the raw response may show:
{
"result_url": "https://example.com/result.mp4?X-Tos-Date=20260609T051645Z\u0026X-Tos-Expires=86400"
}After parsing with Python, the field value automatically becomes:
https://example.com/result.mp4?X-Tos-Date=20260609T051645Z&X-Tos-Expires=86400If you see something like the following in a web page, Markdown editor or chat window:
[https://example.com/result.mp4?...](https://example.com/result.mp4?...)That is the display layer rendering the URL as a Markdown link, not the real field returned by the endpoint. In practice, read data.result_url from the JSON, or the fallback field data.data.content.video_url.
Note: Do not manually decode percent-encoded characters such as
%2For%3Din the URL, and do not truncate the signature parameters after?. Video URLs are usually signed links with an expiry, and the entire query string must be kept intact to access them.
Python query example
If you already have a task_id, you can call the query endpoint on its own. Replace API_KEY and task_id and run it:
import json
import time
from urllib import error, request
BASE_URL = "https://token.bytomdao.com"
API_KEY = "YOUR_API_TOKEN"
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {API_KEY}",
}
task_id = "task_yUvIeAeHbZSQ4dPJT6BA1f7SFUW6ErFh"
def get_task(task_id: str) -> dict:
req = request.Request(
f"{BASE_URL}/v1/video/generations/{task_id}",
headers=headers,
method="GET",
)
try:
with request.urlopen(req, timeout=60) as resp:
body = resp.read().decode("utf-8")
except error.HTTPError as exc:
body = exc.read().decode("utf-8")
raise RuntimeError(f"HTTP {exc.code}: {body}") from exc
return json.loads(body) if body else {}
while True:
result = get_task(task_id)
data = result.get("data", result)
upstream_data = data.get("data") or {}
content = upstream_data.get("content") or {}
status = str(data.get("status", "")).upper()
if status in ("SUCCESS", "SUCCEEDED"):
video_url = data.get("result_url") or content.get("video_url")
print("video url:", video_url)
break
if status in ("FAILURE", "FAILED"):
print("failed reason:", data.get("fail_reason") or data.get("reason"))
break
print("current status:", status, "progress:", data.get("progress"))
time.sleep(30)Note: Video generation is asynchronous, and a task can take several minutes. Do not wait for the final video URL on the create-task endpoint; always get the final result through the task query endpoint.
2.4 Google series (Omni-Flash / Veo-3.1)
Omni-Flash and Veo-3.1 are both Google-family video models and share the same video task creation and query endpoints. The main differences:
| Capability | Omni-Flash | Veo-3.1 |
|---|---|---|
| Video duration | 4 / 6 / 8 seconds | Fixed 8 seconds |
| Text-to-video | Supported, mode=text | Supported, mode=text |
| Plain reference images | 1–3 images, mode=ref | — |
| First/last-frame control | Strict first/last-frame control not supported | Supported, mode=frame, pass the first-frame then last-frame image in order |
| Video editing | Supported, mode=edit | — |
2.3.1 Omni-Flash
Omni-Flash is a model for fast video generation and editing. It supports the following modes:
- Text-to-video: generate a video from a text prompt only.
- Reference-image-to-video: use 1–3 reference images to constrain subject, style or composition.
- Video editing: modify visuals based on a source video, with up to 3 reference images.
Mode limitation: Omni-Flash's
refmode is reference-image generation; it does not support designating two images as strict first and last frames. When you need several images, pass them as plain reference images and explain each image's purpose in theprompt.
2.3.1.1 Endpoints
JSON requests suit text-to-video and single-image reference with a public image URL:
POST https://token.bytomdao.com/v1/video/generationsLocal multi-image upload and video editing use the multipart/form-data endpoint:
POST https://token.bytomdao.com/v1/video/generationsAfter the task is created, use the unified query endpoint to get progress and results:
GET https://token.bytomdao.com/v1/video/generations/{task_id}2.3.1.2 Request parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | — | Fixed to Omni-Flash |
prompt | string | Yes | — | Video generation or editing prompt |
mode | string | Yes | — | text: text-to-video; ref: reference-image-to-video; edit: video editing |
input_reference | string / file / array | No | — | In ref mode pass 1–3 reference images; in edit mode the first item must be the source video URL, followed by up to 3 reference images |
watermark | boolean | No | false | Whether to add a watermark. Use a JSON boolean true / false, not a string |
size | string | No | — | Output orientation. 1280x720 is landscape and 720x1280 is portrait; the endpoint mainly determines orientation from the width/height relationship |
resolution | string | No | 720p | Output resolution; the current examples use 720p |
seconds | integer | No | 8 | Video duration: 4, 6 or 8 seconds |
Rules for input_reference:
mode=text: do not passinput_reference.mode=ref: 1–3 reference images; a single public image can be a JSON string, while multiple local images require repeating the field in multipart/form-data.mode=edit: the firstinput_referenceis the source video URL, and the 2nd–4th are optional reference images (up to 3).
2.3.1.3 Text-to-video
curl https://token.bytomdao.com/v1/video/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Omni-Flash",
"prompt": "An armored fighter jet in a Gundam color scheme flies across the morning city skyline, with the camera smoothly following, and finally transforms into a robot in mid-air and lands on top of a skyscraper, cinematic lighting",
"mode": "text",
"watermark": false,
"size": "1280x720",
"resolution": "720p",
"seconds": 8
}'After a successful creation, asynchronous task information is returned immediately:
{
"id": "task_W9Vq58KCrolT1Z2zDyaDXViZWB5S66Hv",
"task_id": "task_W9Vq58KCrolT1Z2zDyaDXViZWB5S66Hv",
"object": "video",
"model": "omni-flash",
"status": "in_progress",
"progress": 0,
"created_at": 1785314715,
"seconds": "8",
"size": "1280x720"
}2.3.1.4 Single-image reference to video
With a public image URL, you can submit one reference image through a JSON request:
curl https://token.bytomdao.com/v1/video/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Omni-Flash",
"prompt": "A first-person fruit tea ad, referencing the image of a red apple with morning dew; the camera quickly cuts to a shaker and the fruit tea being made, and finally freezes on the finished fruit tea, fresh and natural look",
"mode": "ref",
"input_reference": "https://ark-project.tos-cn-beijing.volces.com/doc_image/r2v_tea_pic1.jpg",
"watermark": false,
"size": "1280x720",
"resolution": "720p",
"seconds": 8
}'2.3.1.5 Multi-image reference to video
When uploading local images, use multipart/form-data and repeat input_reference for each image. Up to 3 reference images are supported:
curl --location https://token.bytomdao.com/v1/video/generations \
--header "Authorization: Bearer YOUR_API_TOKEN" \
--form 'model=Omni-Flash' \
--form 'prompt=A first-person fruit tea ad: use the first reference image to keep the red apple subject consistent and the second reference image to constrain the composition of the finished fruit tea, fresh and natural look' \
--form 'mode=ref' \
--form 'input_reference=@r2v_tea_pic1.jpg' \
--form 'input_reference=@r2v_tea_pic2.jpg' \
--form 'watermark=false' \
--form 'size=1280x720' \
--form 'resolution=720p' \
--form 'seconds=8'Note: All the images are reference material, not strict first and last frames. In the prompt, describe the subject, style or composition each image should constrain.
2.3.1.6 Video editing
In video editing mode, the first input_reference must be the source video URL; you can then repeat the field to upload 1–3 reference images:
curl --location https://token.bytomdao.com/v1/video/generations \
--header "Authorization: Bearer YOUR_API_TOKEN" \
--form 'model=Omni-Flash' \
--form 'prompt=Replace the opening scene of the source video with the scene in the reference image, keeping the subsequent camera movement and subject actions natural and coherent' \
--form 'mode=edit' \
--form 'input_reference=https://example.com/source-video.mp4' \
--form 'input_reference=@r2v_tea_pic1.jpg' \
--form 'watermark=false' \
--form 'size=1280x720' \
--form 'resolution=720p' \
--form 'seconds=8'2.3.1.7 Query a task
Query the status using the task_id from the create-task response:
curl https://token.bytomdao.com/v1/video/generations/task_W9Vq58KCrolT1Z2zDyaDXViZWB5S66Hv \
-H "Authorization: Bearer YOUR_API_TOKEN"When the task completes, the outer task status is SUCCESS and the video URL is usually in data.result_url; some responses also return the upstream video URL in data.data.video_url:
{
"code": "success",
"message": "",
"data": {
"task_id": "task_W9Vq58KCrolT1Z2zDyaDXViZWB5S66Hv",
"status": "SUCCESS",
"progress": "100%",
"result_url": "https://example.com/result.mp4",
"data": {
"model": "omni-flash",
"status": "completed",
"progress": 100,
"seconds": "8",
"size": "1280x720",
"video_url": "https://example.com/result.mp4"
}
}
}Polling frequency, failure statuses and signed-URL handling are the same as for the Seedance series; see §2.2.4.
2.3.2 Veo-3.1
Veo-3.1 supports text-to-video and first/last-frame controlled generation. Compared with Omni-Flash, Veo-3.1 has seconds fixed at 8 and adds mode=frame, which controls the opening frame, closing frame and the transition in between through first-frame and last-frame images.
2.3.2.1 Request parameter differences
Veo-3.1 reuses the Google-series endpoint, authentication, orientation, resolution and task query described in §2.3.1. The differing parameters are:
| Parameter | Type | Required | Fixed value / Description |
|---|---|---|---|
model | string | Yes | Fixed to Veo-3.1 |
mode | string | Yes | text: text-to-video; frame: first/last-frame controlled generation |
seconds | integer | No | Fixed at 8; 4 or 6 seconds are not supported |
input_reference | string / file / array | Yes in frame mode | Pass the first-frame and last-frame images in order, 2 images in total; the order cannot be swapped |
First/last-frame order: With
mode=frame, the 1stinput_referenceis the first-frame image and the 2nd is the last-frame image. Together they control the opening and closing frames of the video, whilepromptdescribes the action, camera movement and transition in between.
2.3.2.2 Text-to-video
curl https://token.bytomdao.com/v1/video/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Veo-3.1",
"prompt": "On a coastline in the early morning, a vintage sports car drives along the seaside road, with the camera slowly descending from high altitude and following the car, cinematic lighting",
"mode": "text",
"watermark": false,
"size": "1280x720",
"resolution": "720p",
"seconds": 8
}'2.3.2.3 First/last-frame controlled generation
When uploading local first-frame and last-frame images, use multipart/form-data and repeat input_reference with the first frame before the last frame:
curl --location https://token.bytomdao.com/v1/video/generations \
--header "Authorization: Bearer YOUR_API_TOKEN" \
--form 'model=Veo-3.1' \
--form 'prompt=The camera moves smoothly forward from the morning city in the first frame, the sky gradually turns to sunset glow, the car keeps driving along the road, and the video finally transitions naturally to the night scene in the last frame' \
--form 'mode=frame' \
--form 'input_reference=@first-frame.jpg' \
--form 'input_reference=@last-frame.jpg' \
--form 'watermark=false' \
--form 'size=1280x720' \
--form 'resolution=720p' \
--form 'seconds=8'Note: Veo-3.1 supports 8-second videos only. Even if you omit
seconds, plan the prompt and the action between the first and last frames for 8 seconds; if you pass it explicitly, it can only be8.
Veo-3.1's create-task response and query method are the same as Omni-Flash; see §2.3.1.7.
2.5 Kling-3.0-Turbo
Kling-3.0-Turbo is the high-speed video generation model in the Kling 3.0 series. It supports the following modes:
- Text-to-video: generate a video directly from a text prompt.
- Image-to-video: use one image as the first frame together with a prompt to generate a dynamic video.
- Multi-shot generation: define 1–6 consecutive shots through
metadata.multi_prompt. - Quality tiers:
stdis 720p andprois 1080p.
Generated videos include audio, and tasks are billed by the actual generated duration. Video generation is asynchronous: create a task first, then use the returned task ID to query progress and results.
2.4.1 Endpoints
Create a text-to-video or image-to-video task:
POST https://token.bytomdao.com/v1/video/generationsQuery task status and results:
GET https://token.bytomdao.com/v1/video/generations/{task_id}2.4.2 Request parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | — | Fixed to Kling-3.0-Turbo |
prompt | string | Conditional | — | Video prompt, recommended to be at most 2500 characters; use either this or metadata.multi_prompt |
image | string | Yes for image-to-video | — | First-frame image URL or Base64; passing it switches to image-to-video mode automatically |
size | string | No | 1280x720 | Text-to-video output ratio: 1280x720 (16:9), 720x1280 (9:16), 1024x1024 (1:1); for image-to-video the ratio is determined by the first-frame image |
duration | integer / string | No | 5 | Video duration, an integer from 3 to 15 seconds |
metadata.mode | string | No | std | Quality tier: std is 720p, pro is 1080p |
metadata.multi_prompt | array | No | — | Multi-shot prompts, 1–6 shots; use either this or the top-level prompt |
metadata.image_tail | string | No | — | Last-frame image URL or Base64; image-to-video only |
metadata.negative_prompt | string | No | — | Negative prompt describing what you do not want to appear |
metadata.cfg_scale | number | No | 0.5 | Prompt guidance strength |
metadata.callback_url | string | No | — | Callback URL for task status |
metadata.external_task_id | string | No | — | Caller-defined task identifier |
Each shot in metadata.multi_prompt has the following structure:
| Parameter | Type | Required | Description |
|---|---|---|---|
index | integer | Yes | Shot number, starting from 1 |
prompt | string | Yes | Visual, action and camera description of this shot |
duration | string | Yes | Duration of this shot; the total of all shots should equal the task duration |
Image limits:
imagesupports.jpg,.jpegand.png, up to 50 MB; width and height must each be at least 300 px, and the aspect ratio must be between 1:2.5 and 2.5:1.
2.4.3 Text-to-video
curl https://token.bytomdao.com/v1/video/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Kling-3.0-Turbo",
"prompt": "A paper airplane flies across the morning city skyline, with the camera smoothly following, cinematic lighting",
"size": "1280x720",
"duration": 5,
"metadata": {
"mode": "std"
}
}'2.4.4 Image-to-video
curl https://token.bytomdao.com/v1/video/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Kling-3.0-Turbo",
"prompt": "Make the person in the frame smile and slowly look at the camera, hair swaying naturally in the breeze, with the camera pushing in slightly",
"image": "https://example.com/first-frame.jpg",
"duration": 5,
"metadata": {
"mode": "pro"
}
}'The frame size of image-to-video is determined by the first-frame image, so size is usually not needed. To constrain the ending frame, pass a last-frame image in metadata.image_tail:
{
"model": "Kling-3.0-Turbo",
"prompt": "The camera transitions smoothly from a morning street to a city lit by neon lights at night",
"image": "https://example.com/first-frame.jpg",
"duration": 8,
"metadata": {
"mode": "std",
"image_tail": "https://example.com/last-frame.jpg"
}
}2.4.5 Multi-shot video
Use metadata.multi_prompt to submit 1–6 consecutive shots. Do not pass the top-level prompt at the same time:
curl https://token.bytomdao.com/v1/video/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Kling-3.0-Turbo",
"duration": 10,
"size": "1280x720",
"metadata": {
"mode": "std",
"multi_prompt": [
{
"index": 1,
"prompt": "A city street in the early morning, a paper airplane takes off from a window, wide-angle shot",
"duration": "4"
},
{
"index": 2,
"prompt": "A paper airplane flies between tall buildings, the camera smoothly following, sunlight creating rim lighting",
"duration": "6"
}
]
}
}'2.4.6 Create-task response
On success, a unified video task object is returned. Save the id or the compatible field task_id:
{
"id": "task_xxxxxxxxxxxxxxxx",
"task_id": "task_xxxxxxxxxxxxxxxx",
"object": "video",
"model": "Kling-3.0-Turbo",
"status": "queued",
"progress": 0,
"created_at": 1785314715
}2.4.7 Query a task
curl https://token.bytomdao.com/v1/video/generations/task_xxxxxxxxxxxxxxxx \
-H "Authorization: Bearer YOUR_API_TOKEN"Task statuses are queued, in_progress, completed and failed. When the task completes, the video URL is in metadata.url:
{
"id": "task_xxxxxxxxxxxxxxxx",
"task_id": "task_xxxxxxxxxxxxxxxx",
"object": "video",
"model": "Kling-3.0-Turbo",
"status": "completed",
"progress": 100,
"created_at": 1785314715,
"completed_at": 1785314835,
"seconds": "5",
"metadata": {
"url": "https://example.com/generated-video.mp4"
}
}Note: Result video URLs are usually temporary signed links, so download and store the video promptly after the task completes. Query every 10–30 seconds and avoid high-frequency polling.
2.6 Grok Imagine Video 1.5 series
The Grok Imagine Video 1.5 series is called through the unified video generation endpoint of the Token gateway. It includes the fast Grok-Imagine-Video-1.5-Fast and the high-quality Grok-Imagine-Video-1.5.
The main differences:
| Capability | Grok-Imagine-Video-1.5-Fast | Grok-Imagine-Video-1.5 |
|---|---|---|
| Text-to-video | Supported | Not supported; a reference image is required |
| Reference images | 0–7 | Exactly 1 |
| Video duration | 6–30 seconds | 1–15 seconds |
| Resolution | 480p, 720p | 480p, 720p, 1080p |
| Supported ratios | 2:3, 3:2, 1:1, 9:16, 16:9 | 2:3, 3:2, 1:1, 9:16, 16:9 |
2.6.1 Endpoints
Create a video task:
POST https://token.bytomdao.com/v1/video/generationsQuery task status and results:
GET https://token.bytomdao.com/v1/video/generations/{task_id}Video generation is asynchronous. After a task is created, save the id or task_id from the response, then use the query endpoint to get the task progress and the final video URL.
2.6.2 Request parameters
The Token gateway uses a unified video task format: the text prompt goes in the top-level prompt; ratio, resolution, duration and reference images go in metadata.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | — | Grok-Imagine-Video-1.5-Fast or Grok-Imagine-Video-1.5 |
prompt | string | Yes | — | Description of video content, subject action, camera movement, lighting and style |
metadata.ratio | string | No | 16:9 | Output aspect ratio: 2:3, 3:2, 1:1, 9:16, 16:9 |
metadata.resolution | string | No | 720p | Fast supports 480p, 720p; the standard version additionally supports 1080p |
metadata.duration | integer | No | 10 | Fast supports 6–30 seconds; the standard version supports 1–15 seconds |
metadata.content | array | Conditional | — | Array of reference images. Fast accepts 0–7; the standard version requires exactly 1 |
Reference images use the following format:
{
"type": "image_url",
"image_url": {
"url": "https://example.com/reference.jpg"
},
"role": "first_frame"
}Image input rules: Reference image URLs must be publicly accessible.
Grok-Imagine-Video-1.5requires exactly one image;Grok-Imagine-Video-1.5-Fastis text-to-video when no image is passed, and accepts up to 7 reference images when images are passed.
2.6.3 Fast text-to-video
curl https://token.bytomdao.com/v1/video/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Grok-Imagine-Video-1.5-Fast",
"prompt": "Cinematic aerial shot of a snowy mountain sunrise, a sea of clouds drifting slowly, golden sunlight passing through the peaks, the camera pushing smoothly forward",
"metadata": {
"ratio": "16:9",
"resolution": "720p",
"duration": 10
}
}'Python example:
import requests
response = requests.post(
"https://token.bytomdao.com/v1/video/generations",
headers={
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json",
},
json={
"model": "Grok-Imagine-Video-1.5-Fast",
"prompt": "Cinematic aerial shot of a snowy mountain sunrise, a sea of clouds drifting slowly, golden sunlight passing through the peaks, the camera pushing smoothly forward",
"metadata": {
"ratio": "16:9",
"resolution": "720p",
"duration": 10,
},
},
)
response.raise_for_status()
print(response.json())2.6.4 Fast multi-image reference to video
The Fast model accepts up to 7 reference images. Put all the images in metadata.content, and explain in the prompt how each one serves as a reference for subject, style or composition.
curl https://token.bytomdao.com/v1/video/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Grok-Imagine-Video-1.5-Fast",
"prompt": "Keep the character's appearance and clothing consistent with the reference image, as the character walks through a futuristic city under neon lights, with the camera moving smoothly from a wide shot to a close-up",
"metadata": {
"content": [
{
"type": "image_url",
"image_url": { "url": "https://example.com/character-front.jpg" },
"role": "reference_image"
},
{
"type": "image_url",
"image_url": { "url": "https://example.com/character-side.jpg" },
"role": "reference_image"
}
],
"ratio": "9:16",
"resolution": "720p",
"duration": 15
}
}'2.6.5 1.5 image-to-video
Grok-Imagine-Video-1.5 supports image-to-video only; you must pass one reference image in metadata.content. This model supports output up to 1080p.
curl https://token.bytomdao.com/v1/video/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Grok-Imagine-Video-1.5",
"prompt": "The camera pushes in slowly, the person blinks naturally and looks at the camera, hair swaying gently in the breeze, keeping the subject's appearance and background structure consistent",
"metadata": {
"content": [
{
"type": "image_url",
"image_url": {
"url": "https://example.com/reference.jpg"
},
"role": "first_frame"
}
],
"ratio": "16:9",
"resolution": "1080p",
"duration": 10
}
}'Python example:
import requests
response = requests.post(
"https://token.bytomdao.com/v1/video/generations",
headers={
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json",
},
json={
"model": "Grok-Imagine-Video-1.5",
"prompt": "The camera pushes in slowly, the person blinks naturally and looks at the camera, hair swaying gently in the breeze, keeping the subject's appearance and background structure consistent",
"metadata": {
"content": [
{
"type": "image_url",
"image_url": {"url": "https://example.com/reference.jpg"},
"role": "first_frame",
}
],
"ratio": "16:9",
"resolution": "1080p",
"duration": 10,
},
},
)
response.raise_for_status()
print(response.json())2.6.6 Query a task
Query the task using the task_id from the create-task response:
curl https://token.bytomdao.com/v1/video/generations/YOUR_TASK_ID \
-H "Authorization: Bearer YOUR_API_TOKEN"Task statuses can be queued, running, succeeded or failed. After a task succeeds, read the re-hosted video URL from data.result_url first. Query every 15–30 seconds and do not poll at high frequency.
import time
import requests
base_url = "https://token.bytomdao.com"
api_key = "YOUR_API_TOKEN"
task_id = "YOUR_TASK_ID"
while True:
response = requests.get(
f"{base_url}/v1/video/generations/{task_id}",
headers={"Authorization": f"Bearer {api_key}"},
)
response.raise_for_status()
result = response.json()
data = result.get("data", result)
status = str(data.get("status", "")).lower()
if status in ("success", "succeeded", "completed"):
print("video url:", data.get("result_url"))
break
if status in ("failure", "failed"):
print("failed reason:", data.get("fail_reason") or data.get("reason"))
break
print("current status:", status, "progress:", data.get("progress"))
time.sleep(30)2.7 MiniMax-H3 series
The MiniMax-H3 series is called through the unified video generation endpoint of the Token gateway. MiniMax-H3 supports text-to-video, first/last-frame control, and multimodal-reference generation combining images, videos and audio; MiniMax-H3-Max is the fast-generation version and supports only text-to-video and first/last-frame image-to-video.
Both models share the same endpoint and request structure, with durations of 5–15 seconds. They differ in available capabilities and resolutions; to switch, just change the model value.
| Capability | MiniMax-H3 | MiniMax-H3-Max |
|---|---|---|
| Text-to-video | Supported | Supported |
| Image-to-video (first / last frame) | Supported | Supported |
Multimodal reference to video (reference_image / reference_video / reference_audio) | Supported | Not supported |
| Resolution | 768p, 2K | 480p, 768p (2K not supported) |
| Duration | 5–15 seconds | 5–15 seconds |
Note:
MiniMax-H3-Maxdoes not accept anyreference_*assets. Requests that includereference_image,reference_videoorreference_audio, or that specify2Kresolution, will cause the task to fail.
2.7.1 Endpoints
Create a video task:
POST https://token.bytomdao.com/v1/video/generationsQuery task status and results:
GET https://token.bytomdao.com/v1/video/generations/{task_id}Video generation is asynchronous. After a task is created, save the id or task_id from the response, then use the query endpoint to get the task progress and the final video URL.
2.7.2 Request parameters
The Token gateway uses a unified video task format: the text prompt goes in the top-level prompt; reference assets, ratio, resolution and duration go in metadata.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | — | Model name. Available values: MiniMax-H3, MiniMax-H3-Max |
prompt | string | Yes | — | Description of video content, camera, action, sound and style; must not be empty |
metadata.content | array | No | — | Array of image, video and audio reference assets; see the format below. MiniMax-H3-Max supports only first/last-frame images |
metadata.resolution | string | Yes | — | Output resolution. MiniMax-H3: 768p or 2K; MiniMax-H3-Max: 480p or 768p, 2K not supported |
metadata.duration | integer | Yes | — | Output video duration (integer), 5–15 seconds |
metadata.ratio | string | Conditional | adaptive | Aspect ratio: adaptive, 21:9, 16:9, 4:3, 1:1, 3:4, 9:16. Required and must not be adaptive for text-to-video; always adaptive for image-to-video; optional for multimodal-reference-to-video (MiniMax-H3 only) |
Each element of metadata.content is distinguished by type, and role can mark its purpose:
| type | Example field | role | Description |
|---|---|---|---|
image_url | { "type": "image_url", "image_url": { "url": "https://..." }, "role": "first_frame" } | first_frame / last_frame / reference_image | First frame, last frame or reference image |
video_url | { "type": "video_url", "video_url": { "url": "https://..." }, "role": "reference_video" } | reference_video | Multimodal reference video |
audio_url | { "type": "audio_url", "audio_url": { "url": "https://..." }, "role": "reference_audio" } | reference_audio | Multimodal reference audio |
Supported generation scenarios:
- Text-to-video: omit
metadata.contentand use only the top-levelprompt. Both models support it. - First-frame image-to-video: pass 1
image_urlwithroleset tofirst_frameor omitted. Both models support it. - Last-frame image-to-video: pass 1
image_urlwithroleset tolast_frame. Both models support it. - First-and-last-frame image-to-video: pass 2
image_urlitems withroleset tofirst_frameandlast_framerespectively. Both models support it. - Multimodal-reference-to-video: combine
reference_image,reference_videoandreference_audioassets. Supported byMiniMax-H3only.
Mutually exclusive scenarios:
reference_image/reference_video/reference_audiocannot be mixed withfirst_frame/last_framein the same request.
Ratio rules:
ratiodefaults toadaptive; the actual output ratio can be read from theratiofield returned by the query endpoint.- Text-to-video must specify an explicit ratio and cannot use
adaptive; available values are21:9,16:9,4:3,1:1,3:4,9:16. - Image-to-video (including first-frame, last-frame and both) must use
ratio: "adaptive": the aspect ratio is determined by the input image. Do not pass custom ratios such as16:9or9:16, which may cause generation to fail. - Multimodal-reference-to-video may omit
ratio(defaultadaptive) or specify an explicit ratio:21:9,16:9,4:3,1:1,3:4,9:16. This scenario applies toMiniMax-H3only.
2.7.3 Input media limits
The total request body size must not exceed 64 MB. Use public URLs for larger media files; Base64 is not recommended.
Model differences:
MiniMax-H3-Maxdoes not support multimodal references, so it does not acceptreference_image,reference_videoorreference_audioassets. The image limits below apply to both models; the video and audio limits apply toMiniMax-H3only.
Image limits:
| Item | Limit |
|---|---|
| Format | JPG, JPEG, PNG, WEBP, HEIC, HEIF |
| Size per file | ≤ 30 MB |
| Width / height range | 256–5760 px |
| Aspect ratio (width / height) | 0.4–2.5 |
| Count | First frame ≤ 1, last frame ≤ 1, reference images ≤ 9 (reference images for MiniMax-H3 only) |
Video limits (MiniMax-H3 multimodal reference only):
| Item | Limit |
|---|---|
| Container / format | MP4, MOV |
| Codec | Video: H.264/AVC, H.265/HEVC; audio: AAC, MP3 |
| Size per file | ≤ 50 MB |
| Count | ≤ 3 |
| Duration | 2–15 s per clip, total ≤ 15 s |
| Width / height range | 256–5760 px |
| Aspect ratio (width / height) | 0.4–2.5 |
| Frame rate | 23.976–60 fps |
Audio limits (MiniMax-H3 multimodal reference only):
| Item | Limit |
|---|---|
| Format | WAV, MP3 |
| Size per file | ≤ 15 MB |
| Count | ≤ 3 |
| Duration | 2–15 s per clip, total ≤ 15 s |
2.7.4 Text-to-video (MiniMax-H3)
curl https://token.bytomdao.com/v1/video/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "MiniMax-H3",
"prompt": "An armored fighter jet in a Gundam color scheme flies across the morning city skyline, with the camera smoothly following, cinematic lighting, and finally transforms into a robot in mid-air and lands on top of a skyscraper",
"metadata": {
"ratio": "16:9",
"resolution": "768p",
"duration": 5
}
}'2.7.5 Image-to-video (first frame, MiniMax-H3)
Important: Image-to-video must pass
ratio: "adaptive"; custom ratios such as16:9or9:16are not allowed. The aspect ratio is determined by the input image, and using a custom ratio may cause generation to fail.
The ratio of image-to-video is determined by the input image, so set metadata.ratio to adaptive in the request.
curl https://token.bytomdao.com/v1/video/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "MiniMax-H3",
"prompt": "A first-person fruit tea ad, the camera pushing in naturally, keeping the product appearance consistent, fresh and bright commercial photography style",
"metadata": {
"content": [
{
"type": "image_url",
"image_url": {
"url": "https://ark-project.tos-cn-beijing.volces.com/doc_image/r2v_tea_pic1.jpg"
},
"role": "first_frame"
}
],
"ratio": "adaptive",
"resolution": "768p",
"duration": 5
}
}'2.7.6 Multimodal-reference-to-video (MiniMax-H3 only)
curl https://token.bytomdao.com/v1/video/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "MiniMax-H3",
"prompt": "Follow the camera rhythm of the reference video and use the reference audio as the sound style to generate a cinematic city short film",
"metadata": {
"content": [
{
"type": "video_url",
"video_url": {
"url": "https://example.com/reference.mp4"
},
"role": "reference_video"
},
{
"type": "audio_url",
"audio_url": {
"url": "https://example.com/reference.mp3"
},
"role": "reference_audio"
}
],
"ratio": "16:9",
"resolution": "768p",
"duration": 10
}
}'2.7.7 MiniMax-H3-Max examples
MiniMax-H3-Max supports only text-to-video and first/last-frame image-to-video, so the request must not contain any reference_* assets, and the resolution can only be 480p or 768p.
Text-to-video
curl https://token.bytomdao.com/v1/video/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "MiniMax-H3-Max",
"prompt": "An armored fighter jet in a Gundam color scheme flies across the morning city skyline, with the camera smoothly following, cinematic lighting, and finally transforms in mid-air and lands on top of a skyscraper, becoming a robot",
"metadata": {
"ratio": "16:9",
"resolution": "480p",
"duration": 10
}
}'Image-to-video (first frame)
curl https://token.bytomdao.com/v1/video/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "MiniMax-H3-Max",
"prompt": "The camera slowly circles the product on the table, light sliding across the side of the bottle, with a softly blurred background and a commercial ad look",
"metadata": {
"content": [
{
"type": "image_url",
"image_url": {
"url": "https://example.com/first_frame.jpg"
},
"role": "first_frame"
}
],
"ratio": "adaptive",
"resolution": "768p",
"duration": 5
}
}'Image-to-video follows the same ratio rule:
MiniMax-H3-Maximage-to-video must also passratio: "adaptive"and cannot specify custom ratios such as16:9or9:16.
2.7.8 Create-task response and query
On success, an asynchronous task ID is returned:
{
"id": "task_RGqb2iyUHFiXzhAISs0VSU5CXFKHRPuD",
"task_id": "task_RGqb2iyUHFiXzhAISs0VSU5CXFKHRPuD",
"object": "video",
"model": "MiniMax-H3",
"status": "queued",
"progress": 0,
"created_at": 1787555160
}Query the task using the task_id:
curl https://token.bytomdao.com/v1/video/generations/YOUR_TASK_ID \
-H "Authorization: Bearer YOUR_API_TOKEN"When the task succeeds, you can usually get the video URL from data.result_url, with data.data.content.video_url as a fallback field. On failure, read data.fail_reason or data.reason. Query every 15–30 seconds and do not poll at high frequency.
Part 3: Vision understanding models (VISION)
3.1 Supported models
| Model | Description | Highlights |
|---|---|---|
| Qwen3-VL-Plus | Qwen flagship vision-understanding model | Complex visual reasoning, multi-image / video understanding, visual agents, visual coding, spatial perception |
| Qwen3-VL-Flash | Qwen lightweight vision-understanding model | Fast responses; suits batch recognition, long video / long document parsing, 2D / 3D grounding |
Upstream Model ID: In the Alibaba Model Studio docs the model names are usually
qwen3-vl-plus,qwen3-vl-flashand their snapshot versions; on the Token route, just use the model names in the table above.
3.2 Endpoint
Vision understanding models use the Chat Completions endpoint:
POST https://token.bytomdao.com/v1/chat/completionsThe difference is that messages.content is a multimodal array that can contain text, images and video.
3.3 Request parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | — | Model name, such as Qwen3-VL-Plus, Qwen3-VL-Flash |
messages | array | Yes | — | Conversation messages; content may mix text, image_url and video_url |
temperature | number | No | 1.0 | Sampling randomness; lower values make the output more deterministic (0–2) |
max_tokens | integer | No | Model default | Maximum number of output tokens |
top_p | number | No | 1.0 | Nucleus sampling probability; adjust either this or temperature, not both |
stream | boolean | No | false | Whether to enable streaming output |
Multimodal input in messages:
{
"role": "user",
"content": [
{ "type": "text", "text": "Please summarize the key points of this image and this video" },
{ "type": "image_url", "image_url": { "url": "https://example.com/image.jpg" } },
{ "type": "video_url", "video_url": { "url": ["https://example.com/video.mp4"] } }
]
}Supported input formats:
- URL:
{ "type": "image_url", "image_url": { "url": "https://..." } } - Base64:
{ "type": "image_url", "image_url": { "url": "data:image/jpeg;base64,..." } } - Multiple images: pass several
image_urlobjects in thecontentarray - Video input:
{ "type": "video_url", "video_url": { "url": ["https://...mp4"] } }, used for video description, subtitle summarization, timeline analysis, etc.
Input size reference: The Qwen3-VL series suits multi-image and multi-video understanding. The official OpenAI-compatible docs support image URL/Base64 and video URL input; the actual number of uploads, pixels per image, video duration and file size depend on the model specs of the current route. Long videos or high-resolution images significantly increase input tokens.
3.4 Examples
Single-image understanding
curl https://token.bytomdao.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Qwen3-VL-Plus",
"messages": [
{
"role": "user",
"content": [
{ "type": "text", "text": "Please describe the content of this image" },
{ "type": "image_url", "image_url": { "url": "https://example.com/photo.jpg" } }
]
}
]
}'from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_TOKEN",
base_url="https://token.bytomdao.com/v1"
)
response = client.chat.completions.create(
model="Qwen3-VL-Plus",
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "Please describe the content of this image"},
{"type": "image_url", "image_url": {"url": "https://example.com/photo.jpg"}}
]
}
]
)
print(response.choices[0].message.content)Base64 image input
import base64
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_TOKEN",
base_url="https://token.bytomdao.com/v1"
)
# Read a local image and encode it as Base64
with open("local_image.jpg", "rb") as f:
image_base64 = base64.b64encode(f.read()).decode("utf-8")
response = client.chat.completions.create(
model="Qwen3-VL-Plus",
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "What is in this image?"},
{
"type": "image_url",
"image_url": {"url": f"data:image/jpeg;base64,{image_base64}"}
}
]
}
]
)
print(response.choices[0].message.content)Multi-image comparison
response = client.chat.completions.create(
model="Qwen3-VL-Plus",
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "Please compare the differences between these two images"},
{"type": "image_url", "image_url": {"url": "https://example.com/image1.jpg"}},
{"type": "image_url", "image_url": {"url": "https://example.com/image2.jpg"}}
]
}
]
)
print(response.choices[0].message.content)Video understanding
response = client.chat.completions.create(
model="Qwen3-VL-Flash",
messages=[
{
"role": "user",
"content": [
{
"type": "text",
"text": "Please summarize the video in chronological order and list the visible text and key frames."
},
{
"type": "video_url",
"video_url": {"url": ["https://example.com/video.mp4"]}
}
]
}
],
stream=True
)
for chunk in response:
delta = chunk.choices[0].delta
if delta.content:
print(delta.content, end="")Part 4: Audio models (AUDIO)
4.1 Supported models
| Model | Description | Highlights |
|---|---|---|
| Qwen3.5-Omni-Plus | Qwen omni-modal premium version | Long audio/video understanding, meeting minutes, subtitle generation, content moderation, audio/video interactive assistants |
| Qwen3.5-Omni-Flash | Qwen omni-modal ultra-fast version | Better cost and latency; suits voice assistants, batch audio understanding, real-time interaction |
| Scribe_V2 | ElevenLabs Scribe v2 speech transcription model | Audio/video transcription, language identification, word-level timestamps and speaker diarization; billed by audio duration |
Upstream Model ID: In the Alibaba Model Studio docs the model names are usually
qwen3.5-omni-plusandqwen3.5-omni-flash. Qwen3.5-Omni accepts combined text, image, audio and video input, and can output text or text + audio.
4.2 Endpoint
The Qwen3.5-Omni series is called through the OpenAI-compatible Chat Completions endpoint. For speech output, you must use a streaming response to collect the audio chunks.
POST https://token.bytomdao.com/v1/chat/completions4.3 Request parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | — | Model name, such as Qwen3.5-Omni-Plus, Qwen3.5-Omni-Flash |
messages | array | Yes | — | Conversation messages; supports multimodal input such as text, images, audio and video |
modalities | array | No | ["text"] | Output modalities: ["text"] for text only, ["text", "audio"] for text + speech |
audio | object | No | — | Audio output configuration; required when modalities includes audio, with voice and format |
temperature | number | No | 1.0 | Sampling randomness (0–2) |
max_tokens | integer | No | Model default | Maximum number of output tokens |
stream | boolean | Yes for speech output | false | Must be set to true for Qwen3.5-Omni speech output |
stream_options | object | No | — | Streaming statistics options, such as { "include_usage": true } |
Audio input in messages (Base64):
{
"role": "user",
"content": [
{ "type": "text", "text": "What does this audio say?" },
{ "type": "input_audio", "input_audio": { "data": "<base64 encoded audio>", "format": "wav" } }
]
}| Field | Description |
|---|---|
type | Fixed to input_audio |
input_audio.data | Base64-encoded audio data |
input_audio.format | Audio format, such as wav or mp3 |
Audio output configuration:
| Field | Description |
|---|---|
audio.voice | Output voice. The Alibaba Model Studio examples use Tina; the number of available voices differs by model, so refer to the model list |
audio.format | Output audio format, such as wav; the returned content is Base64-encoded PCM/WAV data chunks |
Recommendation: For audio/video understanding, meeting minutes, subtitle generation and similar scenarios,
modalities=["text"]is enough. For voice assistants, read-aloud and human-like conversation, usemodalities=["text", "audio"]and concatenatedelta.audio.datain the streaming response.
4.4 Examples
Audio input, text output
curl https://token.bytomdao.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Qwen3.5-Omni-Plus",
"messages": [
{
"role": "user",
"content": [
{ "type": "text", "text": "Please restate the content of this audio" },
{ "type": "input_audio", "input_audio": { "data": "<base64_encoded_audio>", "format": "wav" } }
]
}
]
}'import base64
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_TOKEN",
base_url="https://token.bytomdao.com/v1"
)
with open("meeting.wav", "rb") as f:
audio_base64 = base64.b64encode(f.read()).decode("utf-8")
response = client.chat.completions.create(
model="Qwen3.5-Omni-Plus",
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "Please extract the action items from this meeting recording"},
{
"type": "input_audio",
"input_audio": {
"data": audio_base64,
"format": "wav"
}
}
]
}
]
)
print(response.choices[0].message.content)Text input, streaming text + speech output
import base64
import wave
stream = client.chat.completions.create(
model="Qwen3.5-Omni-Plus",
messages=[
{"role": "user", "content": "Please introduce the BytomDAO model platform in a gentle, natural tone."}
],
modalities=["text", "audio"],
audio={"voice": "Tina", "format": "wav"},
stream=True,
stream_options={"include_usage": True}
)
audio_base64 = ""
for chunk in stream:
if not chunk.choices:
continue
delta = chunk.choices[0].delta
if delta.content:
print(delta.content, end="")
if getattr(delta, "audio", None) and delta.audio.get("data"):
audio_base64 += delta.audio["data"]
if audio_base64:
pcm_bytes = base64.b64decode(audio_base64)
with wave.open("omni_reply.wav", "wb") as wf:
wf.setnchannels(1)
wf.setsampwidth(2)
wf.setframerate(24000)
wf.writeframes(pcm_bytes)Audio/video content analysis prompt example
Please analyze this video and output:
1. A description of visuals and sound organized by timestamp
2. Visible text and when it appears
3. Speech transcription, speakers, tone and emotion
4. Finally, give 5 summary points and 3 action itemsAudio billing: In addition to text tokens, audio models bill audio input/output tokens. Speech output incurs extra audio completion charges.
Pure TTS: If you only need text-to-speech, prefer Qwen3.5-Omni with
modalities=["text", "audio"]. If the platform later opens a dedicated/v1/audio/speechroute, refer to the model list and the endpoint response.
4.5 Scribe_V2 speech transcription
Scribe_V2 is the platform's proxy for ElevenLabs Scribe v2 and uses an OpenAI Audio Transcriptions-compatible endpoint. It converts audio or video files into structured text with language identification, word-level timestamps and optional speaker information. Unlike Qwen3.5-Omni's Chat Completions audio input, Scribe_V2 requires uploading a single file via multipart/form-data and returns the result synchronously.
Endpoint and authentication
POST https://token.bytomdao.com/v1/audio/transcriptionsRequests use your platform user key:
Authorization: Bearer YOUR_API_TOKENRequest parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
file | File | Yes | — | The single audio or video file to transcribe; only one file can be uploaded per request |
model | string | Yes | — | Fixed to Scribe_V2 (the proxy maps it to ElevenLabs' scribe_v2) |
language | string | No | Auto-detect | Language code, such as zh, en, ja; mapped to language_code |
language_code | string | No | — | Native ElevenLabs language parameter; use either this or language. If both are passed, this field takes precedence |
diarize | boolean | No | — | Whether to enable speaker diarization; when enabled, words may include speaker_id |
num_speakers | integer | No | — | Expected number of speakers, to assist speaker identification |
timestamps_granularity | string | No | — | Timestamp granularity; valid values are validated by the upstream |
tag_audio_events | boolean | No | — | Whether to tag non-speech events such as laughter and applause |
diarization_threshold | number | No | — | Speaker diarization threshold; the range is validated by the upstream |
file_format | string | No | — | Explicitly specify the input format; usually unnecessary for regular MP3/WAV |
temperature | number | No | — | Sampling temperature; the range is validated by the upstream |
seed | integer | No | — | Random seed, to improve reproducibility for the same input |
no_verbatim | boolean | No | — | Whether to enable non-verbatim transcription mode |
use_speaker_library | boolean | No | — | Whether to use the ElevenLabs Speaker Library to help identify known speakers |
response_format | string | No | json | Accepted for OpenAI client compatibility; successful responses always keep the ElevenLabs JSON structure |
In the multipart form, booleans and numbers are sent as text, for example -F 'diarize=true' and -F 'num_speakers=2'. Unknown fields other than those listed here return 400 invalid_request.
Examples
cURL
curl -X POST https://token.bytomdao.com/v1/audio/transcriptions \\
-H "Authorization: Bearer YOUR_API_TOKEN" \\
-F "file=@./meeting.mp3" \\
-F "model=Scribe_V2" \\
-F "language=zh" \\
-F "diarize=true" \\
-F "num_speakers=2" \\
-F "timestamps_granularity=word" \\
-F "tag_audio_events=true"Do not set Content-Type manually; let cURL generate the multipart/form-data header with its boundary.
Python (requests)
import requests
url = "https://token.bytomdao.com/v1/audio/transcriptions"
headers = {"Authorization": "Bearer YOUR_API_TOKEN"}
with open("meeting.mp3", "rb") as audio:
response = requests.post(
url,
headers=headers,
files={"file": ("meeting.mp3", audio, "audio/mpeg")},
data={
"model": "Scribe_V2",
"language": "zh",
"diarize": "true",
"num_speakers": "2",
},
timeout=1800,
)
response.raise_for_status()
result = response.json()
print(result["text"])Successful response
The endpoint returns the complete ElevenLabs Scribe v2 JSON, not the simplified OpenAI response that contains only text:
{
"language_code": "zho",
"language_probability": 1.0,
"text": "What are you doing?",
"words": [
{
"text": "What",
"start": 0.28,
"end": 0.34,
"type": "word",
"speaker_id": "speaker_0",
"logprob": -0.00001
}
],
"transcription_id": "xxxxxxxx",
"audio_duration_secs": 1.72
}Common fields include: text (full transcript), language_code (detected language), language_probability (language confidence), words (word / event details), speaker_id (returned when diarization is enabled), transcription_id (task ID) and audio_duration_secs (detected audio duration). Actual fields may vary with the upstream version and request parameters.
Current limits and error handling
- Only single-file, synchronous transcription is supported;
webhook,webhook_id,webhook_metadata,source_url,cloud_storage_urlandadditional_formatsare not supported. entity_detection,use_multi_channelandmultichannel_output_styleare currently disabled; other unknown fields are also rejected.- When uploading large files, set the client timeout to 30 minutes or more.
- Common status codes:
400(invalid parameters or multipart format),401(invalid key),403(permission / channel denied),413(request body too large),429(rate or quota limited),502(upstream connection failed). When troubleshooting, keep thex-oneapi-request-idfrom the response headers.
Billing
Billed by the audio duration parsed from the uploaded file:
Billed seconds = audio seconds rounded up
Audio tokens = round(billed seconds / 60 × 1000)
Cost = audio tokens × Scribe_V2 unit price / 1,000,000For example, 1.72 seconds of audio is billed as 2 seconds, producing about 33 audio tokens. The final charge depends on the model unit price, your group multiplier and the actual deduction.
Part 5: Embedding models (EMBEDDING)
5.1 Supported models
| Model | Description | Highlights |
|---|---|---|
| Text-Embedding-V4 | Tongyi Lab multilingual text embedding model | Trained on Qwen3; suits semantic search, RAG, clustering and classification; supports custom dimensions |
| Qwen3-VL-Embedding | Qwen multimodal embedding model | Independent and fused vectors for text, images and video; suits cross-modal retrieval |
Upstream Model ID: The Alibaba Model Studio text embedding model is
text-embedding-v4; the multimodal embedding model is usuallyqwen3-vl-embedding. Whether the Token route exposes the multimodal embedding model depends on the model list and the endpoint response.
5.2 Endpoint
Text embeddings use the OpenAI Embeddings-compatible endpoint:
POST https://token.bytomdao.com/v1/embeddingsIn the official Alibaba Model Studio docs, multimodal embeddings use the DashScope multimodal embedding endpoint. If the Token route does not provide a compatible endpoint, first confirm on your side whether it is mapped to /v1/embeddings or to a separate route.
5.3 Request parameters
Text embedding parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | — | Model name, such as Text-Embedding-V4 |
input | string / array | Yes | — | Input text; a single string or a batch array |
encoding_format | string | No | float | Encoding format: float (float array) or base64 (Base64-encoded) |
dimensions | integer | No | Model default | Vector dimensions; Text-Embedding-V4 supports custom dimensions (commonly 512, 1024, 1536, 2048) |
Multimodal embedding parameters (if enabled)
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | — | Model name, such as Qwen3-VL-Embedding |
input | array | Yes | — | Array of multimodal content, which may include { "text": "..." }, { "image": "https://..." }, { "video": "https://..." } |
enable_fusion | boolean | No | false | Whether to generate a fused vector. When true, the multimodal content is fused into a single vector |
dimensions / dimension | integer | No | Model default | Output vector dimensions. Valid values depend on the current model specs |
5.4 Examples
Embedding a single text
curl example
curl https://token.bytomdao.com/v1/embeddings \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Text-Embedding-V4",
"input": "Artificial intelligence is changing the world"
}'from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_TOKEN",
base_url="https://token.bytomdao.com/v1"
)
response = client.embeddings.create(
model="Text-Embedding-V4",
input="Artificial intelligence is changing the world"
)
print(f"Vector dimensions: {len(response.data[0].embedding)}")
print(f"First 5 values: {response.data[0].embedding[:5]}")Batch texts + custom dimensions
curl example
curl https://token.bytomdao.com/v1/embeddings \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Text-Embedding-V4",
"input": [
"Artificial intelligence is changing the world",
"Large language models are an important breakthrough in AI",
"Vector databases are used to store and retrieve embedding vectors"
],
"dimensions": 512
}'Python example
response = client.embeddings.create(
model="Text-Embedding-V4",
input=[
"Artificial intelligence is changing the world",
"Large language models are an important breakthrough in AI",
"Vector databases are used to store and retrieve embedding vectors"
],
dimensions=512 # Custom vector dimensions (64–2048)
)
for i, item in enumerate(response.data):
print(f"Text {i}: vector dimensions {len(item.embedding)}")Multimodal fused embedding (if the route is enabled)
Suited to text-to-image search, image-to-image search, text-to-video search, cross-modal recall and similar scenarios. The example below shows the recommended request body structure; the actual endpoint path and parameter naming follow the platform's mapping.
curl https://token.bytomdao.com/v1/embeddings \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Qwen3-VL-Embedding",
"input": [
{ "text": "White sneakers, lightweight and breathable, suitable for running" },
{ "image": "https://example.com/shoes.jpg" }
],
"enable_fusion": true,
"dimensions": 1024
}'response = client.embeddings.create(
model="Qwen3-VL-Embedding",
input=[
{"text": "White sneakers, lightweight and breathable, suitable for running"},
{"image": "https://example.com/shoes.jpg"}
],
extra_body={
"enable_fusion": True,
"dimensions": 1024
}
)
print(len(response.data[0].embedding))Computing text similarity
import numpy as np
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_TOKEN",
base_url="https://token.bytomdao.com/v1"
)
texts = ["The weather is really nice today", "It is sunny today", "The stock market fell sharply today"]
response = client.embeddings.create(
model="Text-Embedding-V4",
input=texts
)
embeddings = [item.embedding for item in response.data]
# Compute cosine similarity
def cosine_similarity(a, b):
return np.dot(a, b) / (np.linalg.norm(a) * np.linalg.norm(b))
print(f"'good weather' vs 'sunny': {cosine_similarity(embeddings[0], embeddings[1]):.4f}")
print(f"'good weather' vs 'stock': {cosine_similarity(embeddings[0], embeddings[2]):.4f}")Part 6: Code models (CODE)
6.1 Supported models
| Model | Description | Highlights |
|---|---|---|
| Qwen3-Coder-Plus | Qwen flagship code model | Complex programming and code review; very long context supported |
| Qwen3-Coder-Flash | Qwen lightweight code model | Multi-turn tool interaction, repository-level understanding, fast |
| Doubao-Seed-2.0-Code | Doubao programming-specific model | Optimized for front-end work; supports Skills and IDE tool calling |
6.2 Endpoint
Code models use the Chat Completions endpoint:
POST https://token.bytomdao.com/v1/chat/completionsCode models are especially good at tool calling (Function Calling) and multi-turn interaction, making them suitable for integration into IDEs and coding assistants.
6.3 Request parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | — | Model name, such as Qwen3-Coder-Plus, Doubao-Seed-2.0-Code |
messages | array | Yes | — | Conversation messages |
temperature | number | No | 1.0 | Sampling randomness; 0–0.3 is recommended for programming tasks (lower is more deterministic) |
max_tokens | integer | No | Model default | Maximum number of output tokens |
top_p | number | No | 1.0 | Nucleus sampling probability |
tools | array | No | — | List of tool definitions (Function Calling) describing external functions the model can call |
tool_choice | string | No | auto | Tool selection strategy: auto (model decides), none (no tools), required (a tool must be used) |
stream | boolean | No | false | Whether to enable streaming output |
6.4 Examples
Code generation
curl example
curl https://token.bytomdao.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Qwen3-Coder-Plus",
"messages": [
{ "role": "system", "content": "You are a professional Python developer" },
{ "role": "user", "content": "Write an implementation of the quicksort algorithm and add type annotations" }
],
"temperature": 0.1
}'Python example
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_TOKEN",
base_url="https://token.bytomdao.com/v1"
)
response = client.chat.completions.create(
model="Qwen3-Coder-Plus",
messages=[
{"role": "system", "content": "You are a professional Python developer"},
{"role": "user", "content": "Write an implementation of the quicksort algorithm and add type annotations"}
],
temperature=0.1
)
print(response.choices[0].message.content)With tool calling (Function Calling)
curl example
curl https://token.bytomdao.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Qwen3-Coder-Plus",
"messages": [
{ "role": "user", "content": "Calculate the sum of the first 20 terms of the Fibonacci sequence" }
],
"tools": [
{
"type": "function",
"function": {
"name": "run_code",
"description": "Execute Python code and return the result",
"parameters": {
"type": "object",
"properties": {
"code": {
"type": "string",
"description": "The Python code to execute"
}
},
"required": ["code"]
}
}
}
],
"tool_choice": "auto"
}'Python example
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_TOKEN",
base_url="https://token.bytomdao.com/v1"
)
tools = [
{
"type": "function",
"function": {
"name": "run_code",
"description": "Execute Python code and return the result",
"parameters": {
"type": "object",
"properties": {
"code": {
"type": "string",
"description": "The Python code to execute"
}
},
"required": ["code"]
}
}
}
]
response = client.chat.completions.create(
model="Qwen3-Coder-Plus",
messages=[
{"role": "user", "content": "Calculate the sum of the first 20 terms of the Fibonacci sequence"}
],
tools=tools,
tool_choice="auto"
)
print(response.choices[0].message.tool_calls)Part 7: Math models (MATH)
7.1 Supported models
| Model | Description | Highlights |
|---|---|---|
| Qwen-Math-Plus | Qwen flagship math model | Complex math problem solving: equations, calculation, proofs |
| Qwen-Math-Turbo | Qwen fast math model | Fast reasoning at low cost |
7.2 Endpoint
Math models use the Chat Completions endpoint:
POST https://token.bytomdao.com/v1/chat/completions7.3 Request parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | — | Model name, such as Qwen-Math-Plus, Qwen-Math-Turbo |
messages | array | Yes | — | Conversation messages |
temperature | number | No | 1.0 | Sampling randomness |
max_tokens | integer | No | Model default | Maximum number of output tokens |
top_p | number | No | 1.0 | Nucleus sampling probability |
stream | boolean | No | false | Whether to enable streaming output |
7.4 Examples
curl
curl https://token.bytomdao.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"model": "Qwen-Math-Plus",
"messages": [
{
"role": "user",
"content": "Solve the equation x² - 5x + 6 = 0 and give a detailed step-by-step solution"
}
]
}'Python
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_TOKEN",
base_url="https://token.bytomdao.com/v1"
)
response = client.chat.completions.create(
model="Qwen-Math-Plus",
messages=[
{
"role": "user",
"content": "Solve the equation x² - 5x + 6 = 0 and give a detailed step-by-step solution"
}
]
)
print(response.choices[0].message.content)Part 8: LLM text models (TEXT)
For the basics of using LLMs, see Section 6 of the LLM API tutorial.
Part 9: General notes
9.1 Authentication
All endpoints use Bearer Token authentication:
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json9.2 Recommended SDK configuration
BytomDAO endpoints are compatible with the OpenAI specification. We recommend the official OpenAI SDK; just override base_url:
Python
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_TOKEN",
base_url="https://token.bytomdao.com/v1"
)9.3 Endpoint summary
| Model type | Path | Applicable models |
|---|---|---|
| TEXT / CODE / MATH | /v1/chat/completions | Text, code and math reasoning |
| VISION | /v1/chat/completions | Qwen3-VL image/video understanding; multimodal input goes through messages.content (see §3) |
| AUDIO (Qwen3.5-Omni) | /v1/chat/completions | Qwen3.5-Omni audio/video understanding, streaming text + speech output (see §4.1–§4.4) |
| AUDIO (Scribe_V2) | /v1/audio/transcriptions | ElevenLabs Scribe v2 single-file synchronous transcription, language identification, word-level timestamps and speaker diarization, uploaded via multipart/form-data (see §4.5) |
| IMAGE (GPT-Image-2.5) | /v1/images/generations | Latest GPT-Image-2.5 series; supports custom 1K–4K resolution and quality enum; text-to-image and image-to-image share one endpoint, image input goes through the image field, and an image URL is returned by default (see §1.3) |
| IMAGE (GPT-Image-2 text-to-image) | /v1/images/generations | GPT-Image-2 stable channel; custom resolution (up to 4K) and quality enum; returns b64_json only, URL not supported (see §1.4) |
| IMAGE (GPT-Image-2 image-to-image / edit) | /v1/images/edits | GPT-Image-2 stable-channel image editing; images must be uploaded as files via multipart/form-data (see §1.4) |
| IMAGE (GPT-Image-2-4K) | /v1/images/generations | GPT-Image-2-4K high-resolution version; custom 1–4K resolution, quality enum, base64 and URL responses (see §1.5) |
| IMAGE (GPT-Image-2-Spot) | /v1/images/generations | GPT-Image-2-Spot off-peak version; 1.5K resolution only, no custom resolution or quality parameter, base64 and URL responses (see §1.6) |
| IMAGE (GPT-Image-2-Flash) | /v1/images/generations | GPT-Image-2-Flash simplified version; 1K only, URL response only (see §1.7) |
| IMAGE (Nano-Banana original, text-to-image) | /v1/images/generations | Nano-Banana / Nano-Banana-Pro / Nano-Banana-2 text-to-image; Nano-Banana-2.1 also uses this endpoint and supports optional image input (see §1.8.1–§1.8.4) |
| IMAGE (Nano-Banana original, image-to-image / edit) | /v1/images/edits | Nano-Banana / Nano-Banana-Pro / Nano-Banana-2 image editing, multi-image fusion, Base64 input and mask-based local editing (see §1.8.1–§1.8.3) |
| IMAGE (Nano-Banana-2-Lite) | /v1/chat/completions | Nano-Banana-2-Lite Chat-mode text-to-image, image-to-image and multi-turn local edits; billed per token, Base64 output (see §1.8.5) |
| IMAGE (Nano-Banana Spot) | /v1/images/generations | Nano-Banana Spot series text-to-image, image-to-image and multi-image fusion; image input goes through the image field (see §1.9.1–§1.9.3) |
| IMAGE (Qwen text-to-image) | /v1/images/generations | Qwen-Image-2.0 / 2.0-Pro text-to-image (see §1.10.1–§1.10.2) |
| IMAGE (Qwen image-to-image / edit) | /v1/images/edits | Qwen-Image-2.0 / 2.0-Pro multi-image editing and text-rendering edits (see §1.10.1–§1.10.2) |
| IMAGE (Wan2.7 text-to-image) | /v1/images/generations | Wan2.7 / Wan2.7-pro text-to-image and image-set generation (see §1.11.1–§1.11.2) |
| IMAGE (Wan2.7 image-to-image / edit) | /v1/images/edits | Wan2.7 / Wan2.7-pro multi-image reference and subject-consistent editing (see §1.11.1–§1.11.2) |
| IMAGE (Doubao-Seedream) | /v1/images/generations | Doubao-Seedream-4.0 / 4.5 / 5.0-pro / 5.0-lite text-to-image, image-to-image and multi-image fusion (see §1.12.1–§1.12.4) |
| VIDEO (Seedance) | /v1/video/generations | Seedance-2.0 / Seedance-2.0-Fast / Seedance-2.0-Mini video generation, image-to-video, multimodal reference, video editing and extension (see §2.2) |
| VIDEO (Google series, JSON) | /v1/video/generations | Omni-Flash / Veo-3.1 text-to-video, public image input and task query; Veo-3.1 supports mode=frame first/last-frame control (see §2.3) |
| VIDEO (Google series, file upload) | /v1/video/generations | Omni-Flash multi-image reference and video editing, plus Veo-3.1 local first/last-frame image upload, using multipart/form-data with repeated input_reference (see §2.3) |
| VIDEO (Kling-3.0-Turbo) | /v1/video/generations | Kling-3.0-Turbo text-to-video, first-frame image-to-video, multi-shot generation and task query (see §2.5) |
| VIDEO (Grok Imagine Video 1.5) | /v1/video/generations | Grok-Imagine-Video-1.5-Fast text-to-video / multi-image reference, and Grok-Imagine-Video-1.5 single-image generation, up to 1080p, plus task query (see §2.6) |
| EMBEDDING | /v1/embeddings | Text-Embedding-V4 text embeddings; multimodal embeddings follow the platform's mapping (see §5) |
9.4 Billing
- Basic billing: (input tokens ÷ 1,000,000) × input unit price + (output tokens ÷ 1,000,000) × output unit price
- Image models: some models are billed at a fixed price (e.g. GPT-Image-2-Spot is billed per image), others proportionally
- Video models: tiered billing with pre-authorization plus settlement refund; a pre-charge is made when the task is created, and after it ends the difference is charged or refunded based on actual usage
- Audio models: besides text tokens, audio input/output has its own billing multiplier
- Spot models: off-peak resources, cheaper but stability may fluctuate
- Limited-time free models: free to use during promotional periods
Check the Model Marketplace for detailed pricing.