curl https://router.requesty.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_REQUESTY_API_KEY" \
-d '{
"model": "openai/gpt-4o-mini",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What is an LLM gateway?"
}
],
"max_tokens": 1024,
"temperature": 0.7
}'
from openai import OpenAI
client = OpenAI(
api_key="YOUR_REQUESTY_API_KEY",
base_url="https://router.requesty.ai/v1",
)
response = client.chat.completions.create(
model="openai/gpt-4o-mini",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is an LLM gateway?"},
],
max_tokens=1024,
temperature=0.7,
)
print(response.choices[0].message.content)
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.REQUESTY_API_KEY,
baseURL: "https://router.requesty.ai/v1",
});
const response = await client.chat.completions.create({
model: "openai/gpt-4o-mini",
messages: [
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: "What is an LLM gateway?" },
],
max_tokens: 1024,
temperature: 0.7,
});
console.log(response.choices[0].message.content);
{
"id": "chatcmpl-abc123def456",
"object": "chat.completion",
"created": 1748200000,
"model": "openai/gpt-4o-mini",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "An LLM gateway is a unified API layer that routes requests to multiple large language model providers. It normalizes different API formats, handles failover, load balancing, and provides centralized monitoring and cost tracking across providers like OpenAI, Anthropic, Google, and others."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 24,
"completion_tokens": 52,
"total_tokens": 76,
"cost": 0.000038
}
}
Create Chat Completion
Create a chat completion using various AI models. Compatible with the OpenAI Chat Completions format.
POST
/
v1
/
chat
/
completions
curl https://router.requesty.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_REQUESTY_API_KEY" \
-d '{
"model": "openai/gpt-4o-mini",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What is an LLM gateway?"
}
],
"max_tokens": 1024,
"temperature": 0.7
}'
from openai import OpenAI
client = OpenAI(
api_key="YOUR_REQUESTY_API_KEY",
base_url="https://router.requesty.ai/v1",
)
response = client.chat.completions.create(
model="openai/gpt-4o-mini",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is an LLM gateway?"},
],
max_tokens=1024,
temperature=0.7,
)
print(response.choices[0].message.content)
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.REQUESTY_API_KEY,
baseURL: "https://router.requesty.ai/v1",
});
const response = await client.chat.completions.create({
model: "openai/gpt-4o-mini",
messages: [
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: "What is an LLM gateway?" },
],
max_tokens: 1024,
temperature: 0.7,
});
console.log(response.choices[0].message.content);
{
"id": "chatcmpl-abc123def456",
"object": "chat.completion",
"created": 1748200000,
"model": "openai/gpt-4o-mini",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "An LLM gateway is a unified API layer that routes requests to multiple large language model providers. It normalizes different API formats, handles failover, load balancing, and provides centralized monitoring and cost tracking across providers like OpenAI, Anthropic, Google, and others."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 24,
"completion_tokens": 52,
"total_tokens": 76,
"cost": 0.000038
}
}
curl https://router.requesty.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_REQUESTY_API_KEY" \
-d '{
"model": "openai/gpt-4o-mini",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What is an LLM gateway?"
}
],
"max_tokens": 1024,
"temperature": 0.7
}'
from openai import OpenAI
client = OpenAI(
api_key="YOUR_REQUESTY_API_KEY",
base_url="https://router.requesty.ai/v1",
)
response = client.chat.completions.create(
model="openai/gpt-4o-mini",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is an LLM gateway?"},
],
max_tokens=1024,
temperature=0.7,
)
print(response.choices[0].message.content)
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.REQUESTY_API_KEY,
baseURL: "https://router.requesty.ai/v1",
});
const response = await client.chat.completions.create({
model: "openai/gpt-4o-mini",
messages: [
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: "What is an LLM gateway?" },
],
max_tokens: 1024,
temperature: 0.7,
});
console.log(response.choices[0].message.content);
{
"id": "chatcmpl-abc123def456",
"object": "chat.completion",
"created": 1748200000,
"model": "openai/gpt-4o-mini",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "An LLM gateway is a unified API layer that routes requests to multiple large language model providers. It normalizes different API formats, handles failover, load balancing, and provides centralized monitoring and cost tracking across providers like OpenAI, Anthropic, Google, and others."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 24,
"completion_tokens": 52,
"total_tokens": 76,
"cost": 0.000038
}
}
Web Search
Enable real-time web search by adding{ "type": "web_search" } to the tools array. Requesty translates this to each provider’s native web search format automatically.
{
"model": "anthropic/claude-sonnet-4-20250514",
"messages": [
{ "role": "user", "content": "What are the latest news in London today?" }
],
"tools": [{ "type": "web_search" }],
"stream": true
}
PDF Support
Send PDFs using theinput_file content type. You can provide the PDF as either base64-encoded data or a URL.
Using Base64-Encoded PDF
curl https://router.requesty.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_REQUESTY_API_KEY" \
-d '{
"model": "anthropic/claude-sonnet-4-20250514",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Summarize this PDF"
},
{
"type": "input_file",
"filename": "document.pdf",
"file_data": "data:application/pdf;base64,<base64-encoded-pdf-data>"
}
]
}
]
}'
Using PDF URL
curl https://router.requesty.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_REQUESTY_API_KEY" \
-d '{
"model": "anthropic/claude-sonnet-4-20250514",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Summarize this PDF"
},
{
"type": "input_file",
"filename": "document.pdf",
"file_data": "https://example.com/document.pdf"
}
]
}
]
}'
Parameters
type: Must be"input_file"filename: The name of the PDF file (e.g.,"document.pdf")file_data: Either base64-encoded PDF content or a URL to the PDF file
Authorizations
API key for authentication
Body
application/json
An array of message objects with role and content
Show child attributes
Show child attributes
The model name. If omitted, defaults to openai/gpt-4o-mini.
Example:
"openai/gpt-4o-mini"
Maximum number of tokens to generate
Controls randomness of the output
Controls diversity of the output
Enable Server-Sent Events (SSE) streaming responses
Available tools for the model. Supports function tools for custom function calling and web_search for real-time web search.
Show child attributes
Show child attributes
Specifies how tool calling should be handled
For structured responses (some models only)
Last modified on June 8, 2026
Was this page helpful?