AI Gateway
Claude Sonnet 4 significantly improves on Sonnet 3.7's industry-leading capabilities, excelling in coding with a state-of-the-art 72.7% on SWE-bench. The model balances performance and efficiency for internal and external use cases, with enhanced steerability for greater control over implementations. While not matching Opus 4 in most domains, it delivers an optimal mix of capability and practicality.
import { streamText } from 'ai'
const result = streamText({ model: 'anthropic/claude-sonnet-4', prompt: 'Why is the sky blue?'})
Try out Claude Sonnet 4 by Anthropic. Usage is billed to your team at API rates. Free users get $5 of credits every 30 days, and you are considered a free user if you haven't made a payment.
Chat with
Powered by AI Gateway
Anthropic
Available Model Variants
Claude Sonnet 4 now supports a 1M-token context (beta); opt in by sending the anthropic-beta: context-1m-2025-08-07
header. See the announcement and docs: news, context windows.
Pricing: only if total input tokens (prompt + cache reads/writes) exceed 200K, input is charged 2× and output 1.5×; otherwise standard rates apply. Details: long context pricing.
Context 200K
Input Tokens $3.00/M
Output Tokens $15.00/M
Cache Read Tokens $0.30/M
Cache Write Tokens $3.75/M
Amazon Bedrock
Context 200K
Input Tokens $3.00/M
Output Tokens $15.00/M
Cache Read Tokens $0.30/M
Cache Write Tokens $3.75/M
Vertex AI
Available Model Variants
Claude Sonnet 4 now supports a 1M-token context (beta); opt in by sending the anthropic-beta: context-1m-2025-08-07
header. See the announcement and docs: news, context windows.
Pricing: only if total input tokens (prompt + cache reads/writes) exceed 200K, input is charged 2× and output 1.5×; otherwise standard rates apply. Details: long context pricing.
Context 200K
Input Tokens $3.00/M
Output Tokens $15.00/M
Cache Read Tokens $0.30/M
Cache Write Tokens $3.75/M