Create Response

View as Markdown
Creates a model response using the OpenAI Responses protocol. Create-only and stateless: replay `input` every turn, and omit `store` or pass `false` (OpenAI SDKs default it to `true`, which is `400`). Same models, auth, beta gate, and quota as [`POST /v2/chat/completions`](/api-reference/open-source/chat-completions).

Authentication

api-subscription-keystring
API Key authentication via header
OR
AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Request

This endpoint expects an object.
modelenumRequired

Model IDs accepted by POST /v2/chat/completions and POST /v2/responses:

  • sarvam-105b — Sarvam flagship chat model.
  • glm5.3 — open-source; 1M context, tool calling, visible reasoning.
  • gemma4 — open-source; image input, tool calling.
  • deepseekv4-flash — open-source; 1M context, tool calling, reasoning.

GET /v2/models is environment-specific and may omit IDs that completions still accept. A model whose backend has no /v1/responses route fails POST /v2/responses with 502.

inputstring or list of objectsRequired

A prompt string, or the conversation so far as a list of items. Replay the full list on every request — this endpoint does not store prior turns. Items with role are messages (user, assistant, system, developer). item_reference is 400. Other items (function_call, function_call_output, reasoning, and later protocol types) are forwarded verbatim.

streamboolean or nullOptionalDefaults to false

If true, the reply is streamed as named server-sent events. There is no [DONE] sentinel — the stream ends on response.completed, response.incomplete, or response.failed.

max_output_tokensinteger or nullOptional

Maximum tokens to generate. Omitted when unset — the backend’s own default applies. Greater than the model’s context window is 400. When unset, the admission token check adds nothing for generation.

temperaturedouble or nullOptional0-2

Sampling temperature between 0 and 2. When unset, defaults to 0.5 if reasoning is present, otherwise 0.2.

storeboolean or nullOptional

Must be false or omitted (omitting is 200 and echoed as false). true is 400 invalid_request_error — nothing created here is retrievable. OpenAI SDKs default this to true, so a default client.responses.create(...) fails.

toolslist of objects or nullOptional

Function tools are executed (flat shape: type, name, description, parameters, strict). Hosted tools (mcp, web_search, file_search) may 200 and echo on the response but are not run — tool_choice: required with only those types is 400 (needs a function definition). Fireworks sse is 400 (unknown variant). A model without tool calling returns 400.

tool_choiceenum or object or map from strings to any or nullOptional

Forwarded exactly as written: none, auto, required, { "type": "function", "name": "..." }, or another object.

reasoningobject or nullOptional

Reasoning config. A reasoning output item with summary[] is returned by default on glm5.3 even when this object is omitted — summary is not required to receive it. effort accepts none, minimal, low, medium, high, xhigh. max is 400 on this route (chat completions do accept max).

extra_bodymap from strings to anyOptionalDefaults to {}

Merged into the outbound body. Must not overwrite any modelled field (400). max_tool_calls and prompt are 400 here and in extra_body — not supported by any serving deployment.

instructionsstring or nullOptional

System-style instructions. Echoed back on the response object when set.

top_pdouble or nullOptional<=1

Nucleus sampling, greater than 0 and at most 1. In-range values are honoured and echoed. 0 and values outside 0–1 currently fail as 503 model_overloaded rather than a clean 400.

textobject or nullOptional

Output format. If you send text, format is required (400 when missing). json_object and strict json_schema are honoured on glm5.3 and skip the reasoning item.

parallel_tool_callsboolean or nullOptional

Whether the model may emit more than one function call in one turn. Echoed on the response. On live glm5.3, false does not serialize two requested calls into one.

previous_response_idstring or nullOptional

400 invalid_request_error. This endpoint holds no state — replay the conversation in input. OpenAI and Fireworks use this to continue a chat; we do not.

conversationstring or map from strings to any or nullOptional

400 invalid_request_error (string or { "id": "..." }). Not a silent no-op — the field is refused.

backgroundboolean or nullOptional

true is 400 invalid_request_error. This endpoint is synchronous only.

max_tool_callsinteger or nullOptional

400 invalid_request_error — not supported by any serving deployment, top-level or via extra_body.

Response

Successful response. With stream: true, the body is text/event-stream instead of JSON.

idstring

Rewritten to this service’s request id. GET /v2/responses/{id} still 404s — the id is for logs and x-request-id, not retrieval.

object"response"
modelstring
Rewritten to the public model id the caller asked for.
outputlist of objects

Typed output items from the backend — messages, reasoning, function calls, and vendor extras.

created_atintegerOptional

Unix timestamp (seconds) when the response was created.

statusstringOptional

Typically completed, incomplete, or failed. Corrected to incomplete with incomplete_details.reason: max_output_tokens when the caller set max_output_tokens, the backend reported output_tokens >= max_output_tokens, status was completed, and incomplete_details was absent.

incomplete_detailsobject or nullOptional
errorobject or nullOptional
usageobject or nullOptional

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
413
Content Too Large Error
422
Unprocessable Entity Error
429
Too Many Requests Error
502
Bad Gateway Error
503
Service Unavailable Error