DOCS

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

ModelDescriptionHighlights
GPT-Image-2.5Latest image model in the GPT-Image-2 seriesCustom 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-2Latest 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-4K4K high-resolution model in the GPT-Image-2 seriesCustom resolutions from 1K to 4K, quality enum (auto/low/medium/high), supports base64 and URL responses
GPT-Image-2-SpotLatest 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-FlashLatest OpenAI image model (simplified edition)1K resolution and URL responses only, lower price
Nano-BananaGemini 2.5 Flash ImageFast, strong editing ability, great value
Nano-Banana-2Efficient Gemini visual generationFast interactive responses, high-concurrency image output
Nano-Banana-2.1Next-generation Nano-Banana image model1k / 2k / 4k quality tiers, URL/Base64 image input and URL/Base64 output
Nano-Banana-2-LiteGemini 3.1 Flash Lite ImageUltra-low-latency chat mode, multi-turn local edits, interleaved generation
Nano-Banana-ProGemini 3 Pro ImageComplex multi-turn image generation and editing with reasoning ability
Nano-Banana-SpotNano-Banana off-peak capacityCheap; stability may fluctuate
Nano-Banana-2-SpotNano-Banana-2 off-peak capacityCheap, great value
Nano-Banana-Pro-SpotNano-Banana-Pro off-peak capacityCheap, high quality
Qwen-Image-2.0Qwen text-to-imageOutstanding Chinese text rendering, strong Asian portraits
Qwen-Image-2.0-ProQwen text-to-image, professional editionEnhanced Chinese text rendering
Doubao-Seedream-4.0Doubao image creationMulti-image fusion, image-set generation, subject consistency
Doubao-Seedream-4.5Doubao image creation, upgradedPortrait retouching, improved image aesthetics
Doubao-Seedream-5.0-proDoubao image creation, professional editionHigh-quality creation; supports 1K, 1.5K, 2K
Doubao-Seedream-5.0-liteLatest Doubao image creationWeb retrieval, precise parsing of complex instructions
Wan2.7Wan 2.7 image generation and editingMulti-image reference, subject consistency
Wan2.7-proWan 2.7 flagship editionBetter 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.

text
POST https://token.bytomdao.com/v1/images/generations
POST https://token.bytomdao.com/v1/images/edits

Note: 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, passing image in the same request body. GPT-Image-2 supports both /v1/images/generations and /v1/images/edits: the generations endpoint accepts reference images through the images array 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 usage field 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)

ParameterTypeRequiredDefaultDescription
modelstringYes—Model name, fixed to GPT-Image-2.5
promptstringYes—Text description of the desired image, up to 5000 characters
sizestringNoautoImage size; custom pixel resolutions are supported (see below)
qualitystringNoautoImage quality: auto, low, medium, high
imagearray[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):

Ratio1K2K4K
1:11024x10242048x20482880x2880
2:3816x12321360x20482352x3520
3:21232x8162048x13603520x2352
3:4880x11841552x20802336x3120
4:31184x8802080x15523120x2336
16:91360x7682048x11523536x1984
9:16768x13601152x20481984x3536
auto———

Note: In the table above, auto means 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

bash
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

python
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

bash
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

python
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

bash
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

python
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

bash
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

python
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:

json
{
  "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
    }
  }
}
FieldTypeDescription
createdintegerUnix timestamp of when the response was created
dataarrayArray of generated results
data[].urlstringURL of the generated image (returned by default)
data[].revised_promptstringThe prompt actually used by the model, which may be a rewrite of your input
data[].widthintegerWidth of the generated image (pixels)
data[].heightintegerHeight of the generated image (pixels)
usageobjectToken consumption of this request
usage.input_tokensintegerTotal input tokens
usage.output_tokensintegerTotal output tokens
usage.total_tokensintegerTotal input and output tokens
usage.input_tokens_detailsobjectInput breakdown: text_tokens, image_tokens, cached_tokens
usage.output_tokens_detailsobjectOutput 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 through images; for local editing you can also pass extends.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:

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

ParameterTypeRequiredDefaultDescription
modelstringYes—Model name, fixed to GPT-Image-2
promptstringYes—Prompt for image generation or editing; length must be between 1 and 32000
imagesstring<url>[]No—Array of reference images, up to 10. When provided, you can perform image editing, style transfer or multi-image fusion
extends.edit.maskstring<url>No—URL of the local-edit mask; transparent areas are regenerated. Only used together with images
qualityenum<string>NomediumImage quality: high, low or medium
sizeenum<string>NoautoOutput size: 1024x1024, 1024x1536, 1536x1024, 2048x1152, 2048x2048, 2160x3840, 3840x2160 or auto

Note: images is an array that accepts up to 10 image URLs. Even though the endpoint is called generations, passing images lets you perform image editing or image-to-image. For inpainting, also pass extends.edit.mask.

/images/generations examples

Text-to-image

curl example

bash
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

python
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

bash
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

bash
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

bash
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

bash
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

bash
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/edits when 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:

json
{
  "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
  }
}
FieldTypeDescription
createdintegerUnix timestamp of when the response was created
dataarrayArray of generated or edited results
data[].urlstringURL of the generated image
usage.input_tokensintegerTotal input tokens
usage.input_tokens_details.image_tokensintegerInput image tokens
usage.input_tokens_details.text_tokensintegerInput text tokens
usage.output_tokensintegerTotal output tokens
usage.output_tokens_details.image_tokensintegerOutput image tokens
usage.output_tokens_details.text_tokensintegerOutput text tokens
usage.total_tokensintegerTotal 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)

ParameterTypeRequiredDefaultDescription
modelstringYes—Model name, fixed to GPT-Image-2-4K
promptstringYes—Text description of the image, up to 5000 characters
sizestringNoautoImage size; custom pixel resolutions are supported (see below)
qualitystringNoautoImage quality: auto, low, medium, high
response_formatstringNourlResponse format: url (temporary link) or base64 (Base64-encoded data)
imagestring / arrayNo—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):

Ratio1K2K4K
1:11024x10242048x20482880x2880
2:3816x12321360x20482352x3520
3:21232x8162048x13603520x2352
3:4880x11841552x20802336x3120
4:31184x8802080x15523120x2336
16:91360x7682048x11523536x1984
9:16768x13601152x20481984x3536
auto———

Note: In the table above, auto means 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

bash
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

python
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

bash
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

python
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

bash
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

python
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

bash
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

python
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

bash
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

python
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"):

