Skip to content

OpenAI Responses

/v1/responses is the newer OpenAI-style route for structured response workflows, tool invocation, and reasoning-oriented integrations.

On OmniRouters, it is best used when you want a modern OpenAI-compatible entry point but still want to stay inside the OmniRouters model catalogue.

Official Documentation

OmniRouters Notes

  • All models enabled in your OmniRouters account can be called through the OpenAI-compatible protocol.
  • On OmniRouters, this route is intended for Responses-style integrations.
  • The current OmniRouters OpenAPI schema documents this endpoint with a messages-based body. For field-level behavior, treat the OmniRouters schema in Apifox as the source of truth.

That last point matters: upstream OpenAI examples may use request fields that differ from the current OmniRouters schema. Use the official docs for conceptual guidance, and use OmniRouters Apifox for exact request validation.

Minimal Example

bash
curl https://omnirouters.com/v1/responses \
  -H "Authorization: Bearer $OMNIROUTERS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "your-enabled-model",
    "messages": [
      {
        "role": "system",
        "content": "You are a concise technical writer."
      },
      {
        "role": "user",
        "content": "Return a three-bullet API summary."
      }
    ],
    "response_format": {
      "type": "json_object"
    },
    "stream": false
  }'

Common Fields

FieldRequiredPurpose
modelYesThe OmniRouters model name you want to call
messagesYesRequest content in the OmniRouters-documented schema
response_formatNoAsk for plain text or JSON-style output
toolsNoTool definitions for structured tool use
streamNoReturn partial output chunks when enabled
max_tokensNoLimit generated output length

Request Body Parameters

The current OmniRouters OpenAPI schema documents /v1/responses with a messages-based request body. Native OpenAI Responses integrations more commonly use fields such as input, instructions, and max_output_tokens. When calling OmniRouters, start with the messages structure documented here; if your SDK sends native Responses fields, validate compatibility with the target model.

FieldTypeRequiredDescription
modelstringYesOmniRouters model name, such as gpt-4o, gpt-5.2, or a model alias from the OmniRouters catalogue.
messagesarrayYesMain input structure in the current OmniRouters schema. Contains message objects described below.
inputstring or arrayCompatibility fieldNative OpenAI Responses input. Can be plain text, message items, or tool results. Usually do not send both messages and input for the same request.
instructionsstringNoNative Responses system/developer-level instructions. With messages, a system message can express the same intent.
temperaturenumberNoSampling temperature, commonly from 0 to 2, often defaulting to 1.
top_pnumberNoNucleus sampling parameter, often defaulting to 1. Usually tune either temperature or top_p.
nintegerNoNumber of candidates. Kept in the OmniRouters schema for Chat-style compatibility.
streambooleanNoWhether to return streaming events. Defaults to false.
stopstring or string[]NoStop sequence or sequences.
max_tokensintegerNoMaximum output token field in the current OmniRouters schema.
max_output_tokensintegerCompatibility fieldNative Responses maximum output token field. Prefer the field your SDK sends when platform compatibility is confirmed.
presence_penaltynumberNoPresence penalty, commonly from -2 to 2.
frequency_penaltynumberNoFrequency penalty, commonly from -2 to 2.
logit_biasobjectNoProbability bias for specific tokens.
userstringNoEnd-user identifier. Native OpenAI APIs are moving toward more specific safety and cache identifiers, but compatible clients still commonly send this field.
response_formatobjectNoStructured output control in the OmniRouters schema. Common values: { "type": "text" }, { "type": "json_object" }.
textobjectCompatibility fieldNative Responses text output configuration, such as { "format": { "type": "text" } } or JSON Schema formats.
seedintegerNoAttempts to make results more reproducible. Determinism is not guaranteed.
toolsarrayNoTool definitions. The current schema explicitly supports function tools.
tool_choicestring or objectNoControls tool selection. Common values are none, auto, and required, or an object selecting a specific function.
parallel_tool_callsbooleanCompatibility fieldWhether to allow parallel tool calls. Common in native Responses requests.
previous_response_idstringCompatibility fieldNative Responses state field for continuing from a previous response. Usually unnecessary for stateless messages requests.
metadataobjectCompatibility fieldCustom metadata for tracing or filtering.
storebooleanCompatibility fieldWhether to store the response. Platform behavior may vary.
reasoningobjectCompatibility fieldReasoning-model configuration, such as effort or summary settings. Support varies by model.
truncationstringCompatibility fieldContext truncation strategy. Common values: disabled, auto.
logprobsbooleanNoWhether to return token log probabilities.
top_logprobsintegerNoUsed with logprobs, commonly from 0 to 20.

messages Object Structure

FieldTypeRequiredRolesDescription
rolestringYesAllMessage author role. The OmniRouters schema includes system, user, assistant, tool, and function.
contentstring or Part[]Yessystem, user, assistant, tool, functionMessage content. Can be a plain string or a multimodal Part array.
namestringNoAnyOptional author name, often used to distinguish participants or function names.
tool_callsarrayNoassistantTool calls generated by the assistant.
tool_call_idstringConditionallytoolTool call id that this tool-result message answers.

