anthropic

Claude Sonnet 4

Context length

2,00,000

Input price

$3.00/M

Output price

$15.00/M

Capabilities

reasoning coding tool_use vision

Claude Sonnet 4 is Anthropic’s mid-tier model balancing cost and capability. It handles complex reasoning tasks, writes production code, and supports tool use through the same request format as OpenAI function calling.

Model specifications

SpecificationValue
ProviderAnthropic
Context length200,000 tokens
Input pricing$3.00 per million tokens
Output pricing$15.00 per million tokens
CapabilitiesReasoning, coding, tool use, vision

Rhodes routes to Claude Sonnet 4 using the model string anthropic/claude-sonnet-4. The request format is OpenAI-compatible — same SDK, same parameters, only the model and baseURL change.

What it’s good for

Based on its capability set: multi-step reasoning tasks where GPT-4o is overkill but Llama 3.1 70B lacks the context window or instruction-following precision. Code generation for moderately complex functions (500-1000 lines). Research tasks requiring citation tracking across long documents (uses the full 200K context effectively).

Example usage

import OpenAI from 'openai';

const client = new OpenAI({
  baseURL: 'https://api.rhodes.ai/v1',
  apiKey: process.env.RHODES_KEY,
});

const response = await client.chat.completions.create({
  model: 'anthropic/claude-sonnet-4',
  messages: [{ role: 'user', content: 'Explain TCP congestion control.' }],
  max_tokens: 2000,
});

Compare with

vs GPT-4o: GPT-4o costs $2.50 input / $10 output (16% cheaper), has a 128K context window (38% smaller), and excels at creative tasks. Pick Sonnet 4 if you need the larger context or prefer Anthropic’s safety tuning. Pick GPT-4o for lower cost on sub-128K tasks.

vs Claude Opus 4: Opus costs $15 input / $75 output (5x more expensive) and is Anthropic’s strongest model for deep reasoning. Pick Sonnet 4 for production workloads where cost matters. Pick Opus for research tasks or when quality trumps cost.

FAQ

How much does Claude Sonnet 4 cost through Rhodes vs Anthropic direct?

Rhodes charges $3.00 per million input tokens, $15.00 per million output. Anthropic direct charges the same list price. The difference: Rhodes lets you use one prepaid balance across Claude and 40+ other models, while Anthropic direct bills monthly per provider.

Does streaming work?

Yes. Set stream: true in the request. Server-sent events arrive in the same format as OpenAI, parsed identically by the SDK.

Can I use tool calling?

Yes. Pass a tools array in the request. Claude Sonnet 4 handles tool calls through the same interface as GPT-4. Response format is OpenAI-compatible — your tool-use code does not change.

What’s the rate limit?

Default is 60 requests per minute per API key. Contact support to raise it if you need higher throughput for production workloads.

GPT-4o vs Claude Sonnet 4 — Compare pricing, context length, and capabilities side by side.

Getting Started Guide — Set up your first request to Rhodes in 5 minutes.

Model Fallbacks — Set backup models per request with automatic retry logic.