Skip to content
byteplus.cc
docs

Documentation

A single OpenAI-compatible surface for ByteDance's Doubao, Seedance and Seedream models.

base_url: https://byteplus.cc/v1
01

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.

  1. 1Create an account and generate a key in the dashboard.
  2. 2Set the base URL to https://byteplus.cc/v1.
  3. 3Use a ByteDance model id such as doubao-seed-1-6.
quickstart
# any OpenAI-compatible client works
pip install openai
export BYTEPLUS_KEY="bp_live_xxxxxxxxxxxxxxxx"
02

Authentication

Send the key as a bearer token. Requests without a key return 401; requests over quota return 429 with a retry-after header.

authentication
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)
03

Chat completions

POST /v1/chat/completions accepts the standard OpenAI payload: model, messages, temperature, max_tokens, stream and tools.

chat
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="")
04

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.

video
# 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://..."}
05

Image generation

POST /v1/images/generations renders a batch from a text prompt; POST /v1/images/edits applies an instruction to an existing image.

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
  }'
06

List models

GET /v1/models returns every model id with its modality, context window and unit price.

models
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"}
#    ]}
07

Error codes

Errors use the OpenAI envelope: an error object with type, code, message and param. Retry 429 and 5xx with exponential backoff.

401invalid_api_keyCheck the bearer token and that the key is active.
402insufficient_balanceTop up the account balance.
404model_not_foundVerify the model id against GET /v1/models.
422invalid_requestInspect the error param and fix the payload.
429rate_limit_exceededBack off and retry, or reserve concurrency.
503capacity_unavailableRetry after the retry-after window; queue position is in the header.
08

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.