Common tool_calls structure:

FieldTypeDescription
idstringTool call id.
typestringTool type, most commonly function.
function.namestringFunction name.
function.argumentsstringJSON string generated by the model. Validate it before executing the function.

Part Object Structure

In the current OmniRouters messages[].content shape, Part objects represent text or multimodal input:

FieldTypeRequiredDescription
typestringYesContent type. Chat-compatible inputs commonly use text and image_url; native Responses inputs commonly use input_text, input_image, and input_file.
textstringConditionallyText content. Used when type is text or input_text.
image_urlobject or stringConditionallyImage input. Chat-style shape is usually { "url": "...", "detail": "auto" }; native input_image may also use a direct image URL or data URL.
file_idstringConditionallyUploaded file id, commonly used with native input_file.
file_datastringConditionallyBase64 file content for direct file input.
file_urlstringConditionallyFile URL, when allowed by the target model and platform.
filenamestringNoFile name. Recommended when using file_data, so the model can infer file type.
detailstringNoImage or file rendering detail. Common values include low, high, auto, and original, depending on content type and model support.

Common example:

json
[
  { "type": "input_text", "text": "Explain this image." },
  {
    "type": "input_image",
    "image_url": "data:image/png;base64,...",
    "detail": "auto"
  }
]

ExtraContent Object Structure

The Responses route does not currently declare a fixed extra_body object in the OmniRouters schema. Extension behavior is mainly expressed through these objects:

ObjectShapeDescription
response_format{ "type": "text" } or { "type": "json_object" }Output format control in the OmniRouters schema. JSON mode usually still requires explicit JSON instructions in the prompt.
text.format{ "type": "text" }, { "type": "json_schema", "schema": {...}, "strict": true }Native Responses structured output configuration. Availability depends on compatibility support.
tools[].function{ "name": "...", "description": "...", "parameters": {...} }Function tool definition. parameters is a JSON Schema object.
tool_choice"auto", "none", "required", or a specific tool objectControls whether the model may call tools, must call tools, or must call one selected tool.
reasoning{ "effort": "...", "summary": "..." }Reasoning-model extension configuration. Exact enum values and behavior depend on the model.
metadataAny JSON objectBusiness metadata for tracing. It should not be relied on as model input.

Response Body Parameters

Non-streaming Responses usually return a Response object. Exact fields vary by model, tools, structured output settings, and platform compatibility:

FieldTypeDescription
idstringResponse id. Can be used for tracing or as previous_response_id.
objectstringObject type, usually response.
created_atintegerUnix timestamp in seconds.
statusstringResponse status. Common values: completed, incomplete, failed, cancelled.
errorobject or nullError object when request or generation fails. Usually null on success.
incomplete_detailsobject or nullReason details when status is incomplete, such as token limits.
modelstringModel actually used.
instructionsstring or nullInstructions used for this response.
outputarrayOutput items. Text, tool calls, and reasoning items may all appear here.
output_textstringSDKs often expose this convenience aggregation of all output_text content. The raw HTTP response may not include it directly.
parallel_tool_callsbooleanWhether parallel tool calls were enabled.
previous_response_idstring or nullPrevious response id.
reasoningobject or nullReasoning configuration or summary information.
storebooleanWhether this response is stored.
temperaturenumberSampling temperature used.
textobjectText output configuration, such as format.
tool_choicestring or objectTool selection strategy used.
toolsarrayTools available to this response.
top_pnumbertop_p used.
truncationstringTruncation strategy.
usageobjectToken usage.
metadataobjectMetadata attached to the request.

Common output[] item shapes:

TypeKey fieldsDescription
messageid, status, role, content[]Model output message. role is usually assistant.
output_text contenttype, text, annotationsText output part. Read final text from output[].content[].text.
function_callid, call_id, name, arguments, statusFunction call requested by the model. Execute it in your application, then submit the tool output.
reasoningid, summary, statusReasoning summary or state returned by reasoning models.
web_search_call / file_search_callid, status, query or result fieldsMay appear when built-in tools are used. OmniRouters passthrough depends on tool support.

Common usage structure:

FieldTypeDescription
input_tokensintegerInput token count.
output_tokensintegerOutput token count.
total_tokensintegerTotal token count.
input_tokens_details.cached_tokensintegerInput tokens served from cache.
output_tokens_details.reasoning_tokensintegerReasoning token count.

When stream: true, Responses-style SSE events may include response.created, response.output_item.added, response.output_text.delta, response.completed, and related events. Handle streams by accumulating text and tool-call arguments by event type instead of assuming every event is a complete final JSON object.

When to Use This Route

Use this route if:

  • you prefer newer OpenAI-style workflows
  • you want to structure outputs more explicitly
  • you want to prepare for tool-oriented integrations
  • you are comfortable following the OmniRouters-specific schema in Apifox

When Another Route May Be Better