BeeRoute logoBeeRoute.

Home / Docs / OpenAI Response Format (Responses)

OpenAI Response Format (Responses)

Official docs: Create a model response (API reference) · Streaming events · Migrate to Responses

📝 Introduction

The Responses API is the interface OpenAI recommends for all new projects (Chat Completions remains supported). A single endpoint covers text, image, and file input; text or JSON output; function calling; built-in tools (web search, file search, code interpreter, and more); reasoning controls; and multi-turn conversations. Coding agents such as Codex CLI use this endpoint too and can connect to BeeRoute directly.

  • Base URL: https://beeroute.ai/v1; this page covers POST https://beeroute.ai/v1/responses
  • Authentication: header Authorization: Bearer $API_KEY; keys look like sk-xxx and are created on the API keys page
  • Models and prices: see the pricing page

Before running the curl examples on this page, set your key in the terminal:

export API_KEY=sk-xxx

OpenAI models (such as gpt-5.6-terra and gpt-5.6-sol) support this endpoint natively. Other models (such as claude-sonnet-5-5 and glm-5.3) can also be called in Responses format through BeeRoute format conversion, but OpenAI built-in tools (web_search, file_search, code_interpreter, image_generation, computer, remote mcp, and so on) only work when the upstream is OpenAI.

Features that depend on upstream storage, such as previous_response_id, store, and conversation, depend on the upstream channel that actually serves the request and are not available for every model. The most reliable way to hold a multi-turn conversation is to resend the full history on every request (see the example below).

💡 Request Examples

The response examples below only illustrate the structure. Some fields are omitted, and IDs and token counts are placeholders; the actual API output is authoritative.

Basic Text ✅

curl https://beeroute.ai/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $API_KEY" \
  -d '{
    "model": "gpt-5.6-terra",
    "input": "Tell me a three-sentence bedtime story about a unicorn."
  }'

Example response:

{
  "id": "resp_68a1f2c3d4e5f6a7b8c9d0e1f2a3b4c5",
  "object": "response",
  "created_at": 1795766400,
  "status": "completed",
  "completed_at": 1795766403,
  "error": null,
  "incomplete_details": null,
  "instructions": null,
  "max_output_tokens": null,
  "model": "gpt-5.6-terra",
  "output": [
    {
      "type": "reasoning",
      "id": "rs_68a1f2c41a2b3c4d5e6f7a8b9c0d1e2f",
      "summary": [],
      "encrypted_content": "gAAAAABo...(truncated)"
    },
    {
      "type": "message",
      "id": "msg_68a1f2c55b6c7d8e9f0a1b2c3d4e5f6a",
      "status": "completed",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "Under a silver moon, a little unicorn named Luna found a lake that reflected every star in the sky. When she dipped her horn into the water, a glowing path appeared that led up into the night. She made a wish for every child still dreaming, then followed her sparkling hoofprints home to bed.",
          "annotations": [],
          "logprobs": []
        }
      ]
    }
  ],
  "parallel_tool_calls": true,
  "previous_response_id": null,
  "reasoning": {
    "effort": "medium",
    "summary": null
  },
  "store": true,
  "temperature": 1.0,
  "text": {
    "format": {
      "type": "text"
    },
    "verbosity": "medium"
  },
  "tool_choice": "auto",
  "tools": [],
  "top_p": 1.0,
  "truncation": "disabled",
  "usage": {
    "input_tokens": 21,
    "input_tokens_details": {
      "cached_tokens": 0,
      "cache_write_tokens": 0
    },
    "output_tokens": 156,
    "output_tokens_details": {
      "reasoning_tokens": 64
    },
    "total_tokens": 177
  },
  "user": null,
  "metadata": {}
}

Do not assume output[0] is the answer: reasoning models usually return a reasoning item before the message item. Iterate over output and read output_text from the item whose type is message.

System Instructions (instructions) ✅

curl https://beeroute.ai/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $API_KEY" \
  -d '{
    "model": "gpt-5.6-terra",
    "instructions": "You are a concise technical assistant. Keep every answer under 50 words.",
    "input": "What is idempotency in HTTP?"
  }'

instructions works like a system (developer) message inserted at the start of the context. The response has the same structure as the basic text example. When used with previous_response_id, the previous turn's instructions are not carried over, so pass them again on every request.

Image Input ✅

curl https://beeroute.ai/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $API_KEY" \
  -d '{
    "model": "gpt-5.6-terra",
    "input": [
      {
        "role": "user",
        "content": [
          {"type": "input_text", "text": "Describe what is in this image."},
          {
            "type": "input_image",
            "image_url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg",
            "detail": "auto"
          }
        ]
      }
    ]
  }'

