Doubao Seed 2.1 Turbo
Request ID doubao-seed-2.1-turbo
Protocols
POST /v1/chat/completions· Chat Completions examplePOST /v1/messages· Anthropic Messages examplePOST /v1/messages/count_tokens· Count Tokens examplePOST /v1/responses· OpenAI Responses example
Authentication
Requests require an API key from API key management. For JSON requests, set Content-Type: application/json.
Authorization: Bearer YOUR_API_KEY- Anthropic Messages ·
x-api-key: YOUR_API_KEY
Request parameters
POST /v1/chat/completions
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Required | Set the model ID to doubao-seed-2.1-turbo. |
messages | object[] | Required | Send messages in conversation order. Each message has a role and content. |
messages[].content | string / object[] | Conditional | The message body. Use plain text or an array of content blocks defined by the protocol. |
stream | boolean | Optional | true requests an SSE stream. false requests a JSON response. Available modes depend on the endpoint. |
max_completion_tokens | integer | Conditional | Caps generated tokens, including reasoning tokens where applicable. Use on endpoints that accept this field. |
max_tokens | integer | Conditional | Compatibility field for the output token limit. Choose this field or max_completion_tokens according to the endpoint. |
temperature | number | Conditional | Controls sampling randomness. Accepted values and whether the field takes effect depend on the model and endpoint. |
top_p | number | Conditional | Limits sampling candidates by cumulative probability. Use when the model and endpoint support it. |
response_format | object | Conditional | For structured output, use type: json_object, or use type: json_schema with json_schema when the endpoint supports schemas. |
tools | object[] | Conditional | Tool definitions available to the model. Tool types and parameter formats depend on the protocol and endpoint. |
tool_choice | string / object | Conditional | Controls tool selection. Use a forced or named choice only when the selected endpoint supports it. |
POST /v1/messages
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Required | Set the model ID to doubao-seed-2.1-turbo. |
messages | object[] | Required | Send user and assistant messages in order. Put system instructions in the top-level system field. |
messages[].content | string / object[] | Required | The message body. Use plain text or an array of content blocks defined by the protocol. |
system | string / object[] | Optional | System instructions as text or an array of text blocks. |
max_tokens | integer | Required | Caps output tokens. The accepted limit depends on the model and endpoint. |
stream | boolean | Optional | true requests an SSE stream. false requests a JSON response. Available modes depend on the endpoint. |
temperature | number | Conditional | Controls sampling randomness. Accepted values and whether the field takes effect depend on the model and endpoint. |
top_p | number | Conditional | Limits sampling candidates by cumulative probability. Use when the model and endpoint support it. |
tools | object[] | Conditional | Tool definitions available to the model. Tool types and parameter formats depend on the protocol and endpoint. |
tool_choice | object | Conditional | Controls tool selection. Use a forced or named choice only when the selected endpoint supports it. |
POST /v1/messages/count_tokens
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Required | Set the model ID to doubao-seed-2.1-turbo. |
messages | object[] | Required | Send user and assistant messages in order. Put system instructions in the top-level system field. |
messages[].content | string / object[] | Required | The message body. Use plain text or an array of content blocks defined by the protocol. |
system | string / object[] | Optional | System instructions as text or an array of text blocks. |
tools | object[] | Conditional | Tool definitions to include in the input token count. Send the same tools as in the Messages request. |
POST /v1/responses
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Required | Set the model ID to doubao-seed-2.1-turbo. |
input | string / object[] | Required | Input text or an ordered array of input items. Message items use role and content. |
instructions | string | Optional | Instructions describing the task and output requirements. |
max_output_tokens | integer | Optional | Caps output tokens. The accepted limit depends on the model and endpoint. |
stream | boolean | Optional | true requests an SSE stream. false requests a JSON response. Available modes depend on the endpoint. |
store | boolean | Conditional | Where supported, false requests that the response not be retained for later retrieval. |
text.format | object | Conditional | Set text.format for structured output, for example type: json_schema. Use only on endpoints that support the format. |
temperature | number | Conditional | Controls sampling randomness. Accepted values and whether the field takes effect depend on the model and endpoint. |
top_p | number | Conditional | Limits sampling candidates by cumulative probability. Use when the model and endpoint support it. |
tools | object[] | Conditional | Tool definitions available to the model. Tool types and parameter formats depend on the protocol and endpoint. |
tool_choice | string / object | Conditional | Controls tool selection. Use a forced or named choice only when the selected endpoint supports it. |
Request examples
Set your API key in the local ICODEEASY_API_KEY environment variable and choose an endpoint that accepts direct HTTP calls. For endpoints that require a specific client, follow that client’s setup guide.
Chat Completions
curl -sS 'https://api.icodeeasy.cc/v1/chat/completions' \
-H "Authorization: Bearer $ICODEEASY_API_KEY" \
-H 'Content-Type: application/json' \
--data '{
"model": "doubao-seed-2.1-turbo",
"messages": [
{
"role": "user",
"content": "Explain how a rainbow forms in one sentence."
}
],
"stream": false
}'
Anthropic Messages
curl -sS 'https://api.icodeeasy.cc/v1/messages' \
-H "x-api-key: $ICODEEASY_API_KEY" \
-H 'Content-Type: application/json' \
-H 'anthropic-version: 2023-06-01' \
--data '{
"model": "doubao-seed-2.1-turbo",
"max_tokens": 256,
"messages": [
{
"role": "user",
"content": "Explain how a rainbow forms in one sentence."
}
]
}'
Count Tokens
curl -sS 'https://api.icodeeasy.cc/v1/messages/count_tokens' \
-H "x-api-key: $ICODEEASY_API_KEY" \
-H 'Content-Type: application/json' \
-H 'anthropic-version: 2023-06-01' \
--data '{
"model": "doubao-seed-2.1-turbo",
"messages": [
{
"role": "user",
"content": "Explain how a rainbow forms in one sentence."
}
]
}'
OpenAI Responses
curl -N -sS 'https://api.icodeeasy.cc/v1/responses' \
-H "Authorization: Bearer $ICODEEASY_API_KEY" \
-H 'Content-Type: application/json' \
--data '{
"model": "doubao-seed-2.1-turbo",
"instructions": "You are a helpful assistant.",
"input": [
{
"type": "message",
"role": "user",
"content": [
{
"type": "input_text",
"text": "Explain how a rainbow forms in one sentence."
}
]
}
],
"stream": true,
"store": false
}'
Read the response
- Chat Completions · Read text from
choices[].message.content. In an SSE stream, incremental output appears inchoices[].delta. JSON · SSE - Anthropic Messages · Read blocks of type
textincontent[]. In a stream, process SSE content block events in order. JSON · SSE - Count Tokens · Read the input token count from
input_tokens. - OpenAI Responses · In a stream, append the
deltafields ofresponse.output_text.deltaevents and handle completion and failure events. SSE
Capabilities and limits
streaming· Supportedtool_calling· Conditional — Depends on the compatible protocol and request formatimage_input· Not publishedvideo_input· Not supported
Compatibility aliases and retired redirects
doubao-seed-2.0-pro→doubao-seed-2.1-turbo(Alias)
Model Capability Catalog · View pricing
Related guides
Doubao Seed 2.1 Turbo with Claude Code
Use an I Code Easy API key to configure Doubao Seed 2.1 Turbo in Claude Code on macOS, Linux or Windows. Verify requests and distinguish text from image and video models.
Chat Completions
Send a conversation using the OpenAI Chat format. Check that your model and selected endpoint support the Chat protocol before sending the request.
Anthropic Messages
Send a request in the Anthropic Messages format. This page covers direct HTTP calls, with Claude Code setup covered in the related guides.