Claude's family of models leads on coding, analysis, and long-context tasks with a 200k token context window. Known for lower hallucination rates and nuanced instruction following.
You need best-in-class coding or reasoning
Long context (200k tokens) is required
You want lower hallucination rates on factual tasks
What drives the Trust Score
Last 12 months
You need a very large catalog of open-source model variants
Budget is tight and a smaller model suffices
You need real-time streaming at very high throughput
Free tier & paid plans
No free tier
$0.003/1K tokens (Haiku) · $0.015/1K (Sonnet)
Pay-per-use, no subscription
Estimate your Anthropic API cost
Estimated monthly cost
$12 – $150/mo
Haiku: ~$0.001/1K · Sonnet: ~$0.003/1K · Opus: ~$0.015/1K
Estimates only. Verify with official pricing pages before budgeting.
Other options worth considering
Complementary tools that pair well with Anthropic API
Docs, videos, tutorials, and courses
Repository and installation options
View on GitHub
github.com/anthropic-ai/anthropic-sdk-node
npm install @anthropic-ai/sdkpip install anthropicCopy and adapt to get going fast
import Anthropic from '@anthropic-ai/sdk';
const client = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY });
const message = await client.messages.create({
model: 'claude-sonnet-4-6',
max_tokens: 1024,
messages: [{ role: 'user', content: 'Hello!' }],
});
console.log(message.content[0].text);Common usage patterns
Streaming with TypeScript
Stream tokens in real time
import Anthropic from '@anthropic-ai/sdk';
const client = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY });
const stream = await client.messages.stream({
model: 'claude-sonnet-4-6',
max_tokens: 1024,
messages: [{ role: 'user', content: 'Write a haiku.' }],
});
for await (const event of stream) {
if (event.type === 'content_block_delta') {
process.stdout.write(event.delta.text ?? '');
}
}Vision — analyze an image
Pass a base64 image or URL to Claude
const message = await client.messages.create({
model: 'claude-sonnet-4-6',
max_tokens: 1024,
messages: [{
role: 'user',
content: [
{
type: 'image',
source: { type: 'url', url: 'https://example.com/chart.png' },
},
{ type: 'text', text: 'What does this chart show?' },
],
}],
});Tool use (function calling)
Let Claude call your functions
const response = await client.messages.create({
model: 'claude-sonnet-4-6',
max_tokens: 1024,
tools: [{
name: 'get_stock_price',
description: 'Get the current stock price',
input_schema: {
type: 'object',
properties: { ticker: { type: 'string' } },
required: ['ticker'],
},
}],
messages: [{ role: 'user', content: 'What is AAPL trading at?' }],
});Real experiences from developers who've used this tool