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.
/v1/responsesOpenAI 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
Bearer sk-…: an API key created in the console under API keys; its group must include the requested model
Body parametersJSON
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
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
user / assistant / system / developer
A string or an array of content parts
Output cap. The gateway does not truncate or rewrite it; the limit follows the model's official spec
true returns a Responses SSE event stream; see Streaming events
Defaultfalse
Tool definitions, forwarded as-is. Responses function tools are flat (name sits next to type), unlike Chat Completions
function, or a server-side tool type the model supports
Function name
What the function does
JSON Schema for the parameters
Forwarded as-is
Reasoning config, forwarded as-is. Codex CLI's model_reasoning_effort is written here
GPT: low / medium / high / xhigh; higher effort thinks longer and uses more tokens. grok-4.20-multi-agent-0309 uses it to set the number of collaborating agents
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
Not supported: the gateway removes this field and does not continue the previous turn. For multi-turn conversations, include the full history in input
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
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
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
The currency of X-HopBase-Cost, always CNY
Response ID (store is always false, so it cannot be retrieved by ID)
Unix seconds
completed / incomplete / failed
Model ID
Output items: message, reasoning, function_call, etc.
message / reasoning / function_call
assistant for message
Content parts of a message
output_text
Output text
function_call: function name
function_call: arguments as a JSON string
function_call: referenced when returning the result
Token usage
Input tokens
Output tokens, including reasoning tokens
Total
Of which reasoning tokens
Added by the gateway: the charge for this request in CNY (the same charge as cost_usd), the same as the X-HopBase-Cost header; not returned when streaming
Added by the gateway: the USD amount actually deducted from your balance, the same as the X-HopBase-Cost-USD header and your usage record; not returned when streaming
Added by the gateway: the currency of cost, always CNY
Error on failure
Errors
missing_api_key / invalid_api_key / api_key_expired)insufficient_quota)model_not_found), or the path does not belong to the group (route_not_found)request_too_large)user_concurrency_limit / apikey_concurrency_limit), with Retry-Afterprevious_response_id and start a new conversation