json
{
  "created": 1589478378,
  "data": [
    { "url": "https://..." }
  ]
}

Base64 response (response_format: "base64"):

json
{
  "created": 1589478378,
  "data": [
    { "b64_json": "iVBORw0KGgo..." }
  ]
}
FieldTypeDescription
createdintegerUnix timestamp of when the response was created
dataarrayArray 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

ParameterTypeRequiredDefaultDescription
modelstringYes—Model name, fixed to GPT-Image-2-Spot
promptstringYes—Text description of the image, up to 5000 characters
sizestringNoautoImage size; only the fixed 1.5K resolutions are supported (see below)
response_formatstringNourlResponse format: url (temporary link) or base64 (Base64-encoded data)
imagestring / arrayNo—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:

RatioResolution
1:11254x1254
2:31024x1536
3:21536x1024
3:41086x1448
4:31448x1086
4:51122x1402
5:41402x1122
16:91672x941
9:16941x1672
21:91915x821
9:21821x1915
autoChosen automatically

Note: When you pass auto or leave size empty, the model automatically picks the aspect ratio and resolution that best fit the prompt. The quality parameter is not supported and has no effect even if passed.

Examples

Text-to-image (URL response)

curl example

bash
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

python
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

bash
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

python
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

bash
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

python
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

bash
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

python
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"):

json
{
  "created": 1589478378,
  "data": [
    { "url": "https://..." }
  ]
}

Base64 response (response_format: "base64"):

json
{
  "created": 1589478378,
  "data": [
    { "b64_json": "iVBORw0KGgo..." }
  ]
}
FieldTypeDescription
createdintegerUnix timestamp of when the response was created
dataarrayArray 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

ParameterTypeRequiredDefaultDescription
modelstringYes—Model name, fixed to GPT-Image-2-Flash
promptstringYes—Text description of the image, up to 5000 characters
sizestringNoautoImage size; both ratio formats and pixel formats are supported (see below)
imagestring / arrayNo—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

bash
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

python
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

bash
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

python
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

bash
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

python
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

json
{
  "created": 1589478378,
  "data": [
    { "url": "https://..." }
  ]
}
FieldTypeDescription
createdintegerUnix timestamp of when the response was created
dataarrayArray 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 modelUpstream modelRecommended forResolution
Nano-Bananagemini-2.5-flash-imageFast text-to-image, basic image editing1K
Nano-Banana-Progemini-3.0-pro-image-previewHigh-quality generation, complex instructions, multi-image editing2K / 4K supported
Nano-Banana-2gemini-3.1-flash-image-previewNext-generation fast, high-quality image generation and multi-image fusion2K / 4K supported
Nano-Banana-2.1—Image generation with optional image input1k / 2k / 4k supported
Nano-Banana-2-Litegemini-3.1-flash-lite-imageUltra-low-latency text-to-image, multi-turn local edits, interleaved generation1K only (1024px)

Note: Nano-Banana-2-Lite is 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
Text-to-image: POST https://token.bytomdao.com/v1/images/generations
Image-to-image / image editing: POST https://token.bytomdao.com/v1/images/edits

Note: The generation endpoint applies to Nano-Banana, Nano-Banana-Pro, Nano-Banana-2 and Nano-Banana-2.1. The edit endpoint applies to Nano-Banana, Nano-Banana-Pro and Nano-Banana-2, but not to Nano-Banana-2.1. Nano-Banana-2-Lite uses the Chat Completions endpoint; see its dedicated section below.

Text-to-image request parameters

ParameterTypeRequiredDefaultDescription
modelstringYes—Model name: Nano-Banana, Nano-Banana-Pro, Nano-Banana-2, Nano-Banana-2.1
promptstringYes—Text description of the image. Clearly describe the subject, style, composition, lighting and intended output
sizestringNo1x1Aspect ratio in the format WxH (ratio units), such as 1x1, 16x9, 9x16
qualitystringNo—Image quality tier: 1k, 2k, 4k. Nano-Banana-2.1 supports all three; other models accept values according to their own capabilities
response_formatstringNourlResponse format: url (temporary image link) or b64_json (Base64-encoded)

Image-to-image / image editing request parameters

ParameterTypeRequiredDefaultDescription
modelstringYes—Model name, same as text-to-image
imagestring / arrayYes—Input image(s). Supports image URLs and Base64; pass a string for one image or an array for several
promptstringYes—Editing instruction, such as style transfer, local edits, subject fusion or scene replacement
maskstringNo—Mask image for precise local edits; better suited to the Nano-Banana-Pro and Nano-Banana-2 series
sizestringNo1x1Output aspect ratio, same format as text-to-image
qualitystringNo—Image quality tier; same applicability as text-to-image
response_formatstringNourlResponse 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:

ValueRatio1K reference resolutionUse case
1x11:11024×1024Avatars, product images, general squares
2x32:3832×1248Portrait posters, portraits
3x23:21248×832Landscape photography, cover images
3x43:4864×1184Portrait content images
4x34:31184×864Landscape content images
4x54:5896×1152Portrait social media images
5x45:41152×896Landscape social media images
9x169:16768×1344Phone wallpapers, short-video covers
16x916:91344×768Landscape covers, presentation slides
21x921:91536×672Ultra-wide banners

Note: size here is a ratio (e.g. 16x9), not a pixel size (e.g. 1344x768). For higher resolution, use quality: "2k" or quality: "4k" instead of changing size to a pixel resolution.

Response format

URL response (response_format: "url"):

json
{
  "created": 1589478378,
  "data": [
    { "url": "https://..." }
  ]
}

Base64 response (response_format: "b64_json"):

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
    }
  }
}
FieldTypeDescription
createdintegerUnix timestamp of when the response was created
dataarrayArray of generated results; contains a url or b64_json field depending on response_format
output_formatstringOutput image format, usually png; may appear in Base64 responses
usageobjectToken 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

bash
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

python
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

bash
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

python
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

bash
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

python
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

bash
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

python
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

bash
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

python
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

python
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: size uses ratio format (e.g. 9x16), not pixel resolution. quality selects the output quality tier; response_format selects whether to return an image URL or Base64 data.

Request parameters

ParameterTypeRequiredDescription
modelstringYesFixed to Nano-Banana-2.1
promptstringYesImage generation prompt
imagearray[string]NoImage input; URL and Base64 supported. A single image can also be passed as a string
response_formatenum<string>NoResponse format: url or b64_json
sizeenum<string>NoSize of the generated image; accepts ratio or resolution values supported by the endpoint, e.g. 9x16
qualityenum<string>NoOutput quality: 1k, 2k, 4k