image_url can be a public URL or a base64 data URL (for example data:image/png;base64,...). BeeRoute does not provide a Files upload endpoint, so file_id can only reference files that already exist in the upstream account; use image_url in most cases.

Streaming ✅

curl https://beeroute.ai/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $API_KEY" \
  -d '{
    "model": "gpt-5.6-terra",
    "input": "Hello!",
    "stream": true
  }'

Example stream (SSE; the response objects are trimmed for readability, and lines starting with : are SSE comments):

event: response.created
data: {"type":"response.created","sequence_number":0,"response":{"id":"resp_68a1f3d0e1f2a3b4c5d6e7f8a9b0c1d2","object":"response","created_at":1795766400,"status":"in_progress","model":"gpt-5.6-terra","output":[],"usage":null}}

event: response.in_progress
data: {"type":"response.in_progress","sequence_number":1,"response":{"id":"resp_68a1f3d0e1f2a3b4c5d6e7f8a9b0c1d2","object":"response","created_at":1795766400,"status":"in_progress","model":"gpt-5.6-terra","output":[],"usage":null}}

event: response.output_item.added
data: {"type":"response.output_item.added","sequence_number":2,"output_index":0,"item":{"id":"rs_68a1f3d11a2b3c4d5e6f7a8b9c0d1e2f","type":"reasoning","summary":[]}}

event: response.output_item.done
data: {"type":"response.output_item.done","sequence_number":3,"output_index":0,"item":{"id":"rs_68a1f3d11a2b3c4d5e6f7a8b9c0d1e2f","type":"reasoning","summary":[],"encrypted_content":"gAAAAABo..."}}

event: response.output_item.added
data: {"type":"response.output_item.added","sequence_number":4,"output_index":1,"item":{"id":"msg_68a1f3d25b6c7d8e9f0a1b2c3d4e5f6a","type":"message","status":"in_progress","role":"assistant","content":[]}}

event: response.content_part.added
data: {"type":"response.content_part.added","sequence_number":5,"item_id":"msg_68a1f3d25b6c7d8e9f0a1b2c3d4e5f6a","output_index":1,"content_index":0,"part":{"type":"output_text","text":"","annotations":[],"logprobs":[]}}

event: response.output_text.delta
data: {"type":"response.output_text.delta","sequence_number":6,"item_id":"msg_68a1f3d25b6c7d8e9f0a1b2c3d4e5f6a","output_index":1,"content_index":0,"delta":"Hello!","logprobs":[]}

: intermediate delta events omitted

event: response.output_text.done
data: {"type":"response.output_text.done","sequence_number":9,"item_id":"msg_68a1f3d25b6c7d8e9f0a1b2c3d4e5f6a","output_index":1,"content_index":0,"text":"Hello! How can I help you today?","logprobs":[]}

event: response.content_part.done
data: {"type":"response.content_part.done","sequence_number":10,"item_id":"msg_68a1f3d25b6c7d8e9f0a1b2c3d4e5f6a","output_index":1,"content_index":0,"part":{"type":"output_text","text":"Hello! How can I help you today?","annotations":[],"logprobs":[]}}

event: response.output_item.done
data: {"type":"response.output_item.done","sequence_number":11,"output_index":1,"item":{"id":"msg_68a1f3d25b6c7d8e9f0a1b2c3d4e5f6a","type":"message","status":"completed","role":"assistant","content":[{"type":"output_text","text":"Hello! How can I help you today?","annotations":[],"logprobs":[]}]}}

