Documentation
A single OpenAI-compatible surface for ByteDance's Doubao, Seedance and Seedream models.
Quickstart
Any OpenAI SDK works unchanged — only the base URL and the model id change. Keys are scoped per project and can be rotated without downtime.
- 1Create an account and generate a key in the dashboard.
- 2Set the base URL to https://byteplus.cc/v1.
- 3Use a ByteDance model id such as doubao-seed-1-6.
# any OpenAI-compatible client works
pip install openai
export BYTEPLUS_KEY="bp_live_xxxxxxxxxxxxxxxx"Authentication
Send the key as a bearer token. Requests without a key return 401; requests over quota return 429 with a retry-after header.
curl https://byteplus.cc/v1/chat/completions \
-H "Authorization: Bearer $BYTEPLUS_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"doubao-pro-32k","messages":[{"role":"user","content":"hi"}]}'
# 401 invalid_api_key
# 429 rate_limit_exceeded (see retry-after header)Chat completions
POST /v1/chat/completions accepts the standard OpenAI payload: model, messages, temperature, max_tokens, stream and tools.
from openai import OpenAI
client = OpenAI(
base_url="https://byteplus.cc/v1",
api_key=os.environ["BYTEPLUS_KEY"],
)
stream = client.chat.completions.create(
model="doubao-seed-1-6",
messages=[{"role": "user", "content": "Summarise this deck."}],
temperature=0.7,
stream=True,
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="")Video tasks
Video is asynchronous. Create a task, then poll it or wait for the webhook. Task ids are stable and results stay retrievable for 24 hours.
# 1. create the task
curl https://byteplus.cc/v1/video/tasks \
-H "Authorization: Bearer $BYTEPLUS_KEY" \
-d '{
"model": "seedance-1-0-pro",
"prompt": "neon koi in a datacenter, dolly-in",
"resolution": "1080p",
"duration": 5
}'
# => {"id": "task_9f2c", "status": "queued"}
# 2. poll for the artifact
curl https://byteplus.cc/v1/video/tasks/task_9f2c \
-H "Authorization: Bearer $BYTEPLUS_KEY"
# => {"status": "succeeded", "video_url": "https://..."}Image generation
POST /v1/images/generations renders a batch from a text prompt; POST /v1/images/edits applies an instruction to an existing image.
curl https://byteplus.cc/v1/images/generations \
-H "Authorization: Bearer $BYTEPLUS_KEY" \
-d '{
"model": "seedream-4-0",
"prompt": "isometric mint server garden, 4K",
"size": "4096x4096",
"n": 4
}'List models
GET /v1/models returns every model id with its modality, context window and unit price.
curl https://byteplus.cc/v1/models \
-H "Authorization: Bearer $BYTEPLUS_KEY"
# => {"data": [
# {"id": "doubao-seed-1-6", "modality": "language", "context": 262144},
# {"id": "seedance-1-0-pro", "modality": "video", "max_duration": 10},
# {"id": "seedream-4-0", "modality": "image", "max_size": "4096x4096"}
# ]}Error codes
Errors use the OpenAI envelope: an error object with type, code, message and param. Retry 429 and 5xx with exponential backoff.
| 401 | invalid_api_key | Check the bearer token and that the key is active. |
| 402 | insufficient_balance | Top up the account balance. |
| 404 | model_not_found | Verify the model id against GET /v1/models. |
| 422 | invalid_request | Inspect the error param and fix the payload. |
| 429 | rate_limit_exceeded | Back off and retry, or reserve concurrency. |
| 503 | capacity_unavailable | Retry after the retry-after window; queue position is in the header. |
Rate limits
Limits are enforced per key and per model, expressed in requests per minute and tokens per minute. Reserved customers receive a dedicated concurrency pool.