C
AnthropicDeprecated

Claude Sonnet 4 API

Retiring soon. Migrate to Sonnet 4.6.

💰 Save up to 70% vs official Anthropic pricing
INPUT / 1M tokens
$3.00
OUTPUT / 1M tokens
$15.00
CONTEXT WINDOW
200K

Technical Specifications

ProviderAnthropic
Model FamilyClaude Sonnet 4
Release Date2024-06
Context Window200K
Max Output Tokens8,192
Input Price$3.00 / 1M tokens
Output Price$15.00 / 1M tokens
Vision SupportYes ✓
Function CallingYes ✓
JSON ModeNo
StreamingYes ✓
Fine TuningNot Available
StatusDeprecated ⚠

Overview

Claude Sonnet 4 is Anthropic's previous sonnet-class AI model, released in 2024-06. Retiring soon. Migrate to Sonnet 4.6.

With a 200K context window and maximum output of 8,192 tokens, Claude Sonnet 4 is well-suited for original sonnet 4 and retiring 2026-06-15. At $3.00/1M input and $15.00/1M output, it offers premium pricing within the Anthropic ecosystem.

Claude Sonnet 4 supports 3 capabilities: Vision, Tool Use, Streaming. Fine-tuning is not available for this model. The model serves as an original sonnet 4 solution for developers building multimodal AI applications.

Through AI API Hub, you can access Claude Sonnet 4 with USDT & USDC payments, no credit card required. All via a fully OpenAI-compatible API — just change your base URL and start building in 30 seconds.

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"}
    ]
  }'

Compare Alternatives

Frequently Asked Questions

What is Claude Sonnet 4?

Claude Sonnet 4 is Anthropic's previous sonnet model. Retiring soon. Migrate to Sonnet 4.6.. It features a 200K context window, supports Vision, Tool Use, Streaming, and is available through AI API Hub with USDT/USDC payments.

How much does Claude Sonnet 4 cost?

Claude Sonnet 4 pricing: $3.00 per 1M input tokens, $15.00 per 1M output tokens. Pay-as-you-go with no minimum commitment. Sign up at AI API Hub and start with as little as $5.

Claude Sonnet 4 vs GPT-5.5?

Claude Sonnet 4: $3.00/$1M input, 200K context. GPT-5.5: $5.00/$1M input, 256K context. Claude Sonnet 4 is more cost-effective. Original Sonnet 4. Compare them 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.

Get Claude Sonnet 4 API Access

Pay with USDT & USDC. Same model, up to 70% less.

Criar Conta
Obter Chave API