event: response.completed
data: {"type":"response.completed","sequence_number":12,"response":{"id":"resp_68a1f3d0e1f2a3b4c5d6e7f8a9b0c1d2","object":"response","created_at":1795766400,"status":"completed","model":"gpt-5.6-terra","output":[{"id":"rs_68a1f3d11a2b3c4d5e6f7a8b9c0d1e2f","type":"reasoning","summary":[],"encrypted_content":"gAAAAABo..."},{"id":"msg_68a1f3d25b6c7d8e9f0a1b2c3d4e5f6a","type":"message","status":"completed","role":"assistant","content":[{"type":"output_text","text":"Hello! How can I help you today?","annotations":[],"logprobs":[]}]}],"usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0,"cache_write_tokens":0},"output_tokens":28,"output_tokens_details":{"reasoning_tokens":16},"total_tokens":40}}}

Every event carries an increasing sequence_number. The stream ends with a response.completed event (or response.incomplete / response.failed). See "Streaming Events" below for the full list.

Function Calling ✅

Step 1: Declare the tool; the model returns a function_call.

curl https://beeroute.ai/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $API_KEY" \
  -d '{
    "model": "gpt-5.6-terra",
    "input": "What is the weather like in Shanghai today?",
    "tools": [
      {
        "type": "function",
        "name": "get_weather",
        "description": "Get the current weather for a city",
        "parameters": {
          "type": "object",
          "properties": {
            "city": {"type": "string", "description": "City name, e.g. Shanghai"},
            "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}
          },
          "required": ["city", "unit"],
          "additionalProperties": false
        },
        "strict": true
      }
    ],
    "tool_choice": "auto"
  }'

Example response (excerpt):

{
  "id": "resp_68a1f4e0a1b2c3d4e5f6a7b8c9d0e1f2",
  "object": "response",
  "status": "completed",
  "model": "gpt-5.6-terra",
  "output": [
    {
      "type": "reasoning",
      "id": "rs_68a1f4e11a2b3c4d5e6f7a8b9c0d1e2f",
      "summary": [],
      "encrypted_content": "gAAAAABo...(truncated)"
    },
    {
      "type": "function_call",
      "id": "fc_68a1f4e25b6c7d8e9f0a1b2c3d4e5f6a",
      "call_id": "call_Q8xH2kLm3nP4",
      "name": "get_weather",
      "arguments": "{\"city\":\"Shanghai\",\"unit\":\"celsius\"}",
      "status": "completed"
    }
  ]
}

Step 2: Run the function in your code, then send the call and its result back in input (the call_id of function_call_output must match the one the model returned):

curl https://beeroute.ai/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $API_KEY" \
  -d '{
    "model": "gpt-5.6-terra",
    "input": [
      {"role": "user", "content": "What is the weather like in Shanghai today?"},
      {
        "type": "function_call",
        "call_id": "call_Q8xH2kLm3nP4",
        "name": "get_weather",
        "arguments": "{\"city\":\"Shanghai\",\"unit\":\"celsius\"}"
      },
      {
        "type": "function_call_output",
        "call_id": "call_Q8xH2kLm3nP4",
        "output": "{\"temperature\":18,\"condition\":\"cloudy\"}"
      }
    ],
    "tools": [
      {
        "type": "function", "name": "get_weather", "description": "Get the current weather for a city", "strict": true,
        "parameters": {
          "type": "object",
          "properties": {"city": {"type": "string", "description": "City name, e.g. Shanghai"}, "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}},
          "required": ["city", "unit"], "additionalProperties": false
        }
      }
    ]
  }'

The model then returns the final answer based on the function result (a message item).

The officially recommended approach is to append every item from the step 1 output (including the reasoning item and its encrypted_content) to input unchanged, which preserves the reasoning context. For brevity, the example only sends back the function_call without its id; if you send back items that carry an id, include the reasoning item that precedes them as well. A single response may contain several function_call items, and each one needs its own function_call_output.

Structured Output ✅

curl https://beeroute.ai/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $API_KEY" \
  -d '{
    "model": "gpt-5.6-terra",
    "input": "Extract the event: Alice and Bob will review the release plan in meeting room 3 at 3 PM on Friday.",
    "text": {
      "format": {
        "type": "json_schema",
        "name": "calendar_event",
        "strict": true,
        "schema": {
          "type": "object",
          "properties": {
            "title": {"type": "string"},
            "time": {"type": "string"},
            "participants": {"type": "array", "items": {"type": "string"}}
          },
          "required": ["title", "time", "participants"],
          "additionalProperties": false
        }
      }
    }
  }'

Example response (the message item in output):

{
  "type": "message",
  "id": "msg_68a1f5a05b6c7d8e9f0a1b2c3d4e5f6a",
  "status": "completed",
  "role": "assistant",
  "content": [
    {
      "type": "output_text",
      "text": "{\"title\":\"Release plan review\",\"time\":\"Friday 15:00\",\"participants\":[\"Alice\",\"Bob\"]}",
      "annotations": [],
      "logprobs": []
    }
  ]
}

output_text.text is a JSON string that matches the schema; parse it yourself. If the model refuses for safety reasons, content contains a refusal part instead of JSON.

Reasoning ✅

curl https://beeroute.ai/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $API_KEY" \
  -d '{
    "model": "gpt-5.6-terra",
    "input": "A three-digit number has digits that sum to 14. The hundreds digit is 2 more than the units digit, and the tens digit is twice the units digit. What is the number?",
    "reasoning": {
      "effort": "high",
      "summary": "auto"
    }
  }'

Example response (excerpt):

