Create Response
Create an OpenAI-compatible response. reasoning.effort maps through the selected model's reasoning_config when configured. reasoning.max_tokens caps thinking tokens when the model advertises reasoning.supports_max_tokens: true in /v1/models?format=openrouter (a max_tokens property under the reasoning parameter in the default list); other models accept the budget without enforcing it. reasoning.context and reasoning.mode are accepted but ignored. The :express model variant derives a budget for models with enforced budget support when no budget is supplied.
Response shape: Responses follow OpenAI's Responses API object whichever engine serves the model, with the fields OpenRouter's SDKs require always present: completed_at is a unix timestamp once the response has finished, error is null or {code, message}, and text is an object. Function call ids start with call_, and engine-internal fields (kv_transfer_params, input_messages, output_messages, ...) are removed from the response and from every streamed event.
Tools: function, custom and namespace tools, as Codex CLI sends them. A custom tool's call is a custom_tool_call item whose input is the raw text; its format grammar is described to the model, not enforced. A call to a tool of a namespace is a function_call with namespace set. Hosted tools (web_search, file_search, code_interpreter, mcp, ...) are refused with a 400 naming the type.
Stored responses: Nothing is stored. store is accepted and ignored. previous_response_id, conversation and background: true are refused with a 400; send the whole conversation in input. GET and DELETE on /v1/responses/{id} answer a 404 saying so.
Context window: If input plus max_output_tokens passes the model's context length, max_output_tokens is reduced to fit; if the input alone does not fit the request is a 400 with metadata.error_type context_.
Errors: Errors use OpenRouter's envelope, {"error": {"code", "message", "type", "metadata": {"error_type"}}}. A streaming request that fails before the first event gets the real HTTP status and the JSON envelope; one that fails later ends the stream with an error event and a response.failed event.
Guides: SDKs and compatibility, Limits, Streaming, Reasoning, Documents and media, Coding agents, Codex CLI
Body
application/jsonOpenAI's Responses request. Fields not listed here are passed to the engine. store is accepted and ignored: nothing is stored.
-
model string
If omitted, the gateway resolves its default model. A
:<variant>suffix is parsed separately from the model ID;:expressderives a thinking budget when the model supports enforced budgets and no explicit budget is supplied. -
input string or array of objects required
Input text or structured input items. A message item's
contentmay holdinput_text,input_imageandinput_fileparts. Aninput_file({"type": "input_file", "filename": "report.pdf", "file_data": "data:application/pdf;base64,..."}, orfile_urlin place offile_data) is converted to text before the model sees it, with the types, limits, token counting, caching and errors described underchat-content-part.file_id(a file uploaded withPOST /files) uses its stored text. A media URL (input_image'simage_url, orimage_url,audio_urlandvideo_urlparts, also in afunction_call_output's parts) is downloaded by the API and the model is given that copy, never the URL; so is afile_url, whose text the model is given. Either must behttporhttpson a public address, as must every redirect from it (up to five), and be at most 20 MB for an image, 50 MB for audio or video and 100 MB for a document; any other URL is a 400. A base64 data URI is sent as it is. -
instructions string
A system prompt.
-
max_output_tokens integer
Maximum output tokens, including reasoning and visible output. Reduced to fit the model's context window with the input.
default 32768at least 1 -
temperature numberrange 0–2
-
top_p number
Nucleus sampling cutoff. 0 keeps only the likeliest token; the engines take only values above 0, so it is sent as the smallest one they take, which does the same.
range 0–1 -
tools array of objects
function,customandnamespacetools. Any othertype(hosted tools such asweb_search) is refused with a 400 naming it. -
tool_choice string or object
none,auto,required, or a specificfunctionorcustomtool. Anything butnoneneedstools. -
reasoning object
Reasoning controls. Configured models map effort through their database profile. Models advertising
reasoning.supports_max_tokens: truein/v1/models?format=openrouter(amax_tokensproperty under thereasoningparameter in the default list) enforce the budget; other models accept it without enforcing it. -
store boolean
Accepted and ignored. Nothing is stored, whatever the value.
-
previous_response_id string or null
Refused with a 400 unless null. Responses are not stored; send the whole conversation in
input. -
conversation any
Refused with a 400. Conversations are not stored.
-
background boolean
trueis refused with a 400. A background response would have to be stored to be retrieved. -
stream boolean
Responses
OK
application/json, text/event-stream · response-create-response-payload
Bad Request, including an unsupported tool type, previous_response_id, and context_
application/json · error-payload
The API key is missing, unknown or not active. Send it as Authorization: Bearer <key>.
application/json · error-payload
This model requires a funded account. Funded subscriptions and internal accounts may use it.
application/json
Unknown model
application/json · error-payload
Rate limit exceeded
application/json · error-payload
The model could not be reached
application/json · error-payload
The model timed out
application/json · error-payload
The model cannot answer right now. Its engine is not serving it at the moment (as while it restarts), or the list of models being served or the model's capability specification could not be read. Retry after Retry-After where it is sent, else shortly.
application/json · error-payload
curl https://api.vultrinference.com/v1/responses \
-H "Authorization: Bearer $VULTR_INFERENCE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v4.1-flash-1017",
"instructions": "Answer in one sentence.",
"input": "Why is the sky blue?",
"max_output_tokens": 512
}'import os
import requests
response = requests.post(
"https://api.vultrinference.com/v1/responses",
headers={"Authorization": f"Bearer {os.environ['VULTR_INFERENCE_API_KEY']}"},
json={
"model": "deepseek-v4.1-flash-1017",
"instructions": "Answer in one sentence.",
"input": "Why is the sky blue?",
"max_output_tokens": 512,
},
)
print(response.json())const response = await fetch("https://api.vultrinference.com/v1/responses", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.VULTR_INFERENCE_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"model": "deepseek-v4.1-flash-1017",
"instructions": "Answer in one sentence.",
"input": "Why is the sky blue?",
"max_output_tokens": 512
}),
});
console.log(await response.json());{
"id": "string",
"object": "response",
"created_at": 1790000000,
"completed_at": 1790000000,
"status": "completed",
"error": {
"code": "string",
"message": "string"
},
"model": "string",
"output": [
{}
],
"text": {},
"usage": {
"input_tokens": 0,
"input_tokens_details": {
"cached_tokens": 0,
"cache_write_tokens": 0
},
"output_tokens": 0,
"output_tokens_details": {
"reasoning_tokens": 0
},
"total_tokens": 0
}
}