import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.routeway.ai/v1",
api_key=os.getenv("ROUTEWAY_API_KEY")
)
response = client.responses.create(
model="gpt-4o",
input="What is the capital of France?"
)
print(response.output_text)
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.routeway.ai/v1",
apiKey: process.env.ROUTEWAY_API_KEY,
});
const response = await client.responses.create({
model: "gpt-4o",
input: "What is the capital of France?",
});
console.log(response.output_text);
curl https://api.routeway.ai/v1/responses \
-H "Authorization: Bearer $ROUTEWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"input": "What is the capital of France?"
}'
{
"id": "<string>",
"object": "response",
"created_at": 123,
"completed_at": 123,
"status": "<string>",
"incomplete_details": {
"reason": "<string>"
},
"model": "<string>",
"previous_response_id": "<string>",
"instructions": "<string>",
"output": [
{
"type": "message",
"id": "<string>",
"status": "in_progress",
"role": "user",
"content": [
{
"type": "input_text",
"text": "<string>"
}
],
"phase": "commentary"
}
],
"error": {
"code": "<string>",
"message": "<string>"
},
"tools": [
{
"type": "function",
"name": "<string>",
"description": "<string>",
"parameters": {},
"strict": true
}
],
"tool_choice": {
"type": "function",
"name": "<string>"
},
"truncation": "auto",
"parallel_tool_calls": true,
"text": {
"format": {
"type": "text"
},
"verbosity": "low"
},
"top_p": 123,
"presence_penalty": 123,
"frequency_penalty": 123,
"top_logprobs": 123,
"temperature": 123,
"reasoning": {
"effort": "none",
"summary": "concise"
},
"usage": {
"input_tokens": 123,
"output_tokens": 123,
"total_tokens": 123,
"input_tokens_details": {
"cached_tokens": 123
},
"output_tokens_details": {
"reasoning_tokens": 123
}
},
"max_output_tokens": 123,
"max_tool_calls": 123,
"store": true,
"background": true,
"service_tier": "<string>",
"prompt_cache_key": "<string>"
}{
"error": {
"message": "<string>",
"type": "<string>",
"status_code": 123,
"id": "<string>",
"param": "<string>",
"code": "<string>",
"tip": "<string>",
"docs": "https://docs.routeway.ai",
"support": "https://discord.gg/RjX2CpdPpd",
"community": {}
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"status_code": 123,
"id": "<string>",
"param": "<string>",
"code": "<string>",
"tip": "<string>",
"docs": "https://docs.routeway.ai",
"support": "https://discord.gg/RjX2CpdPpd",
"community": {}
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"status_code": 123,
"id": "<string>",
"param": "<string>",
"code": "<string>",
"tip": "<string>",
"docs": "https://docs.routeway.ai",
"support": "https://discord.gg/RjX2CpdPpd",
"community": {}
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"status_code": 123,
"id": "<string>",
"param": "<string>",
"code": "<string>",
"tip": "<string>",
"docs": "https://docs.routeway.ai",
"support": "https://discord.gg/RjX2CpdPpd",
"community": {}
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"status_code": 123,
"id": "<string>",
"param": "<string>",
"code": "<string>",
"tip": "<string>",
"docs": "https://docs.routeway.ai",
"support": "https://discord.gg/RjX2CpdPpd",
"community": {}
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"status_code": 123,
"id": "<string>",
"param": "<string>",
"code": "<string>",
"tip": "<string>",
"docs": "https://docs.routeway.ai",
"support": "https://discord.gg/RjX2CpdPpd",
"community": {}
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"status_code": 123,
"id": "<string>",
"param": "<string>",
"code": "<string>",
"tip": "<string>",
"docs": "https://docs.routeway.ai",
"support": "https://discord.gg/RjX2CpdPpd",
"community": {}
}
}Responses
Generate a unified response block from various input configurations.
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.routeway.ai/v1",
api_key=os.getenv("ROUTEWAY_API_KEY")
)
response = client.responses.create(
model="gpt-4o",
input="What is the capital of France?"
)
print(response.output_text)
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.routeway.ai/v1",
apiKey: process.env.ROUTEWAY_API_KEY,
});
const response = await client.responses.create({
model: "gpt-4o",
input: "What is the capital of France?",
});
console.log(response.output_text);
curl https://api.routeway.ai/v1/responses \
-H "Authorization: Bearer $ROUTEWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"input": "What is the capital of France?"
}'
{
"id": "<string>",
"object": "response",
"created_at": 123,
"completed_at": 123,
"status": "<string>",
"incomplete_details": {
"reason": "<string>"
},
"model": "<string>",
"previous_response_id": "<string>",
"instructions": "<string>",
"output": [
{
"type": "message",
"id": "<string>",
"status": "in_progress",
"role": "user",
"content": [
{
"type": "input_text",
"text": "<string>"
}
],
"phase": "commentary"
}
],
"error": {
"code": "<string>",
"message": "<string>"
},
"tools": [
{
"type": "function",
"name": "<string>",
"description": "<string>",
"parameters": {},
"strict": true
}
],
"tool_choice": {
"type": "function",
"name": "<string>"
},
"truncation": "auto",
"parallel_tool_calls": true,
"text": {
"format": {
"type": "text"
},
"verbosity": "low"
},
"top_p": 123,
"presence_penalty": 123,
"frequency_penalty": 123,
"top_logprobs": 123,
"temperature": 123,
"reasoning": {
"effort": "none",
"summary": "concise"
},
"usage": {
"input_tokens": 123,
"output_tokens": 123,
"total_tokens": 123,
"input_tokens_details": {
"cached_tokens": 123
},
"output_tokens_details": {
"reasoning_tokens": 123
}
},
"max_output_tokens": 123,
"max_tool_calls": 123,
"store": true,
"background": true,
"service_tier": "<string>",
"prompt_cache_key": "<string>"
}{
"error": {
"message": "<string>",
"type": "<string>",
"status_code": 123,
"id": "<string>",
"param": "<string>",
"code": "<string>",
"tip": "<string>",
"docs": "https://docs.routeway.ai",
"support": "https://discord.gg/RjX2CpdPpd",
"community": {}
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"status_code": 123,
"id": "<string>",
"param": "<string>",
"code": "<string>",
"tip": "<string>",
"docs": "https://docs.routeway.ai",
"support": "https://discord.gg/RjX2CpdPpd",
"community": {}
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"status_code": 123,
"id": "<string>",
"param": "<string>",
"code": "<string>",
"tip": "<string>",
"docs": "https://docs.routeway.ai",
"support": "https://discord.gg/RjX2CpdPpd",
"community": {}
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"status_code": 123,
"id": "<string>",
"param": "<string>",
"code": "<string>",
"tip": "<string>",
"docs": "https://docs.routeway.ai",
"support": "https://discord.gg/RjX2CpdPpd",
"community": {}
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"status_code": 123,
"id": "<string>",
"param": "<string>",
"code": "<string>",
"tip": "<string>",
"docs": "https://docs.routeway.ai",
"support": "https://discord.gg/RjX2CpdPpd",
"community": {}
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"status_code": 123,
"id": "<string>",
"param": "<string>",
"code": "<string>",
"tip": "<string>",
"docs": "https://docs.routeway.ai",
"support": "https://discord.gg/RjX2CpdPpd",
"community": {}
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"status_code": 123,
"id": "<string>",
"param": "<string>",
"code": "<string>",
"tip": "<string>",
"docs": "https://docs.routeway.ai",
"support": "https://discord.gg/RjX2CpdPpd",
"community": {}
}
}Create Response
To create a response, use the following endpoint:POST /v1/responses
Request Body
"gpt-4o", "gpt-4o-mini"). Only models that
advertise /v1/responses in their endpoints array are supported. See
Models for the full list.system message in Chat Completions."auto", "none", "required",
or an object specifying a particular tool.previous_response_id. Defaults to true.import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.routeway.ai/v1",
api_key=os.getenv("ROUTEWAY_API_KEY")
)
response = client.responses.create(
model="gpt-4o",
input="What is the capital of France?"
)
print(response.output_text)
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.routeway.ai/v1",
apiKey: process.env.ROUTEWAY_API_KEY,
});
const response = await client.responses.create({
model: "gpt-4o",
input: "What is the capital of France?",
});
console.log(response.output_text);
curl https://api.routeway.ai/v1/responses \
-H "Authorization: Bearer $ROUTEWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"input": "What is the capital of France?"
}'
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Body
- ItemReferenceParam
- ReasoningItemParam
- CompactionSummaryItemParam
- UserMessageItemParam
- SystemMessageItemParam
- DeveloperMessageItemParam
- AssistantMessageItemParam
- FunctionCallItemParam
- FunctionCallOutputItemParam
Show child attributes
Show child attributes
reasoning.encrypted_content, message.output_text.logprobs - FunctionToolParam
- ResponsesToolParam
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Whether to stream response events as server-sent events.
Whether to run the request in the background and return immediately.
x >= 16x >= 1Show child attributes
Show child attributes
64auto, disabled Whether to store the response so it can be retrieved later.
auto, default, flex, priority 0 <= x <= 20Response
Successful Response
The unique ID of the response that was created.
The object type, which was always response.
response The Unix timestamp (in seconds) for when the response was created.
The status that was set for the response.
Show child attributes
Show child attributes
The model that generated this response.
The output items that were generated by the model.
- Message
- FunctionCall
- FunctionCallOutput
- ReasoningBody
- CompactionBody
Show child attributes
Show child attributes
Show child attributes
Show child attributes
The tools that were available to the model during response generation.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
auto, disabled Whether the model was allowed to call multiple tools in parallel.
Show child attributes
Show child attributes
The nucleus sampling parameter that was used for this response.
The presence penalty that was used to penalize new tokens based on whether they appear in the text so far.
The frequency penalty that was used to penalize new tokens based on their frequency in the text so far.
The number of most likely tokens that were returned at each position, along with their log probabilities.
The sampling temperature that was used for this response.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Whether this response was stored so it can be retrieved later.
Whether this request was run in the background.
The service tier that was used for this response.
Was this page helpful?