{
  "id": "resp_68a1f6b0a1b2c3d4e5f6a7b8c9d0e1f2",
  "object": "response",
  "status": "completed",
  "model": "gpt-5.6-terra",
  "output": [
    {
      "type": "reasoning",
      "id": "rs_68a1f6b11a2b3c4d5e6f7a8b9c0d1e2f",
      "summary": [
        {
          "type": "summary_text",
          "text": "**Setting up the equations**\n\nLet the units digit be x, so the hundreds digit is x+2 and the tens digit is 2x. From (x+2)+2x+x=14 we get x=3, so the digits are 5, 6 and 3."
        }
      ],
      "encrypted_content": "gAAAAABo...(truncated)"
    },
    {
      "type": "message",
      "id": "msg_68a1f6b25b6c7d8e9f0a1b2c3d4e5f6a",
      "status": "completed",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "The number is 563. Check: 5+6+3=14, 5 is 2 more than 3, and 6 is twice 3.",
          "annotations": [],
          "logprobs": []
        }
      ]
    }
  ],
  "reasoning": {
    "effort": "high",
    "summary": "auto"
  },
  "usage": {
    "input_tokens": 52,
    "input_tokens_details": {
      "cached_tokens": 0,
      "cache_write_tokens": 0
    },
    "output_tokens": 612,
    "output_tokens_details": {
      "reasoning_tokens": 548
    },
    "total_tokens": 664
  }
}

The supported reasoning.effort values and the default depend on the model. Reasoning summaries are only returned when reasoning.summary is set. output_tokens already includes reasoning_tokens, and reasoning tokens are billed as output.

Web Search ✅

curl https://beeroute.ai/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $API_KEY" \
  -d '{
    "model": "gpt-5.6-terra",
    "input": "According to the official OpenAI docs, what is the default value of the store parameter in the Responses API? Cite your source.",
    "tools": [
      {
        "type": "web_search",
        "filters": {"allowed_domains": ["developers.openai.com"]},
        "search_context_size": "medium",
        "user_location": {"type": "approximate", "country": "US", "timezone": "America/Los_Angeles"}
      }
    ],
    "include": ["web_search_call.action.sources"]
  }'

Example response (excerpt):

{
  "id": "resp_68a1f7c0a1b2c3d4e5f6a7b8c9d0e1f2",
  "object": "response",
  "status": "completed",
  "model": "gpt-5.6-terra",
  "output": [
    {
      "type": "web_search_call",
      "id": "ws_68a1f7c11a2b3c4d5e6f7a8b9c0d1e2f",
      "status": "completed",
      "action": {
        "type": "search",
        "query": "OpenAI Responses API store parameter default",
        "sources": [
          {
            "type": "url",
            "url": "https://developers.openai.com/api/reference/resources/responses/methods/create"
          }
        ]
      }
    },
    {
      "type": "message",
      "id": "msg_68a1f7c25b6c7d8e9f0a1b2c3d4e5f6a",
      "status": "completed",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "According to the OpenAI API reference, the `store` parameter defaults to true: generated responses are stored for later retrieval via the API, and the data is kept for at least 30 days (subject to data retention exceptions).",
          "annotations": [
            {
              "type": "url_citation",
              "start_index": 0,
              "end_index": 224,
              "url": "https://developers.openai.com/api/reference/resources/responses/methods/create",
              "title": "Create a model response | OpenAI API Reference"
            }
          ],
          "logprobs": []
        }
      ]
    }
  ]
}

Built-in tools such as web search are executed by OpenAI and only work when the upstream is OpenAI. Built-in tool calls may be charged per call on top of tokens; see the pricing page. New integrations should use the GA tool {"type": "web_search"}; the older web_search_preview does not support filters.

Multi-turn Conversations ✅

Option 1 (recommended): resend the full history every time. This does not depend on upstream storage and works with every model:

curl https://beeroute.ai/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $API_KEY" \
  -d '{
    "model": "gpt-5.6-terra",
    "input": [
      {"role": "user", "content": "Suggest a name for my orange cat."},
      {"role": "assistant", "content": "How about Pumpkin or Marmalade?"},
      {"role": "user", "content": "Give me a few shorter names."}
    ]
  }'

With reasoning models, append every item from the previous output (reasoning, message, and so on) to input unchanged instead of resending only the text; for gpt-5.3-codex and later models, keep the phase field on assistant messages you send back. When a conversation gets long, compact the context with context_management or POST /v1/responses/compact.

Option 2: use previous_response_id. Send only the new turn and let the upstream continue from the stored previous response:

