A

Claude Sonnet 4

Anthropic
Vision Tools Streaming Reasoning Files
1M
Context
$3.00
Input /1M
$15.00
Output /1M
64K
Max Output

Claude Sonnet 4

Model Overview

Property Value
Provider Anthropic
Model Name Claude Sonnet 4
Model ID (for inference) anthropic/claude-sonnet-4
Permanent Slug anthropic/claude-4-sonnet-20250522
Created May 22, 2025
Context Length 1,000,000 tokens
Max Output Tokens 64,000 tokens

Description

Claude Sonnet 4 represents a significant upgrade from its predecessor, Claude Sonnet 3.7, with particular strength in coding and reasoning tasks. The model achieves state-of-the-art performance on SWE-bench with a score of 72.7%, demonstrating exceptional capability in software engineering tasks.

Key improvements include:

  • Enhanced autonomous codebase navigation
  • Reduced error rates in agent-driven workflows
  • Increased reliability following complex instructions
  • Improved precision and controllability
  • Better balance between capability and computational efficiency

The model targets practical everyday applications with advanced reasoning while maintaining efficiency, making it suitable for both development and production workloads.

Pricing

Standard Pricing (Google Vertex Provider)

Type Standard Rate High Volume Rate (200k+ threshold)
Input $3.00 / 1M tokens $6.00 / 1M tokens
Output $15.00 / 1M tokens $22.50 / 1M tokens
Input Cache Read $0.30 / 1M tokens $0.60 / 1M tokens
Input Cache Write $3.75 / 1M tokens $7.50 / 1M tokens
Image Input $4.80 / 1K images -

Price per Token (Detailed)

Type Price per Token
Input $0.000003
Output $0.000015
Cache Read $0.0000003
Cache Write $0.00000375

Capabilities

Capability Supported
Reasoning Mode Yes
Tool/Function Calling Yes
Vision (Image Analysis) Yes
File Processing Yes
Streaming Yes
Caching Yes

Supported Parameters

Parameter Description
max_tokens Maximum number of tokens to generate
top_p Nucleus sampling threshold
temperature Controls randomness (0-1)
stop Stop sequences to end generation
reasoning Enable reasoning mode
include_reasoning Include reasoning in response
tools List of available tools/functions
tool_choice Control tool selection behavior

Best Practices

  1. For Coding Tasks: Leverage the model's SWE-bench performance for code generation, review, and debugging
  2. For Agent Workflows: Take advantage of improved reliability in multi-step autonomous tasks
  3. For Long Context: Utilize the 1M token context window for large document analysis
  4. For Cost Optimization: Use caching for repeated context to reduce input costs
  5. For Complex Reasoning: Enable reasoning mode for step-by-step problem solving

API Usage Example

LangMart Format

curl https://api.langmart.ai/v1/chat/completions \
  -H "Authorization: Bearer $LANGMART_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-4",
    "messages": [
      {"role": "user", "content": "Hello, Claude!"}
    ]
  }'

LangMart Format

curl -X POST https://api.langmart.ai/v1/chat/completions \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-4",
    "messages": [
      {"role": "user", "content": "Hello, Claude!"}
    ],
    "max_tokens": 4096
  }'

With Reasoning Mode

curl -X POST https://api.langmart.ai/v1/chat/completions \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-4",
    "messages": [
      {"role": "user", "content": "Solve this step by step: ..."}
    ],
    "reasoning": true,
    "include_reasoning": true
  }'

With Tool Calling

curl -X POST https://api.langmart.ai/v1/chat/completions \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-4",
    "messages": [
      {"role": "user", "content": "What is the weather in Tokyo?"}
    ],
    "tools": [
      {
        "type": "function",
        "function": {
          "name": "get_weather",
          "description": "Get current weather for a location",
          "parameters": {
            "type": "object",
            "properties": {
              "location": {"type": "string"}
            },
            "required": ["location"]
          }
        }
      }
    ]
  }'

Claude 4 Family

Model Context Use Case
Claude Opus 4 1M tokens Highest capability, complex reasoning
Claude Sonnet 4 1M tokens Balanced performance and efficiency

Previous Generations

Model Context Notes
Claude 3.5 Sonnet 200K tokens Previous generation
Claude 3.7 Sonnet 200K tokens Immediate predecessor
Claude 3 Opus 200K tokens Previous flagship

Providers

Available Providers

Provider Endpoint Status
Google Vertex claude-sonnet-4@20250514 Primary
Anthropic Direct API Available
Amazon Bedrock AWS Integration Available

Provider Order (Default)

  1. Anthropic
  2. Amazon Bedrock
  3. Google Vertex

Supported Modalities

Input Modalities

  • Text
  • Images
  • Files

Output Modalities

  • Text only

Performance Metrics

Benchmarks

Benchmark Score
SWE-bench 72.7% (State-of-the-art)

Usage Statistics (December 2025)

Date Requests Prompt Tokens Completion Tokens
Dec 22, 2025 851,130 10.6B 438.3M
Dec 23, 2025 152,000+ - -

The model shows strong adoption with daily requests ranging from 326,000 to over 1 million.

Source