Skip to content

Create response

OpenAI Responses API: used by Codex CLI and by GPT, Qwen, DeepSeek, Grok and other models; stateless, so send the full history every turn.

POST/v1/responses

OpenAI Responses-compatible endpoint; Codex CLI uses it. HopBase Responses is stateless: store is always false and previous_response_id is removed, so send the full input every turn in multi-turn conversations.

Fields not listed are forwarded as-is; for fields a model does not accept (such as DeepSeek's truncation and reasoning.summary), each model page says whether they are silently dropped. If a stream fails midway, it is reported as event: response.failed and the HTTP status stays 200.

Charged non-streaming responses return the actual charge for this request: the X-HopBase-Cost / X-HopBase-Cost-USD / X-HopBase-Currency headers, plus cost / cost_usd / currency in the top-level usage object of the body (existing usage fields are kept). cost_usd is the USD amount actually deducted from your balance; cost is the same charge in CNY, and currency is always CNY. Streaming (SSE) responses do not carry it; check Usage in the console. Uncharged responses, such as errors, carry neither. See Account API · Charges.

Headers

Authorization:requiredstring

Bearer sk-…: an API key created in the console under API keys; its group must include the requested model

Body parametersJSON

model:requiredstring

A model ID in the current key's group. Groups that support Responses: GPT (Codex, Azure), Qwen, DeepSeek (including US Region), GLM US Region, Grok, Kimi K3 Series Self-Hosted, Gemini Value (AI Studio / Vertex), and Gemini Official Direct (Enterprise). GLM-5.3, GLM-5.3 Flash, and the Kimi K3 Cloud group do not support it

input:requiredstring or array of object

A string is wrapped into a single user message automatically; a message array also works. Qwen content parts accept only input_text, input_image and input_file, not video

max_output_tokens:optionalinteger

Output cap. The gateway does not truncate or rewrite it; the limit follows the model's official spec

stream:optionalboolean

true returns a Responses SSE event stream; see Streaming events

Defaultfalse

tools:optionalarray of object

Tool definitions, forwarded as-is. Responses function tools are flat (name sits next to type), unlike Chat Completions

tool_choice:optionalstring or object

Forwarded as-is

reasoning:optionalobject

Reasoning config, forwarded as-is. Codex CLI's model_reasoning_effort is written here

service_tier:optionalstring

Only priority / flex are kept; other values are removed before forwarding. priority takes effect only in groups that support it and is billed at the Fast price; elsewhere the request runs on the standard tier at the standard price. The "GPT Official Direct (Azure)" group does not support priority

Valuespriorityflex

previous_response_id:optionalstring

Not supported: the gateway removes this field and does not continue the previous turn. For multi-turn conversations, include the full history in input

store:optionalfalse

Always false: responses are not stored server-side and cannot be retrieved by ID later

Defaultfalse

Returns

200Success. Non-streaming returns response JSON; with stream: true it returns SSE

Response headers

X-HopBase-Cost:optionalstring

The charge for this request in CNY (the same charge as X-HopBase-Cost-USD), up to 6 decimal places, such as 0.0816. Sent only when the request is charged; not sent on streaming (SSE) responses. When image generation takes longer than about 40 seconds the headers have already been sent, so read usage.cost in the body instead

X-HopBase-Cost-USD:optionalstring

The USD amount actually deducted from your balance for this request, the same amount as its usage record, up to 8 decimal places, such as 0.012; sent only together with X-HopBase-Cost

X-HopBase-Currency:optionalstring

The currency of X-HopBase-Cost, always CNY

id:optionalstring

Response ID (store is always false, so it cannot be retrieved by ID)

object:optional"response"
created_at:optionalinteger

Unix seconds

status:optionalstring

completed / incomplete / failed

model:optionalstring

Model ID

output:optionalarray of object

Output items: message, reasoning, function_call, etc.

usage:optionalobject

Token usage

error:optionalobject or null

Error on failure

Errors

400Unreadable request body or missing fields
401Missing, invalid or expired API key (missing_api_key / invalid_api_key / api_key_expired)
402Balance, or key / member / department quota, exhausted (insufficient_quota)
404The model is not in this key's group (model_not_found), or the path does not belong to the group (route_not_found)
413Request body over 60 MB (request_too_large)
429Account or key concurrency cap reached (user_concurrency_limit / apikey_concurrency_limit), with Retry-After
503If the message says the stateful session "can no longer be resumed", drop previous_response_id and start a new conversation

Related