curl https://beeroute.ai/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $API_KEY" \
  -d '{
    "model": "gpt-5.6-terra",
    "previous_response_id": "resp_68a1f2c3d4e5f6a7b8c9d0e1f2a3b4c5",
    "input": "Give me a few shorter names."
  }'

previous_response_id depends on upstream storage: the previous turn must be an OpenAI response created with store set to true, and the same upstream must be able to find it, otherwise the request fails. Models served through format conversion (non-OpenAI models) usually do not support it. Even with previous_response_id, the input tokens of all earlier turns in the chain are still billed as input tokens. It cannot be combined with conversation.

📮 Request

Endpoint

POST https://beeroute.ai/v1/responses

Creates a model response. BeeRoute also provides:

EndpointDescription
POST /v1/responses/compactStateless compaction of a long conversation: send the full context (model, input, instructions, and so on) and get back an object whose object is response.compaction; pass its output unchanged as the input of your next /v1/responses request. Streaming is not supported. See the official compact reference for parameters.

BeeRoute does not provide the retrieve, delete, or cancel endpoints for responses (GET/DELETE /v1/responses/{id}, /cancel, /input_items, /input_tokens).

Authentication

Authorization: Bearer $API_KEY

Request Body Parameters

The commonly used parameters are listed below. For every field and the latest definitions, see the official API reference.

Basic Parameters

ParameterTypeDescription
modelstringRequired on BeeRoute. Model ID, such as gpt-5.6-terra. It is optional in the OpenAI spec (it can come from prompt), but BeeRoute needs it to route the request and bill it.
inputstring or arrayModel input. A string is equivalent to one text message with the user role; an array is a list of input items (see "Input Item Types"). Optional in the spec (context can also come from prompt, conversation, or previous_response_id).
instructionsstring or nullA system (developer) message inserted at the start of the context. When used with previous_response_id, the previous turn's instructions are not carried over.
streamboolean or nullDefault false. When true, the response is streamed as SSE.
stream_optionsobject or nullSet only when stream: true. Its include_obfuscation field is filtered by BeeRoute by default, so the upstream default applies.
max_output_tokensinteger or nullUpper bound on the tokens generated for the response, including visible output and reasoning tokens. Minimum 16.
temperaturenumber or nullSampling temperature, 0–2, default 1. Adjust this or top_p, but not both.
top_pnumber or nullNucleus sampling, 0–1, default 1.
top_logprobsinteger or null0–20, the number of most likely tokens (with log probabilities) to return at each token position.
metadataobject or nullUp to 16 key-value pairs; keys up to 64 characters, values up to 512 characters.
includearray or nullAdditional data to return; see the table below.
textobjectText output configuration (format, verbosity); see below.
reasoningobject or nullReasoning configuration (effort, summary, and more); see below.
toolsarrayTools the model may call; see "Tools Overview".
tool_choicestring or objectHow the model selects tools; see below.
parallel_tool_callsboolean or nullWhether the model may run tool calls in parallel. Default true.
max_tool_callsinteger or nullMaximum total number of built-in tool calls in one response (across all built-in tools); further calls by the model are ignored.
promptobject or nullReference to a prompt template: id, variables, version. Templates belong to the upstream OpenAI account and usually cannot be used through BeeRoute.

State, Caching, and Safety Parameters

ParameterTypeDescription
storeboolean or nullWhether the upstream stores the response for later retrieval. Default true (kept for at least 30 days, with exceptions). BeeRoute forwards it unchanged by default.
previous_response_idstring or nullID of the previous response, used to chain multi-turn conversations. Cannot be used together with conversation. ⚠️ Depends on upstream storage and is not available for every model.
conversationstring or object or nullThe conversation this response belongs to (a conversation ID or {"id": "..."}). Items from the conversation are prepended to this request's input, and this turn's input and output are added to the conversation when it completes. ⚠️ Conversations are created with the OpenAI Conversations API, which BeeRoute does not provide, so this is generally unavailable.
context_managementarray or nullServer-side context compaction, for example [{"type": "compaction", "compact_threshold": 200000}] (compact_threshold minimum 1000). When the rendered token count crosses the threshold, the upstream compacts the context and the output includes an encrypted compaction item.
prompt_cache_keystring or nullPrompt cache bucketing key that improves cache hit rates; replaces the caching role of the user field.
prompt_cache_optionsobjectPrompt caching options (gpt-5.6 and later models): mode (implicit by default, or explicit), ttl (30m by default, or 12h), prewarm, comparison_response_id.
moderationobject or nullRuns moderation on input and output: model (such as omni-moderation-latest), with policy.input.mode / policy.output.mode set to score or block.
safety_identifierstring or nullA stable ID for your end user (up to 128 characters; hashing is recommended), used to detect policy violations. BeeRoute does not forward it upstream by default.
service_tierstring or nullOpenAI values: auto, default, flex, scale, priority, fast, ultrafast. BeeRoute filters this parameter by default, so it normally has no effect.

