Base URL
Authentication
Include your Requesty API key in the request headers using Anthropic’s standard format: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
Model Selection
You can use any model available in the Model Library. Examples:- Anthropic Models:
anthropic/claude-sonnet-4-20250514
,anthropic/claude-3-7-sonnet
- OpenAI Models:
openai/gpt-4o
,openai/gpt-4o-mini
- Google Models:
google/gemini-2.0-flash-exp
- Other Providers:
mistral/mistral-large-2411
,meta/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
:
Vision Support
Send images using the content blocks format:PDF Support
You can send PDFs, encoded in base 64 format:Tool Use
Define tools that the model can call:System Prompts
Include system instructions using thesystem
parameter:
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
Response Format
Successful responses follow the Anthropic Messages format:Key Differences from OpenAI Chat Completions
- Authentication: Uses
x-api-key
header instead ofAuthorization: Bearer
- Required
max_tokens
: Unlike OpenAI’s API, themax_tokens
parameter is required - Content Blocks: Messages use content blocks for rich content (text, images, tool calls)
- System Parameter: System prompts are specified as a separate
system
parameter, not as a message - Role Restrictions: Only
user
andassistant
roles are supported in messages (nosystem
role)
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
Your Requesty API key
The version of the Anthropic API to use
Example:
"2023-06-01"
Body
application/json
Response
Message response
The response is of type object
.