Text-to-image

curl example

bash
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):

json
{
  "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)

bash
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

text
POST https://token.bytomdao.com/v1/chat/completions

Request parameters

ParameterTypeRequiredDefaultDescription
modelstringYes—Model name, fixed to Nano-Banana-2-Lite
messagesarrayYes—Conversation messages. Plain text input is supported (text-to-image), and content may mix text and image_url (image-to-image / editing)
temperaturenumberNo1.0Sampling randomness (0–2)
max_tokensintegerNoModel defaultMaximum number of output tokens

Image input format in messages (image-to-image):

json
{
  "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)

bash
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"
      }
    ]
  }'
python
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)

bash
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" } }
        ]
      }
    ]
  }'
python
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

python
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:

json
{
  "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
  }
}
FieldTypeDescription
idstringUnique identifier of this request
choices[0].message.contentstringBase64-encoded output image data
usageobjectToken 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 modelUpstream modelRecommended forResolution
Nano-Banana-Spotgemini-2.5-flash-imageLow-cost off-peak basic image generation where stability fluctuation is acceptable1K
Nano-Banana-Pro-Spotgemini-3.0-pro-image-previewLow-cost off-peak high-quality generation and editing2K / 4K supported
Nano-Banana-2-Spotgemini-3.1-flash-image-previewLow-cost off-peak next-generation high-quality generation and multi-image fusion2K / 4K supported

Endpoints

text
POST https://token.bytomdao.com/v1/images/generations

Request parameters

ParameterTypeRequiredDefaultDescription
modelstringYes—Spot model name: Nano-Banana-Spot, Nano-Banana-Pro-Spot, Nano-Banana-2-Spot
promptstringYes—Image generation or editing instruction. Clearly describe the subject, style, composition, lighting and the desired changes
imagestring / arrayNo—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
sizestringNo1x1Aspect ratio in the format WxH (ratio units), such as 1x1, 16x9, 9x16. The Spot upstream examples also support very elongated ratios such as 1x8
qualitystringNo—Image quality tier: 2k, 4k. The base Spot model is usually fixed at 1K; Pro / 2 Spot accept values according to model capabilities
response_formatstringNourlResponse 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.

ValueRatioUse case
1x11:1Avatars, product images, general squares
2x32:3Portrait posters, portraits
3x23:2Landscape photography, cover images
3x43:4Portrait content images
4x34:3Landscape content images
9x169:16Phone wallpapers, short-video covers
16x916:9Landscape covers, presentation slides
1x81:8Very tall images, long strips; from the Spot upstream examples

Note: size here is a ratio, not a pixel resolution. For higher resolution, use quality: "2k" or quality: "4k".

Response format

json
{
  "created": 1589478378,
  "data": [
    { "url": "https://..." }
  ]
}
FieldTypeDescription
createdintegerUnix timestamp of when the response was created
dataarrayArray 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

bash
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

python
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

bash
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

python
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 modelUpstream modelRecommended forNotes
Qwen-Image-2.0-Proqwen-image-2.0-proComplex text rendering, posters, infographics, mixed text-and-image layoutsPreferred choice
Qwen-Image-2.0qwen-image-2.0General text-to-image and image editingBalances quality and cost

Endpoints

text
Text-to-image: POST https://token.bytomdao.com/v1/images/generations
Image-to-image / image editing: POST https://token.bytomdao.com/v1/images/edits

Text-to-image request parameters

ParameterTypeRequiredDefaultDescription
modelstringYes—Model name: Qwen-Image-2.0 or Qwen-Image-2.0-Pro
promptstringYes—Positive prompt. Qwen-Image works well when you clearly describe the subject, text content, layout, font, material and composition
response_formatstringNourlResponse format: url or b64_json
parameters.sizestringNo2048*2048Output resolution. When using native parameters, pass width*height in Alibaba's format
parameters.nintegerNo1Number of images to generate. The Qwen-Image-2.0 series supports 1–6
parameters.watermarkbooleanNofalseWhether to add a Qwen-Image watermark
parameters.negative_promptstringNo—Negative prompt, up to 500 characters
parameters.prompt_extendbooleanNotrueWhether to enable intelligent prompt rewriting
parameters.seedintegerNo—Random seed in [0, 2147483647], used to improve result stability
RatioRecommended resolution
1:12048x2048
4:32368x1728
3:41728x2368
16:92688x1536
9:161536x2688

Note: For the Qwen-Image-2.0 series, the total output pixels must be within the equivalent range of 512x512 to 2048x2048. The table uses x for readability; when putting a value into parameters.size, write it in Alibaba's native width*height format.

Image-to-image / image editing request parameters

ParameterTypeRequiredDefaultDescription
modelstringYes—Model name: Qwen-Image-2.0 or Qwen-Image-2.0-Pro
promptstringYes—Editing instruction. Qwen image editing supports Chinese and English; the 2.0 series is limited to roughly 1300 tokens
input.messages[].content[].imagestringYes—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.sizestringNoAround 1KOutput resolution, such as 1024*1024 or 1536*1024. The actual output is aligned to the nearest multiple of 16
parameters.nintegerNo1Number of images to generate. The 2.0 series supports 1–6
parameters.watermarkbooleanNofalseWhether to add a watermark
parameters.negative_promptstringNo—Negative prompt
parameters.prompt_extendbooleanNotrueWhether to enable intelligent prompt rewriting
parameters.seedintegerNo—Random seed

Recommended resolutions for image-to-image:

RatioRecommended resolution
1:11024x1024, 1536x1536
2:3768x1152, 1024x1536
3:21152x768, 1536x1024
3:4960x1280, 1080x1440
4:31280x960, 1440x1080
9:16720x1280, 1080x1920
16:91280x720, 1920x1080
21:91344x576, 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

bash
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

python
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

bash
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

python
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 modelUpstream modelRecommended for
Wan2.7-prowan2.7-image-proHigh-quality image sets, complex editing, subject consistency, higher resolution
Wan2.7wan2.7-imageGeneral text-to-image, image-to-image and image editing

Endpoints

text
Text-to-image: POST https://token.bytomdao.com/v1/images/generations
Image-to-image / image editing: POST https://token.bytomdao.com/v1/images/edits

Text-to-image request parameters

