POST/v1/responses

Create a model response

The Responses API is available for OpenAI models. It supports text input, input item arrays, function tools, web search tools, streaming, and OpenAI text format options.

Headers

AuthorizationstringRequired

Bearer token for authentication. Format: Bearer YOUR_API_KEY

x-opengateway-user-idstringOptional

User identifier for analytics and tracking.

x-opengateway-session-idstringOptional

Session identifier for analytics and tracking.

Request body

modelstringRequired

ID of the model to use. See the model list for available models.

Use the owner/model format (e.g., openai/gpt-4o).

inputstring | arrayRequired

Text 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.

instructionsstringOptional

A system-level instruction to the model. Inserts a system message as the first item in the conversation.

temperaturenumberOptional

Sampling temperature between 0 and 2. Higher values make output more random. Defaults to 1.

max_output_tokensintegerOptional

An upper bound for the number of output tokens to generate.

top_pnumberOptional

Nucleus sampling. The model considers tokens with top_p probability mass. Value between 0 and 1. Defaults to 1.

stoparrayOptional

Up to 4 sequences where the API will stop generating further tokens.

streambooleanOptional

If set to true, events will be sent as server-sent events as they become available. Defaults to false.

toolsarrayOptional

A list of tools the model may call. Supports function and web_search_preview types.

typestring

function or web_search_preview

functionobject

The function definition: name (required), description (optional), parameters (JSON Schema object, optional).

tool_choicestring | objectOptional

Controls which tool is called. none, auto, required, or a specific function object.

textobjectOptional

Configuration for text response format.

formatobject

Set type to text (default), json_object, or json_schema.

reasoningobjectOptional

Configuration for reasoning models (o-series).

effortstring

low, medium, or high.

summarystring

Whether to include a summary of the reasoning. auto, concise, or detailed.

previous_response_idstringOptional

The ID of a previous response to use as context for multi-turn conversations.

storebooleanOptional

Whether to store the generated response for later retrieval.

truncationstringOptional

Truncation strategy. auto truncates context from the middle if needed. disabled (default) returns an error if the input is too long.

Returns

Returns a response object containing the model's output.

idstring

A unique identifier for the response.

objectstring

The object type, always response.

statusstring

The status of the response: completed, failed, in_progress, or incomplete.

outputarray

An 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.
usageobject

Token usage: input_tokens, output_tokens, total_tokens.

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
}
}