curl https://router.requesty.ai/v1/messages \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_REQUESTY_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "anthropic/claude-sonnet-5-5",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "Hello, Claude!"
}
]
}'
import anthropic
client = anthropic.Anthropic(
api_key="YOUR_REQUESTY_API_KEY",
base_url="https://router.requesty.ai",
)
message = client.messages.create(
model="anthropic/claude-sonnet-5-5",
max_tokens=1024,
messages=[
{"role": "user", "content": "Hello, Claude!"}
],
)
print(message.content[0].text)
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
apiKey: process.env.REQUESTY_API_KEY,
baseURL: "https://router.requesty.ai",
});
const message = await client.messages.create({
model: "anthropic/claude-sonnet-5-5",
max_tokens: 1024,
messages: [
{ role: "user", content: "Hello, Claude!" },
],
});
console.log(message.content[0].text);
{
"id": "msg_01ABC123",
"type": "message",
"role": "assistant",
"content": [
{
"type": "text",
"text": "Hello! I'm Claude, an AI assistant by Anthropic. How can I help you today?"
}
],
"model": "anthropic/claude-sonnet-5-5",
"stop_reason": "end_turn",
"usage": {
"input_tokens": 12,
"output_tokens": 20,
"cost": 0.000198
}
}
Create Message
Send a message to an Anthropic-compatible model and receive a response
POST
/
v1
/
messages
curl https://router.requesty.ai/v1/messages \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_REQUESTY_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "anthropic/claude-sonnet-5-5",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "Hello, Claude!"
}
]
}'
import anthropic
client = anthropic.Anthropic(
api_key="YOUR_REQUESTY_API_KEY",
base_url="https://router.requesty.ai",
)
message = client.messages.create(
model="anthropic/claude-sonnet-5-5",
max_tokens=1024,
messages=[
{"role": "user", "content": "Hello, Claude!"}
],
)
print(message.content[0].text)
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
apiKey: process.env.REQUESTY_API_KEY,
baseURL: "https://router.requesty.ai",
});
const message = await client.messages.create({
model: "anthropic/claude-sonnet-5-5",
max_tokens: 1024,
messages: [
{ role: "user", content: "Hello, Claude!" },
],
});
console.log(message.content[0].text);
{
"id": "msg_01ABC123",
"type": "message",
"role": "assistant",
"content": [
{
"type": "text",
"text": "Hello! I'm Claude, an AI assistant by Anthropic. How can I help you today?"
}
],
"model": "anthropic/claude-sonnet-5-5",
"stop_reason": "end_turn",
"usage": {
"input_tokens": 12,
"output_tokens": 20,
"cost": 0.000198
}
}
curl https://router.requesty.ai/v1/messages \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_REQUESTY_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "anthropic/claude-sonnet-5-5",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "Hello, Claude!"
}
]
}'
import anthropic
client = anthropic.Anthropic(
api_key="YOUR_REQUESTY_API_KEY",
base_url="https://router.requesty.ai",
)
message = client.messages.create(
model="anthropic/claude-sonnet-5-5",
max_tokens=1024,
messages=[
{"role": "user", "content": "Hello, Claude!"}
],
)
print(message.content[0].text)
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
apiKey: process.env.REQUESTY_API_KEY,
baseURL: "https://router.requesty.ai",
});
const message = await client.messages.create({
model: "anthropic/claude-sonnet-5-5",
max_tokens: 1024,
messages: [
{ role: "user", content: "Hello, Claude!" },
],
});
console.log(message.content[0].text);
{
"id": "msg_01ABC123",
"type": "message",
"role": "assistant",
"content": [
{
"type": "text",
"text": "Hello! I'm Claude, an AI assistant by Anthropic. How can I help you today?"
}
],
"model": "anthropic/claude-sonnet-5-5",
"stop_reason": "end_turn",
"usage": {
"input_tokens": 12,
"output_tokens": 20,
"cost": 0.000198
}
}
Base URL
https://router.requesty.ai/v1/messages
Authentication
Include your Requesty API key in the request headers using Anthropic’s standard format:x-api-key: YOUR_REQUESTY_API_KEY
Headers
| Header | Required | Description |
|---|---|---|
x-api-key | ✅ | Your Requesty API key (Anthropic format) |
Content-Type | ✅ | Must be application/json |
anthropic-version | ❌ | API version (defaults to 2023-06-01) |
Example Request
curl https://router.requesty.ai/v1/messages \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_REQUESTY_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "anthropic/claude-sonnet-5-5",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "Hello, Claude!"
}
]
}'
Model Selection
You can use any model available in the Model Library. Examples:- Anthropic Models:
anthropic/claude-sonnet-5-5,anthropic/claude-opus-5-5 - OpenAI Models:
openai/gpt-4o,openai/gpt-4o-mini - Google Models:
google/gemini-3.1-pro-preview - Other Providers:
mistral/mistral-large-4,deepinfra/meta-llama/Llama-3.3-70B-Instruct
While this endpoint uses the Anthropic Messages format, Requesty automatically handles format conversion for non-Anthropic models, so you
can use any supported model with this endpoint.
Streaming
Enable streaming responses by settingstream: true:
{
"model": "anthropic/claude-sonnet-5-5",
"max_tokens": 1024,
"stream": true,
"messages": [
{
"role": "user",
"content": "Write a short story"
}
]
}
Vision Support
Send images using the content blocks format:{
"model": "anthropic/claude-sonnet-5-5",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "What do you see in this image?"
},
{
"type": "image",
"source": {
"type": "base64",
"media_type": "image/jpeg",
"data": "/9j/4AAQSkZJRgABAQAAAQABAAD..."
}
}
]
}
]
}
PDF Support
You can send PDFs, encoded in base 64 format:{
"model": "anthropic/claude-sonnet-5-5",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "What is in this PDF?"
},
{
"type": "document",
"source": {
"type": "base64",
"media_type": "application/pdf",
"data": "JVBERi0=..."
}
}
]
}
]
}
Web Search
Enable real-time web search using Anthropic’s nativeweb_search_20250305 tool type:
{
"model": "anthropic/claude-sonnet-5-5",
"max_tokens": 4096,
"messages": [
{ "role": "user", "content": "What are the latest developments in AI?" }
],
"tools": [{
"type": "web_search_20250305",
"name": "web_search",
"max_uses": 5
}],
"stream": true
}
server_tool_use, web_search_tool_result, and text blocks with citations. See the Web Search guide for full response format details.
Tool Use
Define tools that the model can call:{
"model": "anthropic/claude-sonnet-5-5",
"max_tokens": 1024,
"tools": [
{
"name": "get_weather",
"description": "Get the current weather in a given location",
"input_schema": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
}
},
"required": ["location"]
}
}
],
"messages": [
{
"role": "user",
"content": "What's the weather like in New York?"
}
]
}
System Prompts
Include system instructions using thesystem parameter:
{
"model": "anthropic/claude-sonnet-5-5",
"max_tokens": 1024,
"system": "You are a helpful assistant that always responds in a friendly, professional manner.",
"messages": [
{
"role": "user",
"content": "Hello!"
}
]
}
Error Handling
The API returns standard HTTP status codes:200- Success400- Bad Request (invalid parameters)401- Unauthorized (invalid API key)403- Forbidden (insufficient permissions)413- Payload Too Large (request body exceeds 50 MB)429- Rate Limited500- Internal Server Error
{
"error": {
"type": "invalid_request_error",
"message": "max_tokens is required"
}
}
Response Format
Successful responses follow the Anthropic Messages format:{
"id": "msg_01ABC123",
"type": "message",
"role": "assistant",
"content": [
{
"type": "text",
"text": "Hello! I'm Claude, an AI assistant. How can I help you today?"
}
],
"model": "anthropic/claude-sonnet-5-5",
"stop_reason": "end_turn",
"usage": {
"input_tokens": 12,
"output_tokens": 18,
"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, no extra request parameter is needed. See Cost Tracking.
Key Differences from OpenAI Chat Completions
- Authentication: Uses
x-api-keyheader instead ofAuthorization: Bearer - Required
max_tokens: Unlike OpenAI’s API, themax_tokensparameter is required - Content Blocks: Messages use content blocks for rich content (text, images, tool calls)
- System Parameter: System prompts are specified as a separate
systemparameter, not as a message - Role Restrictions: Only
userandassistantroles are supported in messages (nosystemrole)
For the most seamless experience with Anthropic models, use this endpoint. For broader compatibility across all providers, consider using
the Chat Completions endpoint instead.
Headers
Body
application/json
Response
Message response
Last modified on November 12, 2026
Was this page helpful?