Deprecated Parameters

ParameterDescription
userBeing replaced by safety_identifier and prompt_cache_key; use prompt_cache_key for caching optimizations.
truncationauto or disabled (default). auto: if the input exceeds the context window, items are dropped from the beginning of the conversation; disabled: the request fails with a 400 error. The spec marks it as deprecated; for long conversations use context_management or /v1/responses/compact instead.
prompt_cache_retentionin_memory or 24h. Deprecated; use prompt_cache_options.ttl.
reasoning.generate_summaryDeprecated; use reasoning.summary. BeeRoute does not forward this field.
reasoning.encrypted_content in includeReasoning items now include encrypted_content by default. The value is still accepted but no longer required.

Parameters BeeRoute Does Not Forward

background, background_options, access_programs, and image (request-level image options) are currently not forwarded upstream and are ignored if sent. As a result, background mode (and the related queued status and cancellation) is not available on BeeRoute.

include Values

ValueDescription
web_search_call.action.sourcesInclude the sources used by web search calls
web_search_call.resultsInclude the results of web search calls
code_interpreter_call.outputsInclude the outputs of Python code run by the code interpreter
computer_call_output.output.image_urlInclude image URLs from computer call outputs
file_search_call.resultsInclude the search results of file search calls
message.input_image.image_urlInclude image URLs from input messages
message.output_text.logprobsInclude logprobs with assistant messages
reasoning.encrypted_contentInclude encrypted reasoning content in reasoning items (now returned by default)

reasoning Object

FieldDescription
effortReasoning effort: none, minimal, low, medium, high, xhigh, max. Supported values and the default depend on the model (the gpt-5.6 family defaults to medium); some models return 400 for unsupported values.
summaryReasoning summary: auto, concise, detailed. When set, the summary appears in the summary of the reasoning output item; when omitted, no summary is returned.
modeExecution mode: standard (default) or pro; supported by the GPT-5.6 and GPT-6 families.
contextWhether reasoning from earlier turns is rendered to the model on later turns: auto, current_turn, all_turns. The gpt-5.6 family defaults to all_turns; earlier models default to current_turn.

text Object

FieldDescription
formatOutput format, default {"type": "text"}. Set json_schema to enable Structured Outputs. {"type": "json_object"} is the older JSON mode: you must explicitly ask for JSON in the prompt, and it is not recommended for models that support json_schema.
verbosityResponse verbosity: low, medium (default), high.

Fields when format is json_schema:

FieldRequiredDescription
typeYesAlways json_schema
nameYesFormat name; only a-z, A-Z, 0-9, underscores, and dashes, up to 64 characters
schemaYesThe JSON Schema the output must follow
descriptionNoWhat the format is for, which helps the model decide how to respond
strictNoDefault false. When true, the output strictly follows the schema (only a subset of JSON Schema is supported). Recommended

tool_choice

ValueDescription
"auto"The model decides whether to reply with a message or call tools
"none"The model calls no tools and replies with a message
"required"The model must call one or more tools
{"type": "function", "name": "get_weather"}Force a call to a specific function
{"type": "custom", "name": "..."}Force a call to a specific custom tool
{"type": "mcp", "server_label": "...", "name": "..."}Force a call to a tool on a specific MCP server (name is optional)
{"type": "allowed_tools", "mode": "auto", "tools": [...]}Restrict the available tools to the subset listed in tools; mode is auto or required
{"type": "file_search"} and other built-in tool typesForce a built-in tool; type can be file_search, web_search_preview, web_search_preview_2025_03_11, computer, computer_use_preview, computer_use, code_interpreter, image_generation
{"type": "apply_patch"} or {"type": "shell"}Force a call to the apply_patch or shell tool

Input Item Types

When input is an array, each item can be a message, an output item from a previous turn, or a tool result.

Message (type can be omitted and defaults to message):

FieldDescription
roleuser, assistant, system, or developer. developer/system instructions take precedence over user
contentA string, or an array of content parts (see below)
phaseAssistant messages only: commentary (intermediate) or final_answer. Keep it when sending messages back to gpt-5.3-codex and later models

Content types:

TypeFields
input_texttext: the text content
input_imageimage_url (public URL or base64 data URL), file_id, detail (low, high, auto by default, original)
input_filefile_data (base64 data URL, such as data:application/pdf;base64,...), file_url, file_id, filename, detail (auto by default, low, high)