ParameterTypeRequiredDefaultDescription
modelstringYes—Model name: Wan2.7 or Wan2.7-pro
promptstringYes—Positive prompt describing the content, style, composition and text requirements of the image
parameters.sizestringNo2KOutput size. Wan2.7 supports tiers such as 1K, 2K, 4K; specific resolutions can also be passed in some scenarios
parameters.nintegerNo1Number of images to generate
parameters.enable_sequentialbooleanNofalseWhether to enable image-set / sequential generation; set to true when you need several consecutive images
parameters.negative_promptstringNo—Negative prompt
parameters.watermarkbooleanNofalseWhether to add a watermark
parameters.seedintegerNo—Random seed

Image-to-image / image editing request parameters

ParameterTypeRequiredDefaultDescription
modelstringYes—Model name: Wan2.7 or Wan2.7-pro
promptstringYes—Editing instruction, such as subject replacement, style transfer, scene extension or image-set generation
input.imagesarrayYes—Array of reference image URLs or Base64 strings
parameters.nintegerNo1Number of images to generate
parameters.negative_promptstringNo—Negative prompt
parameters.watermarkbooleanNofalseWhether to add a watermark
parameters.seedintegerNo—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

bash
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

python
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

bash
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

python
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 modelRecommended forSupported size tiersOutput format
Doubao-Seedream-4.0General text-to-image, image-to-image, multi-image fusion1K, 2K, 4KFixed JPEG
Doubao-Seedream-4.5Portraits, aesthetic enhancement, commercial visuals2K, 4KFixed JPEG
Doubao-Seedream-5.0-proHigh-quality commercial creation, complex visual design1K, 1.5K, 2Kpng, jpeg
Doubao-Seedream-5.0-liteComplex instructions, lightweight fast generation2K, 3K, 4Kpng, jpeg

Endpoints

text
POST https://token.bytomdao.com/v1/images/generations

Request parameters

ParameterTypeRequiredDefaultDescription
modelstringYes—Model name: Doubao-Seedream-4.0, Doubao-Seedream-4.5, Doubao-Seedream-5.0-pro or Doubao-Seedream-5.0-lite
promptstringYes—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
imagestring / arrayNo—Reference image URL, Base64 string, or an array of them; only for image-to-image and multi-image fusion
sizestringNoModel defaultEither a resolution tier (e.g. 2K) or an explicit width×height in pixels (e.g. 2048x2048); the two styles cannot be mixed
response_formatstringNourlHow the image is returned: url or b64_json
output_formatstringNoModel defaultSupported only by Doubao-Seedream-5.0-pro and Doubao-Seedream-5.0-lite; png or jpeg. Seedream 4.0/4.5 always output JPEG
watermarkbooleanNofalseWhether 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_generation or max_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:

  1. Resolution tier (recommended): pass a tier supported by the model (1K, 2K, 3K or 4K) and describe the desired aspect ratio in the prompt.
  2. 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
ModelTier1:14:33:416:99:163:22:321:9
Seedream 5.0 pro1K1024x10241152x864864x11521424x800800x14241248x832832x12481568x672
Seedream 5.0 pro1.5K1536x15361792x13441344x17922048x11521152x20481872x12481248x18722352x1008
Seedream 5.0 pro2K2048x20482368x17761776x23682816x15841584x28162496x16641664x24963136x1344
Seedream 5.0 lite2K2048x20482304x17281728x23042848x16001600x28482496x16641664x24963136x1344
Seedream 5.0 lite3K3072x30723456x25922592x34564096x23042304x40963744x24962496x37444704x2016
Seedream 5.0 lite4K4096x40964704x35203520x47045504x30403040x55044992x33283328x49926240x2656
Seedream 4.52K2048x20482304x17281728x23042848x16001600x28482496x16641664x24963136x1344
Seedream 4.54K4096x40964704x35203520x47045504x30403040x55044992x33283328x49926240x2656
Seedream 4.01K1024x10241152x864864x11521312x736736x13121248x832832x12481568x672
Seedream 4.02K2048x20482304x17281728x23042848x16001600x28482496x16641664x24963136x1344
Seedream 4.04K4096x40964704x35203520x47045504x30403040x55044992x33283328x49926240x2656

The table lists reference values for common aspect ratios only; the model supports aspect ratios beyond these standard ones.

Custom size limits
ModelTotal pixel rangeAspect ratio range
Doubao-Seedream-5.0-pro921,600 (1280x720) – 4,624,220 (2048x2048, with model constraints)[1/16, 16]
Doubao-Seedream-5.0-lite3,686,400 (2560x1440) – 16,777,216 (4096x4096)[1/16, 16]
Doubao-Seedream-4.53,686,400 (2560x1440) – 16,777,216 (4096x4096)[1/16, 16]
Doubao-Seedream-4.0921,600 (1280x720) – 16,777,216 (4096x4096)[1/16, 16]

Response format

When response_format is url, data contains the image download URLs:

json
{
  "created": 1589478378,
  "data": [
    { "url": "https://..." }
  ]
}

When response_format is b64_json, data contains the Base64-encoded image data:

