DEV Community

Sangmin Lee
Sangmin Lee

Posted on • Originally published at claudeguide.io

Claude API: Streaming vs Batch — Which Saves More (2026)

Originally published at claudeguide.io/claude-api-streaming-batch

Claude API: Streaming vs Batch — Which Saves More (2026)

Batch API is 50% cheaper than real-time inference. Streaming adds perceived speed at zero cost premium. The decision rule is simple: if the user is watching, stream. If no one is waiting, batch. Most teams get this backwards — running batch jobs interactively and real-time jobs overnight — and pay 2–5× more than they should.


The cost difference, in one table

Mode Input / 1M Output / 1M When billed
Real-time (default) $3.00 $15.00 Per request, immediately
Streaming $3.00 $15.00 Same as real-time
Batch API $1.50 $7.50 After batch completes

Streaming costs identical to non-streaming real-time — you pay the same per token whether you receive them word-by-word or all at once. The only difference is latency UX.

Batch API is exactly 50% off across all models and all token types. Cache read discounts stack on top.

A $1,000/month real-time workload costs $500/month on Batch API, if the task doesn't require an immediate response.


When streaming makes sense

Streaming delivers tokens to the client as they are generated. The model is still running the same computation — you just receive results incrementally instead of waiting for completion.

Use streaming when:

  • A human is reading the output in real time (chat, live completions, code editor autocomplete)
  • Time-to-first-token (TTFT) matters to user experience — even a 2-second delay feels slow in interactive contexts
  • You're building a UI that should feel responsive (streaming at 30–80 tokens/sec feels fast; waiting 15 seconds for 500 tokens feels broken)
  • Multi-turn conversation where the user replies mid-response

What streaming does NOT do:

  • Reduce total latency for the full response (the model generates at the same speed)
  • Lower cost (same price as non-streaming)
  • Improve output quality

The win is purely perceptual: TTFT drops from ~2–15s (full-response wait) to ~0.3–0.8s (first token arrives quickly).


When Batch API makes sense

Batch API queues requests and processes them asynchronously, returning results within 24 hours (typically 1–4 hours in practice for standard workloads).

Use Batch API when:

  • No user is waiting for the result right now
  • Processing large volumes overnight or on a schedule (nightly classification, daily report generation, weekly data enrichment)
  • Generating content assets in advance (product descriptions, alt text, email drafts queued for review)
  • Running evals against a labeled dataset — 100+ samples run cheaply as a batch
  • Any pipeline step that feeds the next step hours later, not seconds later

What Batch API does NOT do:

  • Return results in real time (24h SLA, typically 1–4h)
  • Support streaming output (results arrive as a completed file, not incremental tokens)
  • Support multi-turn conversation per request (each batch item is a single-turn prompt+response)

Illustrative cost comparison

Three illustrative workloads based on published Anthropic pricing, May 2026:

1 — Email draft generation

Task: Generate first-draft replies to 25,000 customer support tickets/month. Avg 1,500 input, 250 output tokens.

Mode Cost/month Latency
Streaming (real-time) $125 2–3s TTFT
Batch API $62 Results available next morning

Winner: Hybrid. Simple tickets (FAQ-answerable) → streaming for the agent to present immediately. Complex tickets (needing research) → batch overnight. Net: ~$80/month at full quality.

2 — Product description generation

Task: Generate alt text and short descriptions for 10,000 new product listings weekly. 800 input, 150 output tokens.

Mode Cost/month Notes
Real-time $54 No user is waiting
Batch API $27 Run nightly, results in catalog by morning

Winner: Batch. Descriptions don't need to be ready in seconds — they need to be ready before the product goes live. Batch saves 50% with no quality or UX tradeoff.

3 — Eval runs

Task: Score 500 model outputs against a rubric for a weekly regression eval.

Mode Cost/run Time
Real-time $0.90 ~12 minutes
Batch API $0.45 ~45 minutes

Winner: Batch. Evals run overnight in CI — 45 minutes is fine. Saves 50% on every regression run.


The Batch API in practice

Python: submit a batch

import anthropic
import json

client = anthropic.Anthropic()

# Build batch requests
requests = [
    {
        "custom_id": f"item-{i}",
        "params": {
            "model": "claude-sonnet-4-5",
            "max_tokens": 256,
            "messages": [{"role": "user", "content": f"Summarize: {text}"}]
        }
    }
    for i, text in enumerate(texts)  # texts = your list of inputs
]

# Submit
batch = client.messages.batches.create(requests=requests)
print(f"Batch ID: {batch.id}")
print(f"Status: {batch.processing_status}")
Enter fullscreen mode Exit fullscreen mode

Poll and retrieve results


python
import time

def wait_for_batch(batch_id: str, poll_interval: int = 60) -

[→ Get Cost Optimization Masterclass — $59](https://shoutfirst.gumroad.com/l/msjkda?utm_source=claudeguide&utm_medium=article&utm_campaign=claude-api-streaming-batch)

*30-day money-back guarantee. Instant download.*
Enter fullscreen mode Exit fullscreen mode

Top comments (0)