POST/v1/responsesCreate a model response
The Responses API is available for supported OpenAI, Anthropic, and Google Gemini models. It supports text input, input item arrays, function tools, web search tools, streaming, and OpenAI text format options.
Headers
AuthorizationstringRequiredBearer token for authentication. Format: Bearer YOUR_API_KEY
x-opengateway-user-idstringOptionalUser identifier for analytics and tracking.
x-opengateway-session-idstringOptionalSession identifier for analytics and tracking.
Request body
modelstringRequiredID of the model to use. See the model list for available models.
Use the owner/model format (e.g., openai/gpt-4o).
inputstring | arrayRequiredText input to the model. Can be a simple string or an array of input items for multi-turn conversations.
Input item types (when array):
type: "message"A message with role (user, system, developer) and content (string or content part array).
type: "function_call"A function call with id, call_id, name, and arguments.
type: "function_call_output"A function call result with call_id and output.
instructionsstringOptionalA system-level instruction to the model. Inserts a system message as the first item in the conversation.
temperaturenumberOptionalSampling temperature between 0 and 2. Higher values make output more random. Defaults to 1.
max_output_tokensintegerOptionalAn upper bound for the number of output tokens to generate.
top_pnumberOptionalNucleus sampling. The model considers tokens with top_p probability mass. Value between 0 and 1. Defaults to 1.
stoparrayOptionalUp to 4 sequences where the API will stop generating further tokens.
streambooleanOptionalIf set to true, events will be sent as server-sent events as they become available. Defaults to false.
toolsarrayOptionalA list of tools the model may call. Supports function and web_search_preview types.
typestringfunction or web_search_preview
functionobjectThe function definition: name (required), description (optional), parameters (JSON Schema object, optional).
tool_choicestring | objectOptionalControls which tool is called. none, auto, required, or a specific function object.
textobjectOptionalConfiguration for text response format.
formatobjectSet type to text (default), json_object, or json_schema.
reasoningobjectOptionalConfiguration for reasoning models. For Gemini Responses models, effort is translated into Gemini thinking configuration unless native_fields.thinking_config is also provided.
effortstringAccepted values vary by model. Common values include none, minimal, low, medium, high, and xhigh.
summarystringWhether to include a summary of the reasoning on providers that support reasoning summaries. auto, concise, or detailed. Gemini Responses currently uses effort only.
previous_response_idstringOptionalThe ID of a previous response to use as context for multi-turn conversations.
storebooleanOptionalWhether to store the generated response for later retrieval.
truncationstringOptionalTruncation strategy. auto truncates context from the middle if needed. disabled (default) returns an error if the input is too long.
native_fieldsobjectOptional🔌Use native_fields for provider-specific options outside the OpenAI Responses API, using the provider's field names such as native_fields.thinking_config. See the Native fields guide.
extraobjectOptional🔌OpenGateway-specific extension parameters.
fallbacksarray🔌List of fallback model IDs to try if the primary target fails.
debugarray🔌Categories to expose in the response top-level debug object: normalizations, deprecations, routing. See the Debug mode guide.
Returns
Returns a response object containing the model's output.
idstringA unique identifier for the response.
objectstringThe object type, always response.
statusstringThe status of the response: completed, failed, in_progress, or incomplete.
outputarrayAn array of output items generated by the model.
type: "message" — Assistant message with content array (output_text, refusal).type: "function_call" — A tool/function call with name, arguments, call_id.usageobjectToken usage: input_tokens, output_tokens, total_tokens.
debugobject🔌Returned only when extra.debug is set. Contains the requested categories — normalizations, deprecations, routing. See the Debug mode guide.
Try it
Request
curl https://apis.opengateway.ai/v1/responses \-H "Content-Type: application/json" \-H "Authorization: Bearer $API_KEY" \-d '{"model": "openai/gpt-5.1-codex-mini","input": "Hello!"}'
Response
{"id": "resp_abc123","object": "response","created_at": 1734567890,"model": "openai/gpt-5.1-codex-mini","status": "completed","output": [{"type": "message","id": "msg_abc123","status": "completed","role": "assistant","content": [{"type": "output_text","text": "Hello! How can I help you today?"}]}],"usage": {"input_tokens": 20,"output_tokens": 10,"total_tokens": 30}}