Responses API (OpenAI-Compatible)
OpenAI Responses passthrough at POST /v1/responses, plus optional stateful session subroutes for retrieval, cancellation, and input items.
Inference Space provides the OpenAI Responses-compatible endpoint POST /v1/responses. It is a passthrough endpoint for the OpenAI Responses protocol and the standard request entry point for Codex CLI. Existing OpenAI Responses clients can connect by switching the Base, Key, and model.
The API is identical for private deployments; only replace the Base domain → Enterprise Private Deployment.
Overview
- Endpoint:
POST https://ai.inf.space/v1/responses(OpenAI Responses API compatible) - Base:
https://ai.inf.space/v1(the browser console shares theai.inf.spacehost; use the/v1path for API requests) - Authentication:
Authorization: Bearer <gk_...>; API Keys start withgk_and are created in the console - Default behavior: Uses the OpenAI Responses request and response format
Available model IDs and prices are determined by the console. See Model List and Authentication.
Automatic routing
/v1/responses and /v1/chat/completions follow the same rule: clients send only model and must not select a provider through query parameters, headers, or the request body. The gateway selects a service from the API Key organization's routing policy and performs failover.
Send a request
curl "https://ai.inf.space/v1/responses" \
-H "Authorization: Bearer $TOS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5-x",
"input": "Introduce yourself in three sentences."
}'import os, requests
resp = requests.post(
"https://ai.inf.space/v1/responses",
headers={
"Authorization": f"Bearer {os.environ['TOS_API_KEY']}",
"Content-Type": "application/json",
},
json={
"model": "gpt-5-x",
"input": "Introduce yourself in three sentences.",
},
)
print(resp.json())const resp = await fetch(
"https://ai.inf.space/v1/responses",
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.TOS_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "gpt-5-x",
input: "Introduce yourself in three sentences.",
}),
},
);
console.log(await resp.json());By default, when stateful mode is disabled, /v1/responses preserves the OpenAI Responses request and response format. Refer to the OpenAI Responses API specification for the exact request and response fields.
Optional Stateful Session Subroutes
When stateful mode is enabled (RESPONSES_STATEFUL_ENABLED=true), the gateway exposes additional stateful session subroutes based on response.id:
| Method | Path | Description |
|---|---|---|
GET | /v1/responses/{id} | Retrieve a response |
DELETE | /v1/responses/{id} | Delete a response |
GET | /v1/responses/{id}/input_items | List the response's input items |
POST | /v1/responses/{id}/cancel | Cancel an in-progress response |
# Retrieve
curl "https://ai.inf.space/v1/responses/resp_xxx" \
-H "Authorization: Bearer $TOS_API_KEY"
# List input items
curl "https://ai.inf.space/v1/responses/resp_xxx/input_items" \
-H "Authorization: Bearer $TOS_API_KEY"
# Cancel
curl -X POST "https://ai.inf.space/v1/responses/resp_xxx/cancel" \
-H "Authorization: Bearer $TOS_API_KEY"
# Delete
curl -X DELETE "https://ai.inf.space/v1/responses/resp_xxx" \
-H "Authorization: Bearer $TOS_API_KEY"Stateful subroutes require API Key authentication. Unauthenticated requests return 401 with the data-plane's flat error structure:
{
"error": "missing_api_key",
"message": "API key required (Authorization: Bearer gk_...)"
}Subroutes are mounted only when RESPONSES_STATEFUL_ENABLED=true. When disabled, /v1/responses is available only as a passthrough POST endpoint and its subpaths are unavailable. The deployment operator decides whether to enable stateful mode; for the public cloud, follow the console and observed behavior.
Billing
Usage is metered and billed from the input and output tokens in usage, in units of 1M tokens. Actual prices, available models, and discounts are determined by console and organization pricing; organization-specific prices and contract discounts take precedence.