Anthropic
Chat and reasoning models from Anthropic on AI/ML API: model ids and API references.
Overview
Anthropic is an AI research and product company founded by former OpenAI researchers. The company is best known for its strong emphasis on AI safety, interpretability, and long-term alignment. Anthropic describes its mission as building “reliable, interpretable, and steerable” AI systems that can be safely deployed at scale.
Its product lineup spans lightweight Haiku models for fast inference, Sonnet models aimed at general-purpose production workloads, and Opus models designed for advanced reasoning, coding, and research tasks. Beyond chat assistants, Anthropic is actively expanding into agentic tooling with products such as Claude Code and enterprise integrations focused on automation, software engineering, and organizational workflows.
The chat models from this provider have some unique characteristics. Models from Anthropic can be accessed not only via the standard /v1/chat/completions endpoint but also through dedicated endpoints — /messages and /v1/batches.
The sections below describe their API schemas, usage specifics, and example requests.
Supported capabilities:
Text completions: Build advanced chat bots or text processors.
Function Calling: Utilize tools for specific tasks and API calling.
Stream mode: Get the text chat model responses as they are generated, rather than waiting for the entire response to be completed.
Batch Processing: Send many independent requests as one batch, at a lower price.
Vision Tasks: Process and analyze images.
Text Completions
Ask something and get an answer in a chat-like conversation format.
Model used to generate the response.
claude-sonnet-4-20250514Unique identifier of the generated message.
msg_01SUmNmSRFZsoa6h96MxJEHHObject type.
messageRole of the message author.
assistantReason why generation stopped.
end_turnCustom stop sequence that caused generation to stop.
Additional details about why generation stopped.
curl -L \
--request POST \
--url 'https://api.aimlapi.com/v1/messages' \
--header 'Authorization: Bearer <YOUR_AIMLAPI_KEY>' \
--header 'Content-Type: application/json' \
--data '{
"model": "claude-sonnet-4-20250514",
"messages": [
{
"role": "user",
"content": "Hello"
}
]
}'{
"model": "claude-sonnet-4-20250514",
"id": "msg_01SUmNmSRFZsoa6h96MxJEHH",
"type": "message",
"role": "assistant",
"content": [
{
"type": "text",
"text": "I'm functioning well, thank you for asking! I'm ready to help you with any questions or tasks you might have. How can I assist you today?"
}
],
"stop_reason": "end_turn",
"stop_sequence": "text",
"stop_details": null,
"usage": {
"input_tokens": 27,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0,
"cache_creation": {
"ephemeral_5m_input_tokens": 0,
"ephemeral_1h_input_tokens": 0
},
"output_tokens": 35,
"service_tier": "standard",
"inference_geo": "not_available"
},
"meta": {
"usage": {
"credits_used": 1576,
"usd_spent": 0.000788
}
}
}Example: Simple Text Response
Function Calling
To process text and use function calling, follow the examples below:
Example: Get Weather Information
Streaming Mode
To enable streaming of responses, set stream=True in your request payload.
Batch Processing
Batches are described on a separate page. Claude models run in the file-based Batch API, the same as models of other providers; the older inline format of /v1/batches is available for Claude models only.
Vision
Possible media types:
image/jpegimage/pngimage/gifimage/webp
Response Format
The responses from the AI/ML API for Anthropic models will typically include the generated text or results from the tool called. Here is an example response for a weather query:
Last updated
Was this helpful?