Responses
Menu
Chat

Responses

Create a model response with the OpenAI Responses API.

POST /v1/responses

Compatible with the OpenAI Responses API — the newer interface used by reasoning models, Codex and agent frameworks. It supports text and image input, built-in and function tools, reasoning settings and multi-turn state via previous_response_id.

Use this endpoint with models whose supported_endpoint_types include openai-response (see List models). For some other providers, such as Gemini, the request is converted to Chat Completions internally; in that case previous_response_id and conversation are not supported. When in doubt, use Chat Completions.

Authentication

Authorization: Bearer sk-xxxx

Request body

Parameter Type Required Description
model string Yes Model ID, e.g. gpt-5, gpt-4o-mini.
input string | array Yes A text prompt, or an array of input items (messages with input_text / input_image / input_file parts, previous outputs, tool results).
instructions string No System / developer instructions inserted before the input.
max_output_tokens integer No Upper bound for generated tokens, including reasoning tokens.
temperature number No Sampling temperature, 0–2.
top_p number No Nucleus sampling, 0–1.
tools array No Tools the model may use: function tools and built-in tools such as web_search when the upstream supports them.
tool_choice string | object No none, auto, required, or a specific tool.
parallel_tool_calls boolean No Allow several tool calls in one turn.
max_tool_calls integer No Maximum number of built-in tool calls.
reasoning object No Reasoning settings: effort (minimal, low, medium, high) and summary (auto, concise, detailed).
text object No Text output settings. text.format selects {"type": "text"}, {"type": "json_object"} or {"type": "json_schema", "name": ..., "schema": ..., "strict": true}.
previous_response_id string No Continue a conversation from a previous response stored by the upstream.
store boolean No Whether the upstream may store the response (required for previous_response_id later).
include array No Extra output data, e.g. ["reasoning.encrypted_content"].
truncation string No auto or disabled.
metadata object No Up to 16 key-value pairs attached to the response.
stream boolean No Stream events as SSE. See Streaming.
prompt_cache_key string No Key that improves prompt cache hit rates for similar requests.
user string No Stable end-user identifier.

background mode is not supported. previous_response_id relies on the upstream provider having stored the earlier response, so it only works if the follow-up reaches the same upstream account. For reliable multi-turn conversations, send the full history in input.

Request example

cURL
curl https://rutoken.ai/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $API_KEY" \
  -d '{
    "model": "gpt-5",
    "instructions": "Answer concisely.",
    "input": "Which is larger, 9.11 or 9.9?",
    "reasoning": {"effort": "low"},
    "max_output_tokens": 1000
  }'
Python
from openai import OpenAI

client = OpenAI(base_url="https://rutoken.ai/v1", api_key="sk-xxxx")
resp = client.responses.create(
    model="gpt-5",
    instructions="Answer concisely.",
    input="Which is larger, 9.11 or 9.9?",
    reasoning={"effort": "low"},
    max_output_tokens=1000,
)
print(resp.output_text)
Node.js
import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://rutoken.ai/v1", apiKey: "sk-xxxx" });
const resp = await client.responses.create({
  model: "gpt-5",
  instructions: "Answer concisely.",
  input: "Which is larger, 9.11 or 9.9?",
  reasoning: { effort: "low" },
  max_output_tokens: 1000,
});
console.log(resp.output_text);

Image input uses an input_image part:

json
{
  "model": "gpt-4o-mini",
  "input": [
    {
      "role": "user",
      "content": [
        {"type": "input_text", "text": "Describe this image."},
        {"type": "input_image", "image_url": "https://example.com/cat.jpg"}
      ]
    }
  ]
}

Response

json
{
  "id": "resp_67ccd2bed1ec8190",
  "object": "response",
  "created_at": 1760000000,
  "status": "completed",
  "model": "gpt-5",
  "output": [
    {
      "type": "reasoning",
      "id": "rs_67ccd2bf",
      "summary": []
    },
    {
      "type": "message",
      "id": "msg_67ccd2bf",
      "role": "assistant",
      "status": "completed",
      "content": [
        {"type": "output_text", "text": "9.9 is larger.", "annotations": []}
      ]
    }
  ],
  "usage": {
    "input_tokens": 24,
    "output_tokens": 70,
    "total_tokens": 94,
    "input_tokens_details": {"cached_tokens": 0},
    "output_tokens_details": {"reasoning_tokens": 64}
  }
}
Field Type Description
id string Response ID, usable as previous_response_id.
status string completed, incomplete, failed or in_progress.
output array Output items: message, reasoning, function_call, built-in tool calls.
output[].content[].text string Generated text of a message item. The SDKs expose the concatenation as output_text.
usage object input_tokens, output_tokens, total_tokens and their details (cached and reasoning tokens).

Streaming

With "stream": true the endpoint emits typed events such as response.created, response.output_text.delta and response.completed (which carries usage). See Streaming.

Compaction

POST /v1/responses/compact compacts a long conversation into a shorter context that you can pass as input to the next request. It accepts model, input, instructions and previous_response_id, and returns an object with id, output and usage. Availability depends on the upstream channel; it is mainly used by Codex.

bash
curl https://rutoken.ai/v1/responses/compact \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $API_KEY" \
  -d '{
    "model": "gpt-5-codex",
    "input": [{"role": "user", "content": "...long conversation..."}]
  }'