Skip to content

Responses

POST /v1/responses

Generate a model response for a given input. Compatible with the OpenAI Responses API.

ParameterTypeRequiredDescription
modelstringYesModel ID
inputstring | arrayYesText string (treated as a user message) or array of input items
instructionsstringNoSystem/developer message prepended to context
streambooleanNoStream as SSE. Default: false
temperaturenumberNoSampling temperature, 0–2
top_pnumberNoNucleus sampling, greater than 0 and at most 1
max_output_tokensintegerNoUpper bound on generated tokens
toolsarrayNoFunction tools the model may call
tool_choicestring | objectNo"none", "auto", "required", or a specific tool
parallel_tool_callsbooleanNoAllow parallel tool calls
reasoningobjectNo{ "effort": …, "summary": "auto"|"concise"|"detailed" }. effort is checked per model against its reasoning_efforts: a level the model doesn’t list runs at the next listed level up, or the highest, which can cost more than the level you sent, and X-Reasoning-Effort reports it. A value outside the effort vocabulary is a 400.
truncationstringNo"auto" (truncate to fit context) or "disabled"
metadataobjectNoKey-value pairs for tracking
textobjectNoText response format config
seedintegerNoDeterministic sampling seed
stopstring | string[]NoUp to 4 stop sequences
top_kintegerNoTop-k sampling (provider-specific)
repetition_penaltynumberNoRepetition penalty (provider-specific)

A model can turn reasoning off only if its levels include none. Setting reasoning.effort to none on a model that does not publish it is a 400. The error text is on Errors.

Simple string:

{
"model": "google/gemma-4-31b-it",
"input": "Explain quantum computing in one paragraph."
}

Structured input items:

{
"model": "google/gemma-4-31b-it",
"input": [
{
"role": "user",
"content": [
{ "type": "input_text", "text": "Describe this image" },
{ "type": "input_image", "image_url": "https://..." }
]
}
]
}

Input item types:

TypeDescription
Message{ "role": "user"|"assistant"|"developer"|"system", "content": string | content[] }
Function call{ "type": "function_call", "call_id": "...", "name": "...", "arguments": "..." }
Function call output{ "type": "function_call_output", "call_id": "...", "output": "..." }

Content types: input_text, input_image, input_file

input_image and input_file accept either an inline URL/base64 (image_url on input_image; file_url or file_data on input_file) or a file_id returned by the Files API. When you reference a file_id, the server resolves the upload to a short-lived presigned URL before forwarding to the model. Inline URLs, and the server_url of an MCP tool, must meet the URL requirements.

{
"model": "<vision-capable-model>",
"input": [
{
"role": "user",
"content": [
{ "type": "input_text", "text": "Describe this image" },
{ "type": "input_image", "file_id": "file-img123" }
]
}
]
}

For PDFs, send input_file with the document’s file_id, or inline as file_data (data:application/pdf;base64,...), which is stored as a document file with the same limits as on Chat Completions (or, under zero data retention, rendered in memory with its own limits); the server rasterizes each page and forwards them as input_image parts (one per page). input_image only accepts purpose: "vision" file_ids. Video and audio uploads aren’t yet routable through /v1/responses — use /v1/chat/completions for those.

{
"id": "resp_abc123",
"object": "response",
"status": "completed",
"created_at": 1700000000,
"model": "google/gemma-4-31b-it",
"output": [
{
"type": "message",
"role": "assistant",
"content": [
{
"type": "output_text",
"text": "Quantum computing uses quantum bits (qubits)..."
}
]
}
],
"usage": {
"input_tokens": 15,
"output_tokens": 80,
"total_tokens": 95
}
}
StatusDescription
completedGeneration finished
failedGeneration failed (see error field)
in_progressStill generating (streaming)
incompleteStopped early (see incomplete_details.reason)
cancelledRequest was cancelled
queuedWaiting to be processed
FieldTypeDescription
input_tokensintegerInput tokens consumed
output_tokensintegerOutput tokens generated
total_tokensintegerSum of input and output tokens
input_tokens_detailsobject{ cached_tokens }
output_tokens_detailsobject{ reasoning_tokens }

Response objects are not stored, so send the earlier turns in input on every request, including each function_call the model made alongside its function_call_output. A request with a non-empty previous_response_id or an item_reference input item, including one sent as just { "id": "..." }, is rejected with 400 unsupported_value. store itself is accepted and ignored, but clients that default to store: true, such as the Vercel AI SDK, send earlier turns as item_reference, so set store: false on them. Content a request carries may still be stored, such as an inline PDF or a logged request body; Zero data retention lists what is stored and for how long.

{
"model": "google/gemma-4-31b-it",
"input": [
{ "role": "user", "content": "Explain quantum computing in one paragraph." },
{ "role": "assistant", "content": "Quantum computing uses quantum bits (qubits)..." },
{ "role": "user", "content": "Now explain it to a 5-year-old." }
]
}