Send a message to an Anthropic-compatible model and receive a response
| 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) |
anthropic/claude-sonnet-4-20250514, anthropic/claude-3-7-sonnetopenai/gpt-4o, openai/gpt-4o-minigoogle/gemini-2.0-flash-expmistral/mistral-large-2411, meta/llama-3.3-70b-instructstream: true:
system parameter:
200 - Success400 - Bad Request (invalid parameters)401 - Unauthorized (invalid API key)403 - Forbidden (insufficient permissions)429 - Rate Limited500 - Internal Server Errorx-api-key header instead of Authorization: Bearermax_tokens: Unlike OpenAIβs API, the max_tokens parameter is requiredsystem parameter, not as a messageuser and assistant roles are supported in messages (no system role)Your Requesty API key
The version of the Anthropic API to use
"2023-06-01"
The model to use for the completion
"anthropic/claude-sonnet-4-20250514"
The maximum number of tokens to generate before stopping
x >= 11024
Input messages
System prompt to be used for the completion
Amount of randomness injected into the response
0 <= x <= 2Use nucleus sampling
0 <= x <= 1Only sample from the top K options for each subsequent token
x >= 0Whether to incrementally stream the response using server-sent events
Custom text sequences that will cause the model to stop generating
Definitions of tools that the model may use
How the model should use the provided tools
auto, any Message response
Unique object identifier
Object type
message Conversational role of the generated message
assistant Content generated by the model
The model that handled the request
The reason that we stopped
end_turn, max_tokens, stop_sequence, tool_use Which custom stop sequence was generated