json
{
  "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

bash
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

python
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

bash
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

python
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

bash
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

python
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

bash
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

python
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

ModelUpstream Model IDDescriptionOutput specs
Seedance-2.5doubao-seedance-2-5-260628Next-generation video creation model; up to 30 seconds, multimodal references, video editing and extension480p / 720p; 4–30 s
Seedance-2.0doubao-seedance-2-0-260128Professional-grade video creation model for the highest generation quality480p / 720p / 1080p / 4k (10-bit); 4–15 s
Seedance-2.0-Fastdoubao-seedance-2-0-fast-260128Fast version with capabilities largely the same as 2.0, focused on speed and cost480p / 720p; 4–15 s
Seedance-2.0-Minidoubao-seedance-2-0-mini-260615Lightweight version; usage, request parameters and output specs are identical to Seedance-2.0-Fast480p / 720p; 4–15 s
Omni-Flashomni-flashGoogle-family fast video model; supports text-to-video, reference-image-to-video, multi-image reference and video editing720p; 4 / 6 / 8 s
Veo-3.1—Google-family video model; supports text-to-video and first/last-frame controlled generationFixed 8 s
Kling-3.0-Turbokling-video/kling-3.0-turboKling 3.0 Turbo; supports text-to-video and first-frame image-to-video, with audiostd: 720p; pro: 1080p; 3–15 s
Grok-Imagine-Video-1.5-Fastgrok-imagine-video-1.5-fastGrok 1.5 fast video model; supports text-to-video and generation from 0–7 reference images480p / 720p; 6–30 s
Grok-Imagine-Video-1.5grok-imagine-video-1.5Grok 1.5 high-quality image-to-video model; exactly 1 reference image is required480p / 720p / 1080p; 1–15 s
MiniMax-H3minimax-h3MiniMax video model; supports text-to-video, first/last-frame control and image / video / audio multimodal references768p / 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 references480p / 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: -1 to 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=true to generate a video with sound.

Fast / Mini usage: Seedance-2.0-Fast and Seedance-2.0-Mini use exactly the same endpoint, request parameters and asset formats. For any Seedance example below, just replace model with the corresponding model name; both support 480p, 720p and 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

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

ParameterTypeRequiredDescription
modelstringYesFixed to Seedance-2.5
promptstringYesVideo content, camera, action, dialogue, sound and editing intent; use @image1, @video1, @audio1 to reference assets
metadata.contentarrayNoImage, video and audio reference assets; array order corresponds to the asset numbers in the prompt
metadata.ratiostringNo21:9, 16:9, 4:3, 1:1, 3:4, 9:16, adaptive
metadata.resolutionstringNo480p or 720p
metadata.durationintegerNo4–30 seconds; -1 lets the model choose automatically within the valid range
metadata.generate_audiobooleanNoWhether to generate audio
metadata.watermarkbooleanNoWhether to add a watermark
metadata.return_last_framebooleanNoWhether to also return the last frame of the generated video

metadata.content supports the following asset formats:

json
[
  {
    "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.role and the prompt. If you violate the ratio / duration constraints for the task, the create endpoint may first return a task ID and then fail asynchronously when you query the task.

Task typeHow it is triggeredratio / duration constraints
Text-to-videoNo contentAny valid ratio and 4–30 s duration; duration: -1 also works
Reference-to-videoAssets use reference_image / reference_video / reference_audio, and the prompt describes the referencesAny 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 editingPass reference assets and state an editing goal (add, remove, modify, replace) in the promptratio must be adaptive and duration must be -1
Video extensionPass reference videos and state in the prompt that you want to extend forward / backward or continueratio must be adaptive; duration can be the added length or -1 for automatic
First-frame / first-and-last-frame to videoUse the first_frame image role, optionally with a last_frame imageratio must be adaptive; duration can be 4–30 s or -1

2.3.3 Examples

Text-to-video (30 seconds)

bash
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

bash
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

bash
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

bash
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

bash
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

bash
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

text
POST https://token.bytomdao.com/v1/video/generations

Video 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:

text
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

ParameterTypeRequiredDefaultDescription
modelstringYes—Model name, such as Seedance-2.0, Seedance-2.0-Fast, Seedance-2.0-Mini
promptstringYes—Video generation prompt describing visuals, camera movement, action, sound, style, etc.
metadataobjectNo—Container for parameters passed through to the upstream video service, including reference assets, ratio, resolution and duration

metadata parameters

ParameterTypeRequiredDefaultDescription
contentarrayNo—Array of multimodal reference assets. Only images, videos, audio and similar assets go here; put the text prompt in the top-level prompt
ratiostringNo16:9Output aspect ratio: 21:9, 16:9, 4:3, 1:1, 3:4, 9:16
resolutionstringNo720pOutput resolution. Seedance-2.0 supports 480p, 720p, 1080p; Seedance-2.0-Fast and Seedance-2.0-Mini support 480p, 720p
durationintegerNo5Output video duration, 4–15 seconds
generate_audiobooleanNofalseWhether to generate a video with audio. Set to true if you need sound
watermarkbooleanNofalseWhether to add a watermark to the result
return_last_framebooleanNofalseWhether to also return the last frame of the video
service_tierstringNo—Inference service tier. When the upstream supports flex offline inference, pass it according to your actual integration

metadata.content array format

typeExample fieldroleDescription
image_url{ "type": "image_url", "image_url": { "url": "https://..." }, "role": "reference_image" }reference_image / first_frame / last_frameReference image, first frame, last frame
video_url{ "type": "video_url", "video_url": { "url": "https://..." }, "role": "reference_video" }reference_videoReference 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_audioReference 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.

python
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

bash
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

python
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

bash
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

python
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

bash
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

python
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

bash
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

python
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

bash
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

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

json
{
  "id": "task_yUvIeAeHbZSQ4dPJT6BA1f7SFUW6ErFh",
  "task_id": "task_yUvIeAeHbZSQ4dPJT6BA1f7SFUW6ErFh",
  "object": "video",
  "model": "Seedance-2.0",
  "status": "queued",
  "progress": 0,
  "created_at": 1780974847
}

Query a task

bash
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:

json
{
  "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:

json
{
  "code": "success",
  "message": "",
  "data": {
    "task_id": "task_yUvIeAeHbZSQ4dPJT6BA1f7SFUW6ErFh",
    "status": "FAILURE",
    "progress": "100%",
    "fail_reason": "upstream error message"
  }
}
FieldTypeDescription
codestringQuery response status; success on success
messagestringResponse message
data.task_idstringVideo generation task ID
data.statusstringTask status; common values: SUBMITTED, QUEUED, IN_PROGRESS, SUCCESS, FAILURE
data.progressstringTask progress, usually a percentage string
data.result_urlstringVideo URL after successful generation
data.data.content.video_urlstringOriginal 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_reasonstringReason for generation failure
data.quotaintegerFinal 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:

json
{
  "result_url": "https://example.com/result.mp4?X-Tos-Date=20260609T051645Z\u0026X-Tos-Expires=86400"
}

After parsing with Python, the field value automatically becomes:

text
https://example.com/result.mp4?X-Tos-Date=20260609T051645Z&X-Tos-Expires=86400

If you see something like the following in a web page, Markdown editor or chat window:

text
[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 %2F or %3D in 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:

python
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:

CapabilityOmni-FlashVeo-3.1
Video duration4 / 6 / 8 secondsFixed 8 seconds
Text-to-videoSupported, mode=textSupported, mode=text
Plain reference images1–3 images, mode=ref—
First/last-frame controlStrict first/last-frame control not supportedSupported, mode=frame, pass the first-frame then last-frame image in order
Video editingSupported, 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 ref mode 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 the prompt.

2.3.1.1 Endpoints

JSON requests suit text-to-video and single-image reference with a public image URL:

text
POST https://token.bytomdao.com/v1/video/generations

Local multi-image upload and video editing use the multipart/form-data endpoint:

text
POST https://token.bytomdao.com/v1/video/generations

After the task is created, use the unified query endpoint to get progress and results:

text
GET https://token.bytomdao.com/v1/video/generations/{task_id}
2.3.1.2 Request parameters
ParameterTypeRequiredDefaultDescription
modelstringYes—Fixed to Omni-Flash
promptstringYes—Video generation or editing prompt
modestringYes—text: text-to-video; ref: reference-image-to-video; edit: video editing
input_referencestring / file / arrayNo—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
watermarkbooleanNofalseWhether to add a watermark. Use a JSON boolean true / false, not a string
sizestringNo—Output orientation. 1280x720 is landscape and 720x1280 is portrait; the endpoint mainly determines orientation from the width/height relationship
resolutionstringNo720pOutput resolution; the current examples use 720p
secondsintegerNo8Video duration: 4, 6 or 8 seconds

Rules for input_reference:

  • mode=text: do not pass input_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 first input_reference is the source video URL, and the 2nd–4th are optional reference images (up to 3).
2.3.1.3 Text-to-video
bash
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:

json
{
  "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:

bash
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:

bash
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:

bash
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:

bash
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:

json
{
  "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:

ParameterTypeRequiredFixed value / Description
modelstringYesFixed to Veo-3.1
modestringYestext: text-to-video; frame: first/last-frame controlled generation
secondsintegerNoFixed at 8; 4 or 6 seconds are not supported
input_referencestring / file / arrayYes in frame modePass 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 1st input_reference is the first-frame image and the 2nd is the last-frame image. Together they control the opening and closing frames of the video, while prompt describes the action, camera movement and transition in between.

2.3.2.2 Text-to-video
bash
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:

bash
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 be 8.

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: std is 720p and pro is 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:

text
POST https://token.bytomdao.com/v1/video/generations

Query task status and results:

text
GET https://token.bytomdao.com/v1/video/generations/{task_id}

2.4.2 Request parameters

ParameterTypeRequiredDefaultDescription
modelstringYes—Fixed to Kling-3.0-Turbo
promptstringConditional—Video prompt, recommended to be at most 2500 characters; use either this or metadata.multi_prompt
imagestringYes for image-to-video—First-frame image URL or Base64; passing it switches to image-to-video mode automatically
sizestringNo1280x720Text-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
durationinteger / stringNo5Video duration, an integer from 3 to 15 seconds
metadata.modestringNostdQuality tier: std is 720p, pro is 1080p
metadata.multi_promptarrayNo—Multi-shot prompts, 1–6 shots; use either this or the top-level prompt
metadata.image_tailstringNo—Last-frame image URL or Base64; image-to-video only
metadata.negative_promptstringNo—Negative prompt describing what you do not want to appear
metadata.cfg_scalenumberNo0.5Prompt guidance strength
metadata.callback_urlstringNo—Callback URL for task status
metadata.external_task_idstringNo—Caller-defined task identifier

Each shot in metadata.multi_prompt has the following structure:

ParameterTypeRequiredDescription
indexintegerYesShot number, starting from 1
promptstringYesVisual, action and camera description of this shot
durationstringYesDuration of this shot; the total of all shots should equal the task duration

Image limits: image supports .jpg, .jpeg and .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

bash
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

bash
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:

json
{
  "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:

bash
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:

json
{
  "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

bash
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:

json
{
  "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:

CapabilityGrok-Imagine-Video-1.5-FastGrok-Imagine-Video-1.5
Text-to-videoSupportedNot supported; a reference image is required
Reference images0–7Exactly 1
Video duration6–30 seconds1–15 seconds
Resolution480p, 720p480p, 720p, 1080p
Supported ratios2:3, 3:2, 1:1, 9:16, 16:92:3, 3:2, 1:1, 9:16, 16:9

2.6.1 Endpoints

Create a video task:

text
POST https://token.bytomdao.com/v1/video/generations

Query task status and results:

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

ParameterTypeRequiredDefaultDescription
modelstringYes—Grok-Imagine-Video-1.5-Fast or Grok-Imagine-Video-1.5
promptstringYes—Description of video content, subject action, camera movement, lighting and style
metadata.ratiostringNo16:9Output aspect ratio: 2:3, 3:2, 1:1, 9:16, 16:9
metadata.resolutionstringNo720pFast supports 480p, 720p; the standard version additionally supports 1080p
metadata.durationintegerNo10Fast supports 6–30 seconds; the standard version supports 1–15 seconds
metadata.contentarrayConditional—Array of reference images. Fast accepts 0–7; the standard version requires exactly 1

Reference images use the following format:

json
{
  "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.5 requires exactly one image; Grok-Imagine-Video-1.5-Fast is 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

bash
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:

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

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

bash
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:

python
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:

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

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

CapabilityMiniMax-H3MiniMax-H3-Max
Text-to-videoSupportedSupported
Image-to-video (first / last frame)SupportedSupported
Multimodal reference to video (reference_image / reference_video / reference_audio)SupportedNot supported
Resolution768p, 2K480p, 768p (2K not supported)
Duration5–15 seconds5–15 seconds

Note: MiniMax-H3-Max does not accept any reference_* assets. Requests that include reference_image, reference_video or reference_audio, or that specify 2K resolution, will cause the task to fail.

2.7.1 Endpoints

Create a video task:

text
POST https://token.bytomdao.com/v1/video/generations

Query task status and results:

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

ParameterTypeRequiredDefaultDescription
modelstringYes—Model name. Available values: MiniMax-H3, MiniMax-H3-Max
promptstringYes—Description of video content, camera, action, sound and style; must not be empty
metadata.contentarrayNo—Array of image, video and audio reference assets; see the format below. MiniMax-H3-Max supports only first/last-frame images
metadata.resolutionstringYes—Output resolution. MiniMax-H3: 768p or 2K; MiniMax-H3-Max: 480p or 768p, 2K not supported
metadata.durationintegerYes—Output video duration (integer), 5–15 seconds
metadata.ratiostringConditionaladaptiveAspect 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:

typeExample fieldroleDescription
image_url{ "type": "image_url", "image_url": { "url": "https://..." }, "role": "first_frame" }first_frame / last_frame / reference_imageFirst frame, last frame or reference image
video_url{ "type": "video_url", "video_url": { "url": "https://..." }, "role": "reference_video" }reference_videoMultimodal reference video
audio_url{ "type": "audio_url", "audio_url": { "url": "https://..." }, "role": "reference_audio" }reference_audioMultimodal reference audio

Supported generation scenarios:

  • Text-to-video: omit metadata.content and use only the top-level prompt. Both models support it.
  • First-frame image-to-video: pass 1 image_url with role set to first_frame or omitted. Both models support it.
  • Last-frame image-to-video: pass 1 image_url with role set to last_frame. Both models support it.
  • First-and-last-frame image-to-video: pass 2 image_url items with role set to first_frame and last_frame respectively. Both models support it.
  • Multimodal-reference-to-video: combine reference_image, reference_video and reference_audio assets. Supported by MiniMax-H3 only.

Mutually exclusive scenarios: reference_image / reference_video / reference_audio cannot be mixed with first_frame / last_frame in the same request.

Ratio rules:

  • ratio defaults to adaptive; the actual output ratio can be read from the ratio field returned by the query endpoint.
  • Text-to-video must specify an explicit ratio and cannot use adaptive; available values are 21: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 as 16:9 or 9:16, which may cause generation to fail.
  • Multimodal-reference-to-video may omit ratio (default adaptive) or specify an explicit ratio: 21:9, 16:9, 4:3, 1:1, 3:4, 9:16. This scenario applies to MiniMax-H3 only.

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-Max does not support multimodal references, so it does not accept reference_image, reference_video or reference_audio assets. The image limits below apply to both models; the video and audio limits apply to MiniMax-H3 only.

Image limits:

ItemLimit
FormatJPG, JPEG, PNG, WEBP, HEIC, HEIF
Size per file≤ 30 MB
Width / height range256–5760 px
Aspect ratio (width / height)0.4–2.5
CountFirst frame ≤ 1, last frame ≤ 1, reference images ≤ 9 (reference images for MiniMax-H3 only)

Video limits (MiniMax-H3 multimodal reference only):

ItemLimit
Container / formatMP4, MOV
CodecVideo: H.264/AVC, H.265/HEVC; audio: AAC, MP3
Size per file≤ 50 MB
Count≤ 3
Duration2–15 s per clip, total ≤ 15 s
Width / height range256–5760 px
Aspect ratio (width / height)0.4–2.5
Frame rate23.976–60 fps

Audio limits (MiniMax-H3 multimodal reference only):

ItemLimit
FormatWAV, MP3
Size per file≤ 15 MB
Count≤ 3
Duration2–15 s per clip, total ≤ 15 s

2.7.4 Text-to-video (MiniMax-H3)

bash
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 as 16:9 or 9:16 are 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.

bash
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)

bash
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

bash
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)

bash
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-Max image-to-video must also pass ratio: "adaptive" and cannot specify custom ratios such as 16:9 or 9:16.

2.7.8 Create-task response and query

On success, an asynchronous task ID is returned:

json
{
  "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:

bash
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

ModelDescriptionHighlights
Qwen3-VL-PlusQwen flagship vision-understanding modelComplex visual reasoning, multi-image / video understanding, visual agents, visual coding, spatial perception
Qwen3-VL-FlashQwen lightweight vision-understanding modelFast 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-flash and 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:

text
POST https://token.bytomdao.com/v1/chat/completions

The difference is that messages.content is a multimodal array that can contain text, images and video.

3.3 Request parameters

ParameterTypeRequiredDefaultDescription
modelstringYes—Model name, such as Qwen3-VL-Plus, Qwen3-VL-Flash
messagesarrayYes—Conversation messages; content may mix text, image_url and video_url
temperaturenumberNo1.0Sampling randomness; lower values make the output more deterministic (0–2)
max_tokensintegerNoModel defaultMaximum number of output tokens
top_pnumberNo1.0Nucleus sampling probability; adjust either this or temperature, not both
streambooleanNofalseWhether to enable streaming output

Multimodal input in messages:

json
{
  "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_url objects in the content array
  • 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

bash
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" } }
        ]
      }
    ]
  }'
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="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

python
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

python
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

python
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

ModelDescriptionHighlights
Qwen3.5-Omni-PlusQwen omni-modal premium versionLong audio/video understanding, meeting minutes, subtitle generation, content moderation, audio/video interactive assistants
Qwen3.5-Omni-FlashQwen omni-modal ultra-fast versionBetter cost and latency; suits voice assistants, batch audio understanding, real-time interaction
Scribe_V2ElevenLabs Scribe v2 speech transcription modelAudio/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-plus and qwen3.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.

text
POST https://token.bytomdao.com/v1/chat/completions

4.3 Request parameters

ParameterTypeRequiredDefaultDescription
modelstringYes—Model name, such as Qwen3.5-Omni-Plus, Qwen3.5-Omni-Flash
messagesarrayYes—Conversation messages; supports multimodal input such as text, images, audio and video
modalitiesarrayNo["text"]Output modalities: ["text"] for text only, ["text", "audio"] for text + speech
audioobjectNo—Audio output configuration; required when modalities includes audio, with voice and format
temperaturenumberNo1.0Sampling randomness (0–2)
max_tokensintegerNoModel defaultMaximum number of output tokens
streambooleanYes for speech outputfalseMust be set to true for Qwen3.5-Omni speech output
stream_optionsobjectNo—Streaming statistics options, such as { "include_usage": true }

Audio input in messages (Base64):

json
{
  "role": "user",
  "content": [
    { "type": "text", "text": "What does this audio say?" },
    { "type": "input_audio", "input_audio": { "data": "<base64 encoded audio>", "format": "wav" } }
  ]
}
FieldDescription
typeFixed to input_audio
input_audio.dataBase64-encoded audio data
input_audio.formatAudio format, such as wav or mp3

Audio output configuration:

FieldDescription
audio.voiceOutput voice. The Alibaba Model Studio examples use Tina; the number of available voices differs by model, so refer to the model list
audio.formatOutput 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, use modalities=["text", "audio"] and concatenate delta.audio.data in the streaming response.

4.4 Examples

Audio input, text output

bash
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" } }
        ]
      }
    ]
  }'
python
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

python
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

text
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 items

Audio 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/speech route, 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

text
POST https://token.bytomdao.com/v1/audio/transcriptions

Requests use your platform user key:

http
Authorization: Bearer YOUR_API_TOKEN

Request parameters

ParameterTypeRequiredDefaultDescription
fileFileYes—The single audio or video file to transcribe; only one file can be uploaded per request
modelstringYes—Fixed to Scribe_V2 (the proxy maps it to ElevenLabs' scribe_v2)
languagestringNoAuto-detectLanguage code, such as zh, en, ja; mapped to language_code
language_codestringNo—Native ElevenLabs language parameter; use either this or language. If both are passed, this field takes precedence
diarizebooleanNo—Whether to enable speaker diarization; when enabled, words may include speaker_id
num_speakersintegerNo—Expected number of speakers, to assist speaker identification
timestamps_granularitystringNo—Timestamp granularity; valid values are validated by the upstream
tag_audio_eventsbooleanNo—Whether to tag non-speech events such as laughter and applause
diarization_thresholdnumberNo—Speaker diarization threshold; the range is validated by the upstream
file_formatstringNo—Explicitly specify the input format; usually unnecessary for regular MP3/WAV
temperaturenumberNo—Sampling temperature; the range is validated by the upstream
seedintegerNo—Random seed, to improve reproducibility for the same input
no_verbatimbooleanNo—Whether to enable non-verbatim transcription mode
use_speaker_librarybooleanNo—Whether to use the ElevenLabs Speaker Library to help identify known speakers
response_formatstringNojsonAccepted 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

bash
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)

python
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:

json
{
  "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_url and additional_formats are not supported.
  • entity_detection, use_multi_channel and multichannel_output_style are 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 the x-oneapi-request-id from the response headers.

Billing

Billed by the audio duration parsed from the uploaded file:

text
Billed seconds = audio seconds rounded up
Audio tokens = round(billed seconds / 60 × 1000)
Cost = audio tokens × Scribe_V2 unit price / 1,000,000

For 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

ModelDescriptionHighlights
Text-Embedding-V4Tongyi Lab multilingual text embedding modelTrained on Qwen3; suits semantic search, RAG, clustering and classification; supports custom dimensions
Qwen3-VL-EmbeddingQwen multimodal embedding modelIndependent 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 usually qwen3-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:

text
POST https://token.bytomdao.com/v1/embeddings

In 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

ParameterTypeRequiredDefaultDescription
modelstringYes—Model name, such as Text-Embedding-V4
inputstring / arrayYes—Input text; a single string or a batch array
encoding_formatstringNofloatEncoding format: float (float array) or base64 (Base64-encoded)
dimensionsintegerNoModel defaultVector dimensions; Text-Embedding-V4 supports custom dimensions (commonly 512, 1024, 1536, 2048)

Multimodal embedding parameters (if enabled)

ParameterTypeRequiredDefaultDescription
modelstringYes—Model name, such as Qwen3-VL-Embedding
inputarrayYes—Array of multimodal content, which may include { "text": "..." }, { "image": "https://..." }, { "video": "https://..." }
enable_fusionbooleanNofalseWhether to generate a fused vector. When true, the multimodal content is fused into a single vector
dimensions / dimensionintegerNoModel defaultOutput vector dimensions. Valid values depend on the current model specs

5.4 Examples

Embedding a single text

curl example

bash
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"
  }'
python
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

bash
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

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

bash
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
  }'
python
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

python
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

ModelDescriptionHighlights
Qwen3-Coder-PlusQwen flagship code modelComplex programming and code review; very long context supported
Qwen3-Coder-FlashQwen lightweight code modelMulti-turn tool interaction, repository-level understanding, fast
Doubao-Seed-2.0-CodeDoubao programming-specific modelOptimized for front-end work; supports Skills and IDE tool calling

6.2 Endpoint

Code models use the Chat Completions endpoint:

text
POST https://token.bytomdao.com/v1/chat/completions

Code 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

ParameterTypeRequiredDefaultDescription
modelstringYes—Model name, such as Qwen3-Coder-Plus, Doubao-Seed-2.0-Code
messagesarrayYes—Conversation messages
temperaturenumberNo1.0Sampling randomness; 0–0.3 is recommended for programming tasks (lower is more deterministic)
max_tokensintegerNoModel defaultMaximum number of output tokens
top_pnumberNo1.0Nucleus sampling probability
toolsarrayNo—List of tool definitions (Function Calling) describing external functions the model can call
tool_choicestringNoautoTool selection strategy: auto (model decides), none (no tools), required (a tool must be used)
streambooleanNofalseWhether to enable streaming output

6.4 Examples

Code generation

curl example

bash
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

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

bash
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

python
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

ModelDescriptionHighlights
Qwen-Math-PlusQwen flagship math modelComplex math problem solving: equations, calculation, proofs
Qwen-Math-TurboQwen fast math modelFast reasoning at low cost

7.2 Endpoint

Math models use the Chat Completions endpoint:

text
POST https://token.bytomdao.com/v1/chat/completions

7.3 Request parameters

ParameterTypeRequiredDefaultDescription
modelstringYes—Model name, such as Qwen-Math-Plus, Qwen-Math-Turbo
messagesarrayYes—Conversation messages
temperaturenumberNo1.0Sampling randomness
max_tokensintegerNoModel defaultMaximum number of output tokens
top_pnumberNo1.0Nucleus sampling probability
streambooleanNofalseWhether to enable streaming output

7.4 Examples

curl

bash
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

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:

http
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json

BytomDAO endpoints are compatible with the OpenAI specification. We recommend the official OpenAI SDK; just override base_url:

Python

python
from openai import OpenAI
client = OpenAI(
    api_key="YOUR_API_TOKEN",
    base_url="https://token.bytomdao.com/v1"
)

9.3 Endpoint summary

Model typePathApplicable models
TEXT / CODE / MATH/v1/chat/completionsText, code and math reasoning
VISION/v1/chat/completionsQwen3-VL image/video understanding; multimodal input goes through messages.content (see §3)
AUDIO (Qwen3.5-Omni)/v1/chat/completionsQwen3.5-Omni audio/video understanding, streaming text + speech output (see §4.1–§4.4)
AUDIO (Scribe_V2)/v1/audio/transcriptionsElevenLabs 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/generationsLatest 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/generationsGPT-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/editsGPT-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/generationsGPT-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/generationsGPT-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/generationsGPT-Image-2-Flash simplified version; 1K only, URL response only (see §1.7)
IMAGE (Nano-Banana original, text-to-image)/v1/images/generationsNano-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/editsNano-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/completionsNano-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/generationsNano-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/generationsQwen-Image-2.0 / 2.0-Pro text-to-image (see §1.10.1–§1.10.2)
IMAGE (Qwen image-to-image / edit)/v1/images/editsQwen-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/generationsWan2.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/editsWan2.7 / Wan2.7-pro multi-image reference and subject-consistent editing (see §1.11.1–§1.11.2)
IMAGE (Doubao-Seedream)/v1/images/generationsDoubao-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/generationsSeedance-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/generationsOmni-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/generationsOmni-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/generationsKling-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/generationsGrok-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/embeddingsText-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.