Each content part can also carry prompt_cache_breakpoint ({"mode": "explicit", "ttl": "30m"}) to explicitly mark a reusable prompt prefix. BeeRoute does not provide a Files endpoint, so file_id can only reference files that already exist in the upstream account.

Other input items:

TypePurpose
message (assistant output)A message the model produced in a previous turn, sent back unchanged
reasoningA reasoning item from a previous turn (with encrypted_content); sending it back preserves the reasoning context
function_callA function call the model made in a previous turn
function_call_outputThe function result: call_id plus output (a string, or an array of input_text/input_image/input_file)
custom_tool_call / custom_tool_call_outputA custom tool call and its result
computer_call_outputThe screenshot sent back after running a computer action
mcp_approval_responseThe answer to an MCP approval request
shell_call_output / local_shell_call_output / apply_patch_call_outputResults sent back after the client runs shell or apply_patch operations (used by coding agents)
compactionAn encrypted compacted-context item, sent back unchanged
compaction_triggerRequests compaction of the current context; must be the last input item
item_referenceReferences a stored item by ID (depends on upstream storage)

Tools Overview

TypeDescriptionOn BeeRoute
functionA function in your own code. The model returns a function_call; you run it and send back a function_call_outputAny model that supports tool calling
customA custom tool with free-form text input (the format can be constrained with a grammar); the model returns a custom_tool_callOpenAI models
web_search (or web_search_2025_08_26)Web search (GA)OpenAI upstream only
web_search_previewThe older preview search tool; use web_search for new integrationsOpenAI upstream only
file_searchSearches files in vector stores; requires vector_store_idsOpenAI upstream only, and the vector stores must exist in the upstream account
code_interpreterRuns Python code in a containerOpenAI upstream only
image_generationGenerates or edits images with GPT Image modelsOpenAI upstream only
mcpAdds tools from remote MCP servers or connectorsOpenAI upstream only
computerComputer use (GA; the older version is computer_use_preview). The model returns a computer_call; your environment runs the action and sends back a screenshotOpenAI upstream only
shell / local_shell / apply_patchRun shell commands and edit files with diffs; used by coding agents such as CodexOpenAI models
tool_search / namespaceDefer loading of large tool sets (with defer_loading) and group tools under namespacesOpenAI models (tool_search requires gpt-5.4 or later)

function tool fields:

FieldDescription
typeAlways function
nameThe function name
descriptionWhat the function does; the model uses it to decide whether to call the function
parametersA JSON Schema describing the parameters
stricttrue: arguments strictly follow the schema; every object must set additionalProperties: false and list all properties in required (express optional fields with a type that includes null). Omitted: Responses tries to normalize the schema into strict mode and falls back to non-strict when it cannot (the tool then shows strict: false in the response). false: non-strict, best-effort
defer_loadingWhether the function is deferred (used with tool_search)

web_search tool fields:

FieldDescription
typeweb_search or web_search_2025_08_26
filters.allowed_domainsDomains the search may use (subdomains included); all domains are allowed when omitted
search_context_sizeHow much context the search uses: low, medium (default), high
user_locationApproximate location: type (approximate), city, country (two-letter ISO code), region, timezone (IANA). When omitted or null it defaults to the United States; send just {"type": "approximate"} to avoid that fallback
external_web_accessDefault true; when false, only offline/cached content is used and no new pages are fetched

📥 Response

Response Object

FieldDescription
idResponse ID, starting with resp_
objectAlways response
created_atCreation time (Unix seconds)
completed_atCompletion time (Unix seconds); may be null
statusResponse status; see the table below
modelThe model used to generate the response
outputArray of output items; see "Output Items"
usageToken usage; see "usage"
errorAn error object (code, message) when generation fails; otherwise null
incomplete_detailsWhy the response is incomplete (reason); otherwise null
service_tierThe service tier actually used
tool_usageUsage reported by built-in tools (image_gen, web_search); may be omitted
instructions, max_output_tokens, max_tool_calls, temperature, top_p, top_logprobs, parallel_tool_calls, tool_choice, tools, text, reasoning, truncation, metadata, store, previous_response_id, conversation, prompt, prompt_cache_key, safety_identifier, userEcho the parameters that took effect for this request

response.output_text in the official Python / JavaScript SDKs is an SDK convenience property that joins all output_text parts; the raw HTTP response does not necessarily contain it. When calling over HTTP, iterate over output.

status

ValueDescription
completedGeneration finished
in_progressGeneration is in progress (seen during streaming)
incompleteGeneration did not finish; see incomplete_details.reason
failedGeneration failed; see error
queuedQueued (background mode, not provided by BeeRoute)
cancelledCancelled (background mode, not provided by BeeRoute)

incomplete_details.reason can be max_output_tokens (the max_output_tokens limit was reached), content_filter (content was filtered), max_messages, or steered (stopped after steering in WebSocket mode).

Output Items

typeDescription
messageThe model reply: id, role (assistant), status, content, and possibly phase
reasoningReasoning item: id, summary (array of summary_text), encrypted_content (returned by default; when streaming, use the complete value from response.output_item.done), optional content (reasoning_text)
function_callFunction call: id, call_id, name, arguments (JSON string), status
custom_tool_callCustom tool call: call_id, name, input
web_search_callWeb search: status, action (search, open_page, or find_in_page)
file_search_callFile search: queries, status, results
code_interpreter_callCode interpreter execution record
image_generation_callImage generation result (result is a base64 image)
computer_callA computer action for you to run
mcp_call / mcp_list_tools / mcp_approval_requestMCP tool call, tool list, and approval request
shell_call / local_shell_call / apply_patch_callShell or patch operations for the client to run
tool_search_call / tool_search_outputThe tool search process
compactionEncrypted compacted context

Each part in message.content is either output_text (text, annotations, logprobs) or refusal (refusal: the refusal explanation).

annotation types:

TypeFields
url_citationurl, title, start_index, end_index (character positions of the citation in the text)
file_citationfile_id, filename, index (the position in the output text where the citation is inserted)
container_file_citationcontainer_id, file_id, filename, start_index, end_index
file_pathfile_id, index

usage

FieldDescription
input_tokensNumber of input tokens
input_tokens_details.cached_tokensInput tokens served from the prompt cache
input_tokens_details.cache_write_tokensInput tokens written to the cache
input_tokens_details.cache_write_tokens_detailsOptional breakdown by cache lifetime: ttl_30m_tokens, ttl_12h_tokens
output_tokensNumber of output tokens (reasoning tokens included)
output_tokens_details.reasoning_tokensNumber of reasoning tokens
total_tokensTotal number of tokens

For non-OpenAI models served through format conversion, the detail fields may be 0 or missing.

Streaming Events

With stream: true the response is returned as SSE. Each event has an event: line and a data: line, and every data payload contains a type and an increasing sequence_number. The main events are listed below; see the official streaming events reference for the full list.

EventDescription
response.createdThe response was created
response.in_progressThe response is being generated
response.output_item.added / response.output_item.doneAn output item was added / finished (item, output_index)
response.content_part.added / response.content_part.doneA content part was added / finished
response.output_text.deltaText delta (delta, logprobs)
response.output_text.doneText finished (text, logprobs)
response.output_text.annotation.addedA citation annotation was added
response.refusal.delta / response.refusal.doneRefusal text delta / finished
response.function_call_arguments.delta / response.function_call_arguments.doneFunction argument delta / finished (arguments)
response.reasoning_summary_part.added / response.reasoning_summary_part.doneA reasoning summary part was added / finished
response.reasoning_summary_text.delta / response.reasoning_summary_text.doneReasoning summary text delta / finished
response.web_search_call.in_progress / .searching / .completedWeb search progress
response.completedThe response finished; response contains the full output and usage
response.incompleteThe response ended incomplete
response.failedThe response failed
errorAn error occurred (code, message, param)

Delta events such as text deltas may carry an obfuscation field (upstream stream-obfuscation padding); clients can ignore it.

⚠️ Errors

Errors raised by the BeeRoute gateway itself (invalid key, insufficient balance, no available channel, and so on) use an OpenAI-style error body with type set to new_api_error. The message ends with a request ID; include it when contacting support:

{
  "error": {
    "code": "",
    "message": "Invalid token (request id: 20261127080000123456789a1b2c3d4Xy7Kp2Qm)",
    "type": "new_api_error"
  }
}
HTTP statusCommon causes
400Malformed request, for example a missing model
401Invalid API key, or the key is disabled, expired, or out of key quota
403Insufficient account balance (code is insufficient_user_quota), or the key cannot use this model / group
429Too many requests (gateway or upstream rate limit)
503No available channel for this model in the current group (code is model_not_found)
5xxUpstream service error

Errors returned by the upstream are passed through in OpenAI error format (message, type, param, code). If a request is accepted but generation fails, the response status is failed and the reason is in error.code and error.message; streaming requests receive a response.failed or error event instead.

Last updated 2026-11-29 · Markdown source · llms.txt