Claude Sonnet 4 API
Retiring soon. Migrate to Sonnet 4.6.
💰 Save up to 70% vs official Anthropic pricingClaude Sonnet 4 — cheaper than the official Anthropic API
Access Claude Sonnet 4 through AI API Hub and pay less per token. Same OpenAI-compatible endpoint, lower cost.
Technical Specifications
| Provider | Anthropic |
| Model Family | Claude Sonnet 4 |
| Release Date | 2024-06 |
| Context Window | 200K |
| Max Output Tokens | 8,192 |
| Input Price | $3.00 / 1M tokens |
| Output Price | $15.00 / 1M tokens |
| Vision Support | Yes ✓ |
| Function Calling | Yes ✓ |
| JSON Mode | No |
| Streaming | Yes ✓ |
| Fine Tuning | Not Available |
| Status | Deprecated ⚠ |
Overview
Claude Sonnet 4 is Anthropic's previous-generation sonnet model, released in 2024-06. Retiring soon. Migrate to Sonnet 4.6.
For developers, the headline numbers are a 200K context window and up to 8,192 output tokens per response — enough headroom for original sonnet 4 and retiring 2026-06-15 without chunking your input. Priced at $3.00/1M input and $15.00/1M output, it sits in the premium tier — best reserved for tasks where quality justifies the spend.
On the capability side, Claude Sonnet 4 exposes 3 features: Vision, Tool Use, Streaming. Note that fine-tuning isn't supported — you'll work with the base model. Vision support means you can pass images alongside text, handy for document parsing or UI automation.
The practical appeal of routing Claude Sonnet 4 through AI API Hub is simplicity: one OpenAI-compatible endpoint, USDT & USDC payments, no credit card, and you're calling the API in under 30 seconds — just swap your base URL.
What Makes Claude Sonnet 4 Different
How Claude Sonnet 4 is used
Claude Sonnet 4 is used for agentic workflows combining visual understanding with action — document processing pipelines that extract data and call APIs, visual Q&A systems, and multimodal agents. Tool calling enables it to trigger external functions based on what it sees in images.
Pricing position within Anthropic
Claude Sonnet 4 sits in the middle of Anthropic's pricing at $3.00/1M input — 14% below the lineup average ($1.00 cheapest, $5.00 most expensive). 1 sibling cost less, 2 cost more. This mid-tier positioning makes it a sensible default when you're unsure which variant to pick.
Claude Sonnet 4's role in the lineup
Within Anthropic's lineup, Claude Sonnet 4 is a mid-tier option — balanced between cost and capability. It's a standalone variant in its family. This makes it a safe default for production workloads where you're not sure which tier to pick.
Real-world use cases
Real-world deployments: document processing pipelines (read invoice → extract fields → call accounting API), visual Q&A systems, and multimodal agents that act on what they see. Claude Sonnet 4 handles the full see-decide-act loop in a single model call.
vs sibling models
What makes Claude Sonnet 4 different from sibling models: compared to Claude Opus 4.8 ($2.00/1M more expensive, 1M vs 200K context (larger)); Claude Sonnet 4.6 ($0.00/1M cheaper, 1M vs 200K context (larger)); Claude Haiku 4.5 ($2.00/1M cheaper, same 200K context). Choose Claude Sonnet 4 when vision input is needed.
API Examples
Python
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://api.apiyihe.org/v1"
)
response = client.chat.completions.create(
model="claude-sonnet-4",
messages=[
{"role": "user", "content": "Hello"}
]
)
print(response.choices[0].message.content)JavaScript / Node.js
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.API_KEY,
baseURL: "https://api.apiyihe.org/v1"
});
const response = await client.chat.completions.create({
model: "claude-sonnet-4",
messages: [
{ role: "user", content: "Hello" }
]
});
console.log(response.choices[0].message.content);cURL
curl https://api.apiyihe.org/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "claude-sonnet-4",
"messages": [
{"role": "user", "content": "Hello"}
]
}'Supported Features
| Vision / Image Input | ✅ Supported |
| Audio / Voice Input | ❌ Not Available |
| Function Calling | ✅ Supported |
| JSON Mode | ❌ Not Available |
| Streaming | ✅ Supported |
| Fine-Tuning | ❌ Not Available |
| Multimodal | ❌ Not Available |
Benchmark Scores
| Benchmark | Score |
|---|---|
| MMLU | Not Publicly Available |
| GPQA | Not Publicly Available |
| SWE-Bench | Not Publicly Available |
| HumanEval | Not Publicly Available |
| GSM8K | Not Publicly Available |
| MATH | Not Publicly Available |
| MMMU | Not Publicly Available |
Pricing History
Claude Sonnet 4 was released in 2024-06 by Anthropic and is currently deprecated — consider upgrading to a newer model.
Current Pricing: $3.00 per 1M input tokens · $15.00 per 1M output tokens. Pay-as-you-go with no minimum commitment.
Pricing Model: Token-based billing (pay per use). No subscription fees. No hidden costs.
💡 Anthropic occasionally updates pricing. AI API Hub reflects current pricing in real-time. All prices in USD. Pay with USDT or USDC — no currency conversion fees.
Compare Alternatives
Frequently Asked Questions
What is Claude Sonnet 4?
Claude Sonnet 4 is Anthropic's previous-generation sonnet model. Retiring soon. Migrate to Sonnet 4.6. It offers a 200K context window and supports Vision, Tool Use, Streaming. You can access it through AI API Hub using USDT or USDC — no credit card required.
How much does Claude Sonnet 4 cost?
Claude Sonnet 4 is priced at $3.00 per 1M input tokens and $15.00 per 1M output tokens, billed pay-as-you-go with no minimum. Through AI API Hub you can start with as little as $5 and scale from there.
Claude Sonnet 4 vs GPT-5.5?
They're built for different jobs. Claude Sonnet 4 costs $3.00/1M input with a 200K window; GPT-5.5 runs $5.00/1M input with 256K. Claude Sonnet 4 is the more cost-effective pick and still brings original sonnet 4. See the full side-by-side at /compare/claude-sonnet-4-vs-gpt-5.5/.
Claude Sonnet 4 context window?
Claude Sonnet 4 has a 200K context window, capable of processing up to 200,000 tokens in a single request. Maximum output tokens: 8,192.
Does Claude Sonnet 4 support function calling?
Yes, Claude Sonnet 4 supports function/tool calling, allowing you to define functions that the model can invoke. This enables AI agents, API integrations, and structured data extraction.
Is Claude Sonnet 4 multimodal?
Partially — Claude Sonnet 4 supports vision (image input) but not native audio processing.
Claude Sonnet 4 API rate limits?
Claude Sonnet 4 rate limits: 5K RPM. Higher tier plans offer increased throughput. For high-volume production use, consider Anthropic's faster variant models.
How to access Claude Sonnet 4 API?
Access Claude Sonnet 4 through AI API Hub: (1) Register at api.apiyihe.org/register?aff=8JZC, (2) Deposit USDT/USDC, (3) Get your API key instantly, (4) Use the OpenAI-compatible endpoint https://api.apiyihe.org/v1 with model name "claude-sonnet-4". Start building in under 30 seconds.