OpenAI Responses
Send a request through RunAPI's OpenAI-compatible Responses operation.
Overview
Use RunAPI's OpenAI-compatible Responses operation with a compatible model and the protocol's request and response shapes.
Quick start
- Create an API key and set it as RUNAPI_API_KEY.
- Choose a compatible model, then send the documented path parameters and JSON body.
- Read the JSON response or server-sent events shown for this operation, and handle protocol errors.
Endpoint
- Base URL
https://runapi.ai- Contract version
v1- Preferred authentication
Authorization: Bearer YOUR_API_TOKEN
Authentication carriers
RunAPI accepts each carrier listed below. Generated samples use the protocol's preferred header.
- header - Preferred
Authorization: Bearer YOUR_API_TOKEN- header
x-api-key: YOUR_API_TOKEN- header
x-goog-api-key: YOUR_API_TOKEN- query
?key=YOUR_API_TOKEN
Compatible models
Open a model page for current pricing, rate limits, and commercial-usage details.
Show 53 compatible models
- claude-fable-5
- claude-sonnet-5
- claude-opus-5
- claude-opus-4-8
- claude-opus-4-7
- claude-opus-4-6
- claude-sonnet-4-6
- claude-opus-4-5-20251101
- claude-sonnet-4-5-20250929
- claude-haiku-4-5-20251001
- claude-opus-4-1-20250805
- gpt-5.5
- gpt-5.5-pro
- gpt-5.4
- gpt-5.4-mini
- gpt-5.4-nano
- gpt-5.4-pro
- gpt-5.3-codex
- gpt-5.3-codex-spark
- gpt-5.2
- gpt-5.2-pro
- gpt-5.6-luna
- gpt-5.6-sol
- gpt-5.6-terra
- gemini-3.5-flash
- gemini-3.1-pro-preview
- gemini-3-flash-preview
- gemini-2.5-pro
- gemini-2.5-flash
- deepseek-v4-pro
- deepseek-v4-flash
- glm-5.2
- glm-5.1
- glm-5-turbo
- glm-5
- glm-4.7
- glm-4.6
- glm-4.5
- glm-4.5-air
- kimi-k3
- kimi-k2.7-code
- kimi-k2.6
- kimi-k2.5
- MiniMax-M3
- MiniMax-M2.7
- MiniMax-M2.7-highspeed
- MiniMax-M2.5
- MiniMax-M2.5-highspeed
- MiniMax-M2.1
- MiniMax-M2
- grok-4.20-0309-non-reasoning
- grok-4.5
- grok-4.3
Request contract
Only fields with both public protocol and RunAPI support evidence are listed. Additional JSON body fields are passed through.
JSON body6 fields
input["string", "array"]Text, message items, or tool results provided to the model.
instructions["string", "null"]System or developer instructions for this response.
max_output_tokens["integer", "null"]Maximum number of output tokens, including visible and reasoning tokens.
modelstringRunAPI model identifier returned by the compatible model catalog.
stream["boolean", "null"]Return typed Responses events as server-sent events.
Default:false
toolsarrayTools the model may call.
Request example
{
"input": "Say hello in one sentence.",
"model": "gpt-5.4"
}
Synchronous response
Schema
{
"additionalProperties": true,
"properties": {
"id": {
"type": "string"
},
"model": {
"type": "string"
},
"object": {
"const": "response",
"type": "string"
},
"output": {
"type": "array"
},
"status": {
"type": "string"
},
"usage": {
"additionalProperties": true,
"properties": {
"input_tokens": {
"type": "integer"
},
"output_tokens": {
"type": "integer"
},
"total_tokens": {
"type": "integer"
}
},
"required": [
"input_tokens",
"output_tokens",
"total_tokens"
],
"type": "object"
}
},
"required": [
"id",
"object",
"status",
"model",
"output"
],
"type": "object"
}
Example
{
"id": "resp_example",
"model": "gpt-5.4",
"object": "response",
"output": [
{
"content": [
{
"annotations": [],
"text": "Hello! How can I help today?",
"type": "output_text"
}
],
"id": "msg_example",
"role": "assistant",
"status": "completed",
"type": "message"
}
],
"status": "completed",
"usage": {
"input_tokens": 12,
"output_tokens": 8,
"total_tokens": 20
}
}
SSE event: output_text_delta
Schema
{
"additionalProperties": true,
"properties": {
"content_index": {
"type": "integer"
},
"delta": {
"type": "string"
},
"item_id": {
"type": "string"
},
"output_index": {
"type": "integer"
},
"type": {
"const": "response.output_text.delta",
"type": "string"
}
},
"required": [
"type",
"item_id",
"output_index",
"content_index",
"delta"
],
"type": "object"
}
Example
{
"content_index": 0,
"delta": "Hello",
"item_id": "msg_example",
"output_index": 0,
"type": "response.output_text.delta"
}
SSE event: completed
Schema
{
"additionalProperties": true,
"properties": {
"response": {
"additionalProperties": true,
"properties": {
"id": {
"type": "string"
},
"model": {
"type": "string"
},
"object": {
"const": "response",
"type": "string"
},
"output": {
"type": "array"
},
"status": {
"type": "string"
},
"usage": {
"additionalProperties": true,
"properties": {
"input_tokens": {
"type": "integer"
},
"output_tokens": {
"type": "integer"
},
"total_tokens": {
"type": "integer"
}
},
"required": [
"input_tokens",
"output_tokens",
"total_tokens"
],
"type": "object"
}
},
"required": [
"id",
"object",
"status",
"model",
"output",
"usage"
],
"type": "object"
},
"type": {
"const": "response.completed",
"type": "string"
}
},
"required": [
"type",
"response"
],
"type": "object"
}
Example
{
"response": {
"id": "resp_example",
"model": "gpt-5.4",
"object": "response",
"output": [
{
"content": [
{
"annotations": [],
"text": "Hello! How can I help today?",
"type": "output_text"
}
],
"id": "msg_example",
"role": "assistant",
"status": "completed",
"type": "message"
}
],
"status": "completed",
"usage": {
"input_tokens": 12,
"output_tokens": 8,
"total_tokens": 20
}
},
"type": "response.completed"
}
Protocol error: invalid_request
Schema
{
"additionalProperties": true,
"properties": {
"error": {
"additionalProperties": true,
"properties": {
"code": {
"type": [
"string",
"null"
]
},
"message": {
"type": "string"
},
"param": {
"type": [
"string",
"null"
]
},
"type": {
"type": "string"
}
},
"required": [
"message",
"type"
],
"type": "object"
}
},
"required": [
"error"
],
"type": "object"
}
Example
{
"error": {
"code": null,
"message": "input must be a string or an array",
"param": "input",
"type": "invalid_request_error"
}
}
Usage
Schema
{
"additionalProperties": true,
"properties": {
"input_tokens": {
"type": "integer"
},
"output_tokens": {
"type": "integer"
},
"total_tokens": {
"type": "integer"
}
},
"required": [
"input_tokens",
"output_tokens",
"total_tokens"
],
"type": "object"
}
Example
{
"input_tokens": 12,
"output_tokens": 8,
"total_tokens": 20
}
Generated Code Samples
Each cURL, JavaScript, and Python sample sends the validated request from this contract without requiring a protocol-specific SDK.
curl -X POST https://runapi.ai/v1/responses \
-H Authorization:\ Bearer\ YOUR_API_TOKEN \
-H Content-Type:\ application/json \
-d \{\"model\":\"gpt-5.4\",\"input\":\"Say\ hello\ in\ one\ sentence.\"\}
const response = await fetch("https://runapi.ai/v1/responses", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"model": "gpt-5.4",
"input": "Say hello in one sentence."
})
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();
console.log(data);
Install
pip install requests
import requests
response = requests.post(
"https://runapi.ai/v1/responses",
headers={"Authorization": "Bearer YOUR_API_TOKEN", "Content-Type": "application/json"},
json={"model": "gpt-5.4", "input": "Say hello in one sentence."}
)
response.raise_for_status()
print(response.json())