Blue Whale APIBlue Whale API
Text Model API

OpenAI Responses

Call text models with the OpenAI Responses format

POST /v1/responses

An OpenAI Responses compatible endpoint, supporting both streaming and non-streaming, available to every text model in the model list.

Request Headers

NameRequiredDescription
AuthorizationYesBearer sk-xxx (API key created in the console, see Authentication)
Content-TypeYesapplication/json

Request Parameters

FieldTypeRequiredDefaultDescription
modelstringYes—Model identifier, see the model list
inputstring | arrayYes—Input content: either a plain string, or a {role, content} message array
max_output_tokensintNo—Maximum generated tokens (including reasoning tokens)
streamboolNofalseWhether to return SSE streaming output
temperaturenumberNo—Sampling temperature

Example

BASE_URL="https://yunjizi.cn"   # Domestic; overseas use https://api.yunjizi.cn

curl "$BASE_URL/v1/responses" \
  -H "Authorization: Bearer sk-YOUR-KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seed-2-1-pro-260915",
    "input": "Introduce yourself in one sentence",
    "max_output_tokens": 2048
  }'

Response

{
  "id": "resp_021789714808467846a816464a9af9c0791e0f68a2ce03cfda821",
  "object": "response",
  "created_at": 1789714808,
  "model": "doubao-seed-2-1-pro-260915",
  "status": "completed",
  "max_output_tokens": 2048,
  "service_tier": "default",
  "output": [
    {
      "type": "reasoning",
      "status": "completed",
      "summary": [
        {
          "type": "summary_text",
          "text": "The user wants a one-sentence self-introduction; I will describe my identity concisely."
        }
      ]
    },
    {
      "type": "message",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "I am Doubao, an AI assistant developed by ByteDance, here to help with questions, conversation, content creation and information lookup."
        }
      ]
    }
  ],
  "usage": {
    "input_tokens": 51,
    "output_tokens": 340,
    "total_tokens": 391,
    "input_tokens_details": { "cached_tokens": 0 },
    "output_tokens_details": { "reasoning_tokens": 308 }
  }
}

Response Fields

FieldDescription
statuscompleted for a normal finish; incomplete when it did not finish
incomplete_details.reasonWhy it did not finish; length means max_output_tokens was reached
outputArray of output items: the reply item has type message, the reasoning item has type reasoning
usage.input_tokensInput token count
usage.output_tokensOutput token count
usage.input_tokens_details.cached_tokensPortion of the input that hit the upstream prefix cache
usage.output_tokens_details.reasoning_tokensPortion of the output spent on reasoning

With a small budget, status will be incomplete with incomplete_details.reason: length, and output may contain only the reasoning item — reasoning used up the budget before any reply text was written. Keep max_output_tokens at 512 or above.

Streaming

With stream: true the endpoint returns SSE frames, each a pair of event: and data: lines. Event sequence: response.created → response.in_progress → response.output_item.added → delta events (reasoning uses response.reasoning_summary_text.delta, reply text uses response.output_text.delta) → response.output_item.done → response.completed (response.incomplete when it did not finish).

curl -N "$BASE_URL/v1/responses" \
  -H "Authorization: Bearer sk-YOUR-KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seed-2-1-pro-260915",
    "input": "Introduce yourself in one sentence",
    "stream": true
  }'

In streaming mode usage lives in response.usage of the response.completed (or response.incomplete) event.

Billing is settled from the usage object in the response; unit prices follow the official announcement.