OpenAI vs Anthropic vs Google: LLM API Pricing and Performance Compared
OpenAI vs Anthropic vs Google: LLM API Pricing and Performance Compared
I spend between $200 and $400 per month on LLM API calls across different projects. Choosing the right model for each task has a real impact on both cost and output quality. I have tested all three major providers extensively, and here is my honest comparison based on actual usage data, not marketing pages.
The Models I Compared
For a fair comparison, I tested the flagship models from each provider:
- OpenAI: GPT-4o ($5/1M input tokens, $15/1M output tokens)
- Anthropic: Claude 3.5 Sonnet ($3/1M input tokens, $15/1M output tokens)
- Google: Gemini 2.0 Pro ($1.25/1M input tokens, $5/1M output tokens)
I also tested the budget models from each provider: GPT-4o mini, Claude 3 Haiku, and Gemini 2.0 Flash, because most of my API usage goes through cheaper models.
My Test Workload
I ran each model through four tasks that represent my actual usage:
- Content writing: 500-word articles from an outline (creative, requires good prose)
- Code generation: Implementing a REST API endpoint from a specification
- Data extraction: Pulling structured data from unstructured text
- Summarization: Condensing a 2000-word document into a 300-word summary
I ran each task 20 times per model and measured output quality, latency, and cost.
Writing Quality
For content writing, Claude 3.5 Sonnet was clearly the best. Its prose reads more naturally, it handles tone and voice better, and it follows instructions about style more precisely. GPT-4o produces competent writing but it tends to be formulaic. Gemini 2.0 Pro falls in between.
For my writing-heavy tasks, I use Claude 3.5 Sonnet almost exclusively. The quality difference is worth the cost premium over the budget models.
Code Generation
This was the closest category. GPT-4o produced working code on the first try 85% of the time. Claude 3.5 Sonnet hit 82%. Gemini 2.0 Pro was at 78%.
Where GPT-4o excels is in understanding complex specifications. It handles nuanced requirements like "use optimistic locking with retry logic" more reliably than the others. Claude is better at writing clean, well-documented code. Gemini is fast but occasionally makes subtle errors.
For production code that will be reviewed anyway, I use Claude 3.5 Sonnet for the readability. For quick prototypes and scripts, GPT-4o mini is fast and cheap enough.
Data Extraction
Gemini 2.0 Pro surprised me here. Its large context window (up to 2M tokens) means it can process entire documents at once rather than chunking them. For extracting structured data from long PDFs or reports, Gemini's performance was strong.
Claude 3.5 Sonnet with its 200K context window was also excellent for extraction tasks within its context limit. GPT-4o handles 128K tokens, which is sufficient for most extraction work.
Cost Analysis
Let me break down the actual numbers based on my test workload.
For the writing task (about 2000 tokens input, 1000 tokens output per request):
- GPT-4o: $0.025 per request
- Claude 3.5 Sonnet: $0.021 per request
- Gemini 2.0 Pro: $0.0075 per request
For the code generation task (about 3000 tokens input, 1500 tokens output per request):
- GPT-4o: $0.0375 per request
- Claude 3.5 Sonnet: $0.0315 per request
- Gemini 2.0 Pro: $0.01125 per request
Gemini 2.0 Pro is dramatically cheaper. If cost is your primary concern and the quality is adequate for your use case, Gemini wins by a wide margin.
My Actual Strategy
I do not use one provider exclusively. Here is how I distribute my workload:
- Claude 3.5 Sonnet for all writing tasks, editorial work, and content that will be read by humans
- GPT-4o for code generation, complex reasoning, and tasks that benefit from function calling
- Claude 3 Haiku for simple classification, short summaries, and high-volume tasks
- GPT-4o mini for embeddings and tasks that need to be extremely fast
- Gemini 2.0 Flash for data extraction and tasks with very large inputs
This model routing adds complexity but cuts my monthly API bill by about 40% compared to using GPT-4o for everything.
Latency Differences
Speed matters when you are building user-facing applications. In my tests, Gemini 2.0 Flash was the fastest, often returning responses in under 500ms. Claude 3 Haiku was close. GPT-4o mini averaged about 700ms for similar tasks.
The flagship models were all slower: GPT-4o averaged 2-4 seconds, Claude 3.5 Sonnet averaged 2-3 seconds, and Gemini 2.0 Pro averaged 1.5-3 seconds.
The Bottom Line
There is no single "best" provider. The right choice depends on your specific workload, quality requirements, and budget. In my experience, Claude 3.5 Sonnet produces the best writing, GPT-4o is the most versatile, and Gemini 2.0 Pro offers the best value per token. Using all three strategically has been the best approach for my needs.
Comments
No comments yet. Be the first to share your thoughts!
Stay ahead of the curve
Get the latest insights on AI, technology, and innovation delivered weekly.
