Create Response

Beta
View as Markdown
Generate a model reply in the OpenAI Responses format. **Models:** `sarvam-105b`, `glm5.3`, `gemma4`, and `deepseekv4-flash` (ids are case-sensitive). **Each call is independent.** Send the full conversation in `input` every time — nothing is stored for you. Leave out `store` or set it to `false` (`true` returns **`400`**). You cannot load a past response by id (`GET /v2/responses/{id}` is always **`404`**). **Streaming is optional.** Default is a single JSON body (`stream` omitted or `false`). Set `stream: true` only if you want server-sent events. **Reasoning (`glm5.3`, `deepseekv4-flash`):** both support `low`, `high`, and `max`. On `glm5.3`, `reasoning.effort` only accepts **`low`** or **`high`** — omit `reasoning` / `effort` for **`max`**-level reasoning, since sending the literal string **`"max"`** returns **`400`**. On `deepseekv4-flash`, all three values including `max` work directly. On `glm5.3`, read the trace from the reasoning item's `summary[0].text`. Reasoning tokens count toward `max_output_tokens`, which has no default cap — omitting it means unbounded generation. Other fields are documented below. See the [Responses API guide](/api/api-guides-tutorials/chat-completion/responses-api).

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/responses` (case-sensitive; unknown ids return `404`): - **`sarvam-105b`** — Sarvam flagship model. - **`glm5.3`** — 1,048,576-token context; reasoning in `output` as a `reasoning` item; flat function tools; max request size 10,485,760 bytes. - **`gemma4`** — vision (inline base64 images) and tools. - **`deepseekv4-flash`** — long context, tools, and reasoning.
Allowed values:
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 because this endpoint does not store prior turns.
streamtrueRequired
Optional. Default `false` — same as chat completions. Omit or `false` for one JSON response body. Set `true` to stream 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 output tokens to generate, including reasoning tokens on reasoning models. If omitted, there is no default cap — generation is unbounded and continues until the model stops on its own or the context window fills. Always set this explicitly in production. Values above the model context window return 400.

temperaturedouble or nullOptional0-2Defaults to 1

Sampling temperature between 0 and 2. Default 1 on glm5.3 when omitted. Output is not bit-reproducible, even at 0.

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 use the **flat** Responses shape (`type`, `name`, `parameters`, `strict`) — the nested chat-completions tool shape is **`400`**. `tool_choice: required` with no tools returns **`400`**. Function `arguments` in output are a JSON **string** (parse before use). Multiple tool calls per turn are supported; use **`parallel_tool_calls: true`** or omit (see that field).
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
Optional reasoning config for `glm5.3` and `deepseekv4-flash`. On `glm5.3`, a reasoning item is always in `output` — read `summary[0].text`. **`effort`:** on `glm5.3`, `low` or `high` only — omit for `max`-level reasoning (the literal string `max` returns `400`); on `deepseekv4-flash`, `low`, `high`, or `max` all work directly. Optional **`summary`:** `auto` or `detailed`.
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<=1Defaults to 0.95

Nucleus sampling. Default 0.95 on glm5.3 when omitted. Must be greater than 0 and at most 1 (0 is rejected on glm5.3).

top_kinteger or nullOptional

Top-k sampling on glm5.3. Omit or use -1 to disable; values ≥ 1 enable top-k. 0 is rejected.

frequency_penaltydouble or nullOptional-2-2

Optional. Range -2 to 2. May be accepted and echoed on Responses without changing model output.

presence_penaltydouble or nullOptional-2-2

Optional. Range -2 to 2. May be accepted and echoed on Responses without changing model output.

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

Not currently enforced on this route for any model that supports tool calling here (glm5.3, gemma4, deepseekv4-flash). Setting false is accepted without error, but the model may still return multiple tool calls in one turn.

ninteger or nullOptional

Ignored on this route — Responses always returns one output. Accepted for OpenAI SDK compatibility only; omit or leave at 1.

seedinteger or nullOptional

Ignored on Responses. Accepted for SDK compatibility only.

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 anyOptional

Conversation state is not supported. Omit this field and replay the complete conversation in input.

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

typestring
The event type.

Errors

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