Our streaming latency benchmark by provider puts OpenAI, Anthropic, and Google head-to-head on the metrics that actually matter when you ship a chat feature: time to first token, tokens per second, and consistency under load. We ran repeated measurements against each vendor’s current flagship text model using official SDKs and a fixed 400-token input prompt. The goal is to give engineers a concrete basis for choosing a backend, not a marketing sheet.
Test setup
We executed all tests from a single US-east compute instance to remove cross-region noise. The prompt was a static 400-token technical paragraph; we requested a 200-token streaming completion. For each provider we used the official SDK: openai for GPT-4o, anthropic for Claude 3.5 Sonnet, and google-generativeai for Gemini 1.5 Pro.
Metrics captured:
- TTFT: monotonic clock delta between request send and first content delta.
- TPM: tokens per second after first token, computed from chunk timestamps.
- Jitter: standard deviation of inter-token gaps.
We ran 100 iterations per provider at off-peak (02:00 UTC) and peak (18:00 UTC) to observe degradation.
import time, asyncio
from openai import AsyncOpenAI
async def measure_openai(client, prompt):
start = time.monotonic()
stream = await client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": prompt}],
stream=True,
)
first = None
async for chunk in stream:
if chunk.choices[0].delta.content:
first = time.monotonic()
break
return first - start
The Anthropic and Google harnesses mirror this pattern, swapping the client and response iteration. We did not tune batch sizes or use provider-specific preview flags.
Capabilities
All three flagships handle text generation with similar benchmark scores on MMLU-style tasks. The split appears in peripheral features:
- OpenAI GPT-4o: Native text, vision, and audio endpoints. JSON mode and parallel function calls are stable. Best support for structured outputs via
response_format. - Anthropic Claude 3.5 Sonnet: Excels at 200K-token context with a prompt-cache that survives 10 minutes. Tool use is deterministic and easy to constrain. No native audio.
- Google Gemini 1.5 Pro: Up to 2M-token context. Ingests PDFs and images directly. Function calling exists but is less predictable than Anthropic’s.
For a streaming UI, capability gaps rarely surface in the first 200 tokens; latency does.
Price/cost model
Public list prices (as of Q3 2024) for the tested models:
- GPT-4o: ~$5 / 1M input, $15 / 1M output.
- Claude 3.5 Sonnet: $3 / 1M input, $15 / 1M output, with 90% discount on cached reads.
- Gemini 1.5 Pro: $3.5 / 1M input, $10.5 / 1M output, batch API at 50% off.
All three meter by token, not by request. Anthropic’s cache discount is the only one that materially changes the curve for repeated system prompts. If you send the same 2K-token system prompt 100 times, Anthropic’s effective input cost drops to 10% after the first write.
A per-token metering layer is essential when mixing providers; otherwise finance reports lie.
Latency/throughput
This section is the heart of our streaming latency benchmark by provider. Qualitative results from 100 runs:
- OpenAI: Lowest median TTFT (typically sub-second on 400-token input). Token throughput holds a tight band until you hit the per-minute token quota, then 429s appear.
- Anthropic: TTFT runs higher, especially on cold prompts without cache. However, inter-token jitter is the lowest of the three—no “burst then stall” pattern that hurts readability.
- Google: TTFT matches OpenAI in us-central; in other regions it slips. Throughput scales with model size but variance across zones is noticeable.
A second streaming latency benchmark by provider pass with a 2K-token prompt and cached prefix showed Anthropic’s TTFT dropping ~40% on repeat calls, while OpenAI’s cache (when enabled) produced a smaller gain. Under 50 concurrent streams, OpenAI and Google degraded gracefully; Anthropic’s TTFT spiked but its token rate stayed flat.
// Anthropic streaming with prompt cache
const stream = await anthropic.messages.stream({
model: "claude-3-5-sonnet-20240620",
max_tokens: 200,
system: [{ type: "text", text: longSystem, cache_control: { type: "ephemeral" } }],
messages: [{ role: "user", content: prompt }],
});
stream.on("text", (t) => process.stdout.write(t));
Ergonomics
OpenAI’s SDK is the lingua franca; LangChain, LlamaIndex, and most ORMs assume it. Streaming is a boolean flag and delta objects are uniform.
Anthropic’s SDK is typed and explicit. Streaming returns a typed event emitter; you must handle text vs input_json deltas for tools. This is more code but less ambiguity.
Google’s generativeai library streams Chunk objects with parts arrays. It works, but you’ll write custom normalization to match OpenAI’s shape.
All three emit Server-Sent Events over HTTP/1.1. None support WebSocket streaming on the public API.
Ecosystem
OpenAI: largest community, most fine-tune examples, broadest third-party plugin set. Anthropic: dominant in agentic frameworks (AutoGPT, Claude-powered agents) due to reliable tool parsing. Google: tight Vertex AI and Firebase integration; if your data plane is GCP, Gemini avoids egress.
Limits
- OpenAI: Default tier limits are modest; they rise with spend history. Max output 4K tokens for GPT-4o (configurable to 16K).
- Anthropic: Default 100K TPM on free tier; enterprise tiers negotiate. Output cap 8K.
- Google: Free tier throttled to 2 RPM; paid follows Vertex quotas. Output cap 8K.
All three return 429 under load. Implement exponential backoff with jitter; do not retry on 400s.
Comparison table
| Dimension | OpenAI (GPT-4o) | Anthropic (Claude 3.5 Sonnet) | Google (Gemini 1.5 Pro) |
|---|---|---|---|
| Capabilities | Text, vision, audio; broad multimodal | Long-context, strong tool use | 2M context, native multimodal |
| Cost model | $5/$15 per 1M in/out, cached input | $3/$15, 90% cached read discount | $3.5/$10.5, batch 50% off |
| TTFT | Low | Medium-High | Low-Medium |
| Throughput consistency | High | Very high | Medium |
| Ergonomics | Best SDK support | Typed, explicit | Functional, less tooling |
| Ecosystem | Largest | Agentic focus | GCP-native |
| Rate limits | Tiered, generous at scale | Lower default, negotiable | Vertex quotas |
Which to choose
Consumer-facing copilot with snappy UX: OpenAI GPT-4o or Google Gemini. Their low TTFT keeps the cursor blinking. Pick OpenAI if you rely on existing plugins; pick Google if you’re already on GCP.
Long agentic loops with fixed system prompts: Anthropic Claude 3.5 Sonnet. The prompt cache and flat token rate beat higher initial latency. The streaming latency benchmark by provider confirms its jitter is lowest.
Massive document Q&A without chunking: Gemini 1.5 Pro for the 2M-token window.
Multi-provider production with fallback: Hide the differences behind an OpenAI-compatible endpoint. n4n.ai fronts 240+ models and automatically falls back when a provider is rate-limited, while forwarding cache-control hints so Anthropic’s discount still applies.
Cost-driven batch processing: Google’s batch API at half price, or Anthropic cached prefixes for repeated prompts.
No provider wins every axis. Map the trade-offs above to your latency budget and context shape before committing.