curl https://router.requesty.ai/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_REQUESTY_API_KEY" \
-d '{
"model": "openai-responses/gpt-5",
"input": "Tell me a three sentence bedtime story about a unicorn."
}'
from openai import OpenAI
client = OpenAI(
api_key="YOUR_REQUESTY_API_KEY",
base_url="https://router.requesty.ai/v1",
)
response = client.responses.create(
model="openai-responses/gpt-5",
input="Tell me a three sentence bedtime story about a unicorn.",
)
print(response.output_text)
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.REQUESTY_API_KEY,
baseURL: "https://router.requesty.ai/v1",
});
const response = await client.responses.create({
model: "openai-responses/gpt-5",
input: "Tell me a three sentence bedtime story about a unicorn.",
});
console.log(response.output_text);
{
"id": "resp_abc123",
"object": "response",
"created_at": 1748200000,
"model": "openai-responses/gpt-5",
"output": [
{
"type": "message",
"role": "assistant",
"content": [
{
"type": "output_text",
"text": "Once upon a time, a tiny unicorn named Sparkle discovered a rainbow bridge leading to a hidden meadow. She danced under the stars with fireflies until the moon sang her a lullaby. And every night after, Sparkle dreamed of adventures yet to come."
}
]
}
],
"usage": {
"input_tokens": 15,
"output_tokens": 58,
"total_tokens": 73
}
}
Create Response
Send input to an OpenAI-compatible model using the Responses API format and receive a response.
curl https://router.requesty.ai/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_REQUESTY_API_KEY" \
-d '{
"model": "openai-responses/gpt-5",
"input": "Tell me a three sentence bedtime story about a unicorn."
}'
from openai import OpenAI
client = OpenAI(
api_key="YOUR_REQUESTY_API_KEY",
base_url="https://router.requesty.ai/v1",
)
response = client.responses.create(
model="openai-responses/gpt-5",
input="Tell me a three sentence bedtime story about a unicorn.",
)
print(response.output_text)
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.REQUESTY_API_KEY,
baseURL: "https://router.requesty.ai/v1",
});
const response = await client.responses.create({
model: "openai-responses/gpt-5",
input: "Tell me a three sentence bedtime story about a unicorn.",
});
console.log(response.output_text);
{
"id": "resp_abc123",
"object": "response",
"created_at": 1748200000,
"model": "openai-responses/gpt-5",
"output": [
{
"type": "message",
"role": "assistant",
"content": [
{
"type": "output_text",
"text": "Once upon a time, a tiny unicorn named Sparkle discovered a rainbow bridge leading to a hidden meadow. She danced under the stars with fireflies until the moon sang her a lullaby. And every night after, Sparkle dreamed of adventures yet to come."
}
]
}
],
"usage": {
"input_tokens": 15,
"output_tokens": 58,
"total_tokens": 73
}
}
curl https://router.requesty.ai/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_REQUESTY_API_KEY" \
-d '{
"model": "openai-responses/gpt-5",
"input": "Tell me a three sentence bedtime story about a unicorn."
}'
from openai import OpenAI
client = OpenAI(
api_key="YOUR_REQUESTY_API_KEY",
base_url="https://router.requesty.ai/v1",
)
response = client.responses.create(
model="openai-responses/gpt-5",
input="Tell me a three sentence bedtime story about a unicorn.",
)
print(response.output_text)
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.REQUESTY_API_KEY,
baseURL: "https://router.requesty.ai/v1",
});
const response = await client.responses.create({
model: "openai-responses/gpt-5",
input: "Tell me a three sentence bedtime story about a unicorn.",
});
console.log(response.output_text);
{
"id": "resp_abc123",
"object": "response",
"created_at": 1748200000,
"model": "openai-responses/gpt-5",
"output": [
{
"type": "message",
"role": "assistant",
"content": [
{
"type": "output_text",
"text": "Once upon a time, a tiny unicorn named Sparkle discovered a rainbow bridge leading to a hidden meadow. She danced under the stars with fireflies until the moon sang her a lullaby. And every night after, Sparkle dreamed of adventures yet to come."
}
]
}
],
"usage": {
"input_tokens": 15,
"output_tokens": 58,
"total_tokens": 73
}
}
Base URL
https://router.requesty.ai/v1/responses
Authentication
The Responses endpoint accepts either OpenAI-style bearer auth or Anthropic-stylex-api-key auth. Use whichever your client library expects.
Authorization: Bearer YOUR_REQUESTY_API_KEY
x-api-key: YOUR_REQUESTY_API_KEY
Headers
| Header | Required | Description |
|---|---|---|
Authorization | ✅ * | Bearer token with your Requesty key |
x-api-key | ✅ * | Your Requesty API key (alternative) |
Content-Type | ✅ | Must be application/json |
Authorization or x-api-key.
Example Request
curl https://router.requesty.ai/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_REQUESTY_API_KEY" \
-d '{
"model": "openai-responses/gpt-5",
"input": "Tell me a three sentence bedtime story about a unicorn."
}'
Using the OpenAI SDK
The Responses endpoint is fully compatible with the official OpenAI SDK. Just pointbase_url at Requesty:
from openai import OpenAI
client = OpenAI(
api_key="YOUR_REQUESTY_API_KEY",
base_url="https://router.requesty.ai/v1",
)
response = client.responses.create(
model="openai-responses/gpt-5",
input="Tell me a three sentence bedtime story about a unicorn.",
)
print(response.output_text)
Model Selection
You can use any model available in the Model Library. Requesty translates the request shape for non-OpenAI providers automatically.- OpenAI Models:
openai-responses/gpt-5,openai-responses/gpt-5-mini,openai-responses/gpt-4.1,openai-responses/gpt-4o - Anthropic Models:
anthropic/claude-sonnet-4-5,anthropic/claude-opus-4 - Google Models:
google/gemini-2.5-pro,google/gemini-2.5-flash - Other Providers:
mistral/mistral-large-2411,meta/llama-3.3-70b-instruct
response.* event stream), use the openai-responses/ prefix. The standard openai/ prefix routes through Chat Completions under the hood.Input Formats
Theinput field accepts either a plain string or an array of input items. Use the array form for multi-turn conversations, tool results, and rich content.
String input
{
"model": "openai-responses/gpt-5",
"input": "Write a haiku about routers."
}
Multi-turn input
{
"model": "openai-responses/gpt-5",
"input": [
{ "role": "user", "content": "Hi, my name is John." },
{ "role": "assistant", "content": "Hello John, nice to meet you." },
{ "role": "user", "content": "What is my name?" }
]
}
Instructions
Use theinstructions parameter to set a system-level prompt that applies to the entire request. It is equivalent to a system or developer message at the start of the conversation.
{
"model": "openai-responses/gpt-5",
"instructions": "You are a helpful assistant that always responds in JSON.",
"input": "Summarize the weather in Paris today."
}
Streaming
Enable streaming by settingstream: true. The response is delivered as Server-Sent Events using the OpenAI Responses event format (response.created, response.output_text.delta, response.completed, etc.).
{
"model": "openai-responses/gpt-5",
"input": "Write a short story.",
"stream": true
}
usage block with cost on streaming requests, no additional parameter is required. The response.completed event includes the full usage object.
Vision Support
Send images using theinput_image content type. You can pass an image URL or a base64 data URL.
{
"model": "openai-responses/gpt-5",
"input": [
{
"role": "user",
"content": [
{ "type": "input_text", "text": "What is in this image?" },
{
"type": "input_image",
"image_url": "https://example.com/image.jpg"
}
]
}
]
}
PDF Support
Send PDFs using theinput_file content type. You can provide the PDF as either a base64 data URL or a remote URL.
{
"model": "openai-responses/gpt-5",
"input": [
{
"role": "user",
"content": [
{ "type": "input_text", "text": "Summarize this PDF." },
{
"type": "input_file",
"filename": "document.pdf",
"file_data": "data:application/pdf;base64,<base64-encoded-pdf-data>"
}
]
}
]
}
Web Search
Enable real-time web search by adding{ "type": "web_search" } to the tools array. The response includes web_search_call output items and url_citation annotations on text content.
{
"model": "openai-responses/gpt-4.1",
"input": "What are the latest developments in artificial intelligence?",
"tools": [{ "type": "web_search" }],
"stream": true
}
Tool Use
Define tools the model may call. The Responses API uses a flatter shape than Chat Completions:name, description, and parameters live at the top level of each tool entry.
{
"model": "openai-responses/gpt-5",
"input": "What is the weather like in New York?",
"tools": [
{
"type": "function",
"name": "get_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
}
},
"required": ["location"]
},
"strict": true
}
]
}
function_call_output item in input:
{
"model": "openai-responses/gpt-5",
"input": [
{
"type": "function_call",
"name": "get_weather",
"call_id": "call_abc123",
"arguments": "{\"location\": \"New York, NY\"}"
},
{
"type": "function_call_output",
"call_id": "call_abc123",
"output": "{\"temperature\": 68, \"conditions\": \"sunny\"}"
}
]
}
Reasoning
For reasoning-capable models (e.g.openai-responses/gpt-5, openai-responses/o3), configure reasoning effort and the optional summary:
{
"model": "openai-responses/gpt-5",
"input": "Plan a three day trip to Tokyo.",
"reasoning": {
"effort": "medium",
"summary": "auto"
}
}
effort:low,medium, orhigh. Lower effort produces faster responses with fewer reasoning tokens.summary:auto,concise, ordetailed. Controls whether the model returns a reasoning summary alongside the final answer.
Structured Outputs
Settext.format to enforce JSON-mode or a strict JSON Schema on the output.
{
"model": "openai-responses/gpt-5",
"input": "Extract entities from: The quick brown fox jumps over the lazy dog.",
"text": {
"format": {
"type": "json_schema",
"name": "Entities",
"strict": true,
"schema": {
"type": "object",
"properties": {
"animals": { "type": "array", "items": { "type": "string" } }
},
"required": ["animals"]
}
}
}
}
Response Format
A successful response follows the OpenAI Responses format:{
"id": "resp_01ABC123",
"object": "response",
"created_at": 1730000000,
"model": "openai-responses/gpt-5",
"status": "completed",
"output": [
{
"id": "msg_01ABC123",
"type": "message",
"role": "assistant",
"status": "completed",
"content": [
{
"type": "output_text",
"text": "Once upon a time, a unicorn..."
}
]
}
],
"usage": {
"input_tokens": 12,
"input_tokens_details": { "cached_tokens": 0 },
"output_tokens": 27,
"output_tokens_details": { "reasoning_tokens": 0 },
"total_tokens": 39,
"cost": 0.000234
}
}
cost field inside usage is a Requesty extension and reports the USD cost of the request. It is returned by default on non-streaming responses, and on the final response.completed event when streaming. See Cost Tracking.
Error Handling
The API returns standard HTTP status codes:200- Success400- Bad Request (invalid parameters)401- Unauthorized (invalid API key)403- Forbidden (insufficient permissions)429- Rate Limited500- Internal Server Error
Key Differences from OpenAI Chat Completions
inputinstead ofmessages: Accepts a string or a list of typed items (messages, tool calls, tool results, reasoning).instructionsinstead of system messages: System prompts are passed via the top-levelinstructionsfield.- Flat tool shape: Tools declare
name,description, andparametersdirectly, without the nestedfunctionwrapper. - Content types are prefixed:
input_text,input_image,input_filefor user inputs;output_textandoutput_refusalfor model outputs. - Event-typed streaming: Streaming uses named events (
response.created,response.output_text.delta,response.completed) rather than choice deltas. max_output_tokensinstead ofmax_tokens: Caps the total of visible and reasoning tokens.
responses.create(...) interface, use this endpoint. For broader
portability across providers, consider the Chat Completions endpoint instead.Headers
Your Requesty API key. Alternative to the standard Authorization: Bearer header.
Body
The model to use for the response. To route OpenAI models through their native Responses API, use the openai-responses/ prefix (e.g. openai-responses/gpt-5).
"openai-responses/gpt-5"
Text, image, or file inputs to the model. Either a plain string or an array of typed input items.
"Tell me a three sentence bedtime story about a unicorn."
Inserts a system (or developer) message as the first item in the model's context.
Upper bound for the number of tokens that can be generated, including visible output tokens and reasoning tokens.
x >= 1If true, the response is streamed to the client as it is generated using server-sent events.
Sampling temperature between 0 and 2. Higher values produce more random output.
0 <= x <= 2Nucleus sampling: consider tokens with cumulative probability mass up to top_p.
0 <= x <= 1Whether to allow the model to run tool calls in parallel.
Controls which (if any) tool is called by the model.
auto, none, required Tools the model may call.
Show child attributes
Show child attributes
Reasoning configuration for reasoning-capable models.
Show child attributes
Show child attributes
Output text configuration, including structured output format.
Show child attributes
Show child attributes
Specify additional output data to include in the model response.
Set of key-value pairs that can be attached to the request.
Show child attributes
Show child attributes
Whether to store the generated model response for later retrieval via API.
The truncation strategy to use for the model response.
A unique identifier representing your end-user.
Response
Response
Unique identifier for this response.
Object type.
response Unix timestamp (in seconds) of when the response was created.
Model ID used to generate the response.
Status of the response generation.
completed, failed, in_progress, incomplete Output items from the model. Typically one or more message, function_call, or reasoning items.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Was this page helpful?