CalculateTokens

Claude Sonnet 5 vs GPT-4oSide-by-side pricing

Side-by-side API pricing and tokenizer details for Claude Sonnet 5 (Anthropic) and GPT-4o (OpenAI).

Side-by-side pricing

FeatureClaude Sonnet 5GPT-4o
ProviderAnthropicOpenAI
Input (per 1M tokens)$2.00$2.50
Output (per 1M tokens)$10.00$10.00
Context cachingYes — 90% off cached tokensNo
Batch API discount50% off50% off
Context window1M tokens128K tokens
TokenizerAnthropic tokenizer (Opus 4.7+)o200k_base (tiktoken)

Claude Sonnet 5: Introductory pricing through Aug 31, 2026. Standard price: $3.00 / $15.00 per MTok after that date.

GPT-4o: Deprecated by OpenAI. API access shuts down 2026-10-23; calls will error after that date. Prices are no longer listed on OpenAI's pricing page and could not be re-verified from a vendor source.

Real-world cost example

1,000 API requests per month, each with 500 input tokens and 200 output tokens (500K input + 200K output total).

Claude Sonnet 5
$3.0000
Input: $1.0000 +Output: $2.0000
GPT-4o
$3.2500
Input: $1.2500 +Output: $2.0000

Claude Sonnet 5 is 8% cheaper for this workload — saving $0.2500 per month at this volume.

Frequently asked questions

Yes, Claude Sonnet 5 is cheaper for the typical workload above. At $2.00/1M input and $10.00/1M output tokens, it costs $3.0000 versus $3.2500 for GPT-4o — a 8% difference. Costs scale linearly with request volume, so larger workloads amplify this gap.
Claude Sonnet 5 supports a 1M token context window. GPT-4o supports a 128K token context window. A larger context window lets you include more text — documents, conversation history, or code — in a single API call.
Claude Sonnet 5 supports context caching (90% off repeated tokens). It offers a 50% Batch API discount. GPT-4o does not support context caching. It offers a 50% Batch API discount.
No, they use different tokenizers. Claude Sonnet 5 uses the Anthropic tokenizer (Opus 4.7+), while GPT-4o uses o200k_base (tiktoken). Different tokenizers split text differently, so the same prompt will produce different token counts on each model — the effective cost difference may be larger or smaller than the per-token price difference alone suggests.
Claude Sonnet 5 (Anthropic): $2 input / $10 output per 1M tokens. GPT-4o (OpenAI): $2.5 input / $10 output per 1M tokens. Rates shown before caching or batch discounts.
For an 80% output / 20% input workload — typical for code generation or long-form writing — Claude Sonnet 5 costs $8.4000 per 1M total tokens and GPT-4o costs $8.5000. Claude Sonnet 5 is 1% cheaper for this pattern. For your exact ratio, paste a real prompt into the calculator above.
Claude Sonnet 5 has a 1M-token context window — approximately 750K words or ~3K pages of standard text. GPT-4o has a 128K-token context window — approximately 96K words or ~384 pages. (Estimates assume ~0.75 words per token.)

Calculate costs for your actual prompt

Paste your prompt into the calculator and get exact token counts using each model's real tokenizer — all in your browser.

Open calculator

Data provenance: Prices sourced directly from provider pricing pages.

Claude Sonnet 5 prices last verified from Anthropic pricing page.

GPT-4o prices last verified from OpenAI pricing page.

Prices may change. Always verify against the provider's current pricing page before making purchasing decisions.