Responses API

POST /v1/responses

OpenAI Responses API compatible endpoint, supporting stateful multi-turn conversations, reasoning models, and tool calling. Requests and responses are passed through byte-for-byte, so official parameters work as-is with no adaptation needed.

Clients built on the Responses API — Codex CLI, the OpenAI Agents SDK, and others — can point their base_url at this service directly.

How this differs from /v1/chat/completions: the Responses API chains context server-side via previous_response_id, so you don't resend the full history each turn, and reasoning models keep their chain-of-thought context. For simple single-turn prompts, Chat Completions is simpler.

Endpoints

Method Path Description
POST /v1/responses Create a response
GET /v1/responses/{response_id} Retrieve a response by ID
DELETE /v1/responses/{response_id} Delete a response
POST /v1/responses/compact Compact conversation context (used by Codex)

Request parameters

Parameter Type Required Description
model string Yes Model ID, e.g. gpt-5.5 / gpt-5.6-sol.
input string | array Yes Input content. A string for a single prompt; an array for multiple messages or tool results.
instructions string No System instructions, equivalent to a system message in Chat Completions.
max_output_tokens integer No Maximum number of tokens to generate.
previous_response_id string No The id from the previous turn, used to chain context. See below.
stream boolean No Whether to stream the response (SSE). Defaults to false.
tools array No Tools available for function calling.
tool_choice string | object No Tool selection strategy: auto / none / a specific tool.
reasoning object No Reasoning config, e.g. {"effort": "low"}. Reasoning models only.
temperature number No Sampling temperature.
store boolean No Whether to retain the response server-side. Defaults to true.

Request examples

cURL

curl https://api.aiin1.ai/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "gpt-5.5",
    "input": "Hello, please introduce yourself"
  }'

Python

import openai
 
client = openai.OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://api.aiin1.ai/v1",
)
 
response = client.responses.create(
    model="gpt-5.5",
    input="Hello, please introduce yourself",
)
print(response.output_text)

Node.js

import OpenAI from "openai";
 
const client = new OpenAI({
  apiKey: "YOUR_API_KEY",
  baseURL: "https://api.aiin1.ai/v1",
});
 
const response = await client.responses.create({
  model: "gpt-5.5",
  input: "Hello, please introduce yourself",
});
console.log(response.output_text);

Multi-turn conversations

Pass the id returned by the previous turn as previous_response_id. The service chains the context automatically — you don't need to resend prior messages.

first = client.responses.create(
    model="gpt-5.5",
    input="My name is Alice",
)
 
second = client.responses.create(
    model="gpt-5.5",
    input="What is my name?",
    previous_response_id=first.id,   # chain the previous turn
)
print(second.output_text)   # Your name is Alice

Response

Field Type Description
id string Unique ID for this response, prefixed with nxrsp_. Use it for previous_response_id, or to retrieve by ID.
object string Always response.
created_at integer Unix timestamp.
model string The model actually used.
status string completed / incomplete / failed.
output array List of output items: messages, tool calls, etc.
output_text string Convenience field with the concatenated plain-text output (provided by the SDK).
usage object Token usage: input_tokens / output_tokens / total_tokens.
{
  "id": "nxrsp_...",
  "object": "response",
  "created_at": 1730000000,
  "model": "gpt-5.5",
  "status": "completed",
  "output": [
    {
      "type": "message",
      "role": "assistant",
      "content": [{ "type": "output_text", "text": "Hello! I am..." }]
    }
  ],
  "usage": { "input_tokens": 12, "output_tokens": 28, "total_tokens": 40 }
}

About response_id

IDs returned by this service are prefixed with nxrsp_, which differs from OpenAI's official resp_ format. The ID is signed and bound to your organization, isolating conversation data between organizations.

Things to keep in mind:

  • Pass it back as-is. Use the returned id directly for previous_response_id, GET, or DELETE — the service unwraps it to the vendor's original ID automatically.
  • Do not construct or modify IDs yourself, or you will get 400 invalid_request_error.
  • IDs cannot be used across organizations. Using another organization's ID returns 403 permission_error.
  • Do not assume the ID matches OpenAI's. If your system talks to both the official API and this service, the two sets of IDs are not interchangeable.

About /compact

POST /v1/responses/compact compacts long conversation histories. It is called automatically by Codex CLI between turns, so you normally never request it directly.

The endpoint is unavailable on some routes. In that case the service degrades gracefully: it synthesizes a history summary through the regular Responses pipeline and returns that instead, so long Codex sessions are not interrupted. The fallback is transparent to clients and returns the same response shape.

Error codes

Status type Description
400 invalid_request_error Malformed response_id, or an invalid request body.
402 billing_error Insufficient balance or an overdue account.
403 permission_error The response_id does not belong to your organization, or the API key failed the IP allowlist check.
403 subscription_error Subscription is not in a usable state.
503 overloaded_error No route currently available; please retry shortly.

See Error codes for the full list.