Claude Sonnet 5 API

Install any OpenAI-compatible SDK, point it at api.aimlapi.com/v1, and set the model to anthropic/claude-sonnet-5.

Modalities
TextText
In / Out price
$2/$10per 1M
Context window
1M tokens
Released
Jun 30, 2026

Claude Sonnet 5 overview

The pelican test: one prompt, every text model, unedited SVG output from Nov 3, 2026.

SVG of a pelican riding a bicycle, written by Claude Sonnet 5 through AI/ML API

Claude Sonnet 5 by Anthropic

Claude Sonnet 5 API combines strong reasoning, adaptive thinking, and high-resolution vision for complex coding, agent loops, and long-document analysis.

Claude Sonnet 5 specs

Model ID
anthropic/claude-sonnet-5
Developer
Anthropic
Context window
1,000,000 tokens
Max output
128,000 tokens
Input
Text
Output
Text
API
OpenAI-compatible, base URL https://api.aimlapi.com/v1

Claude Sonnet 5 is Anthropic's high-performance language model for coding, agentic workflows, and complex reasoning. It delivers performance approaching Claude Opus quality at Sonnet pricing, with a 1M token context window, adaptive thinking, and high-resolution vision built in.

The model is available via AI/ML API using the model ID anthropic/claude-sonnet-5 and ships under Anthropic's standard commercial terms.

[Performance Benchmarks embed]

Coding and code review
Claude Sonnet 5 is optimized for writing, debugging, and reviewing code across all major languages. The 1M context window means entire codebases can be loaded for refactoring or cross-file analysis in a single prompt.

Use cases

Claude Sonnet 5 is documented as suited for coding workflows, including initial planning, implementation, debugging, maintenance, and large-scale refactors across complex multi-file codebases.

It is also suited for autonomous AI workflows and production-grade agents, with strong instruction following, tool selection, error correction, and sustained multi-step task handling for customer-facing agents and internal automation.

Another documented use case is browser-based computer use, where it can handle tasks such as competitive analysis, procurement workflows, and customer onboarding.

It is further suited to professional work involving finance, research, content, and business operations, including analyzing financial data, synthesizing information from multiple sources, and generating or editing documents and spreadsheets.

Capabilities

  • Streaming

Claude Sonnet 5 benchmarks by Artificial Analysis

See how Claude Sonnet 5 compares in generation speed. Data retrieved Nov 3, 2026.

Speed

Output tokens / second

Benchmark results

Compare 8 models available on AI/ML API across 5 independent benchmarks.

Humanity's Last Exam

Expert-written questions across academic subjects.

Claude Sonnet 5 API pricing

Claude Sonnet 5 pricing in US dollars
UsagePriceUnit
Input$21M tokens
Output$101M tokens
Cached input$0.21M tokens

Prices from the AI/ML API price list, checked on Nov 4, 2026.

Claude Sonnet 5 vs other models: token prices

AI/ML API input and output rates for 5 models, per million tokens.

AI/ML API model prices in USD per million tokens
ModelInputOutput
Claude Sonnet 5$2$10
Claude Haiku 5.5$0.1$0.5
Claude Sonnet 5.5$2$10
Claude Opus 5.5$4$20
Claude Fable 5.1$10$50

How to use the Claude Sonnet 5 API

View docs

Build with your agent

Give your agent the model details, code and documentation.

1Get your API key

Create API key
export AIMLAPI_KEY="8f2b4c7d9a1e6b3f…"

2Make your first request

curl 'https://api.aimlapi.com/v1/chat/completions' \
  -H "Authorization: Bearer $AIMLAPI_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "anthropic/claude-sonnet-5",
  "messages": [
    {
      "role": "user",
      "content": "Write a haiku about the ocean."
    }
  ]
}'

Related articles

All posts

Claude Sonnet 5 FAQ

How much does Claude Sonnet 5 cost?

Claude Sonnet 5 costs $2 input and $10 output per 1M tokens on AI/ML API, billed as you go with no subscription.

How long does Chat GPT take to make an image?

GPT-Image-1.5 is 4x Faster than the previous models – DALL-E 3 and GPT-Image-1. Detailed high resolution images now take near 30 seconds to be generated.

What is the difference between TTS-1 and TTS-1-HD?

TTS-1-HD produces higher-fidelity audio with more natural prosody and tone, while TTS-1 is optimized for speed and lower cost.

When was gpt-image-1.5 released?

GPT-Image-1.5 was released on December 16, 2025. OpenAI made the model available globally to all ChatGPT users and through the API on this date, marking a significant upgrade to their image generation capabilities.

What formats are supported?

It returns audio in mp3, opus, aac, flac, wav, pcm formats.

How to use gpt-image-1.5 API?

1. Register on our platform

2. Verify your account

3. Create an API key

4. Copy the code from this page

5. Paste it in your project

What is the Claude Sonnet 5 model ID?

Use anthropic/claude-sonnet-5 as the model parameter. Requests go to the OpenAI-compatible endpoint with your AI/ML API key.

What is the context window of Claude Sonnet 5?

Claude Sonnet 5 accepts up to 1,000,000 tokens of context and returns up to 128,000 output tokens.

Start building with Claude Sonnet 5

Claude Sonnet 5 API

anthropic/claude-sonnet-5

Build with your agent

Give your agent the model details, code and documentation.

1Get your API key

Create API key
export AIMLAPI_KEY="8f2b4c7d9a1e6b3f…"

2Make your first request

curl 'https://api.aimlapi.com/v1/chat/completions' \
  -H "Authorization: Bearer $AIMLAPI_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "anthropic/claude-sonnet-5",
  "messages": [
    {
      "role": "user",
      "content": "Write a haiku about the ocean."
    }
  ]
}'