CLAUDE LABJP
MCP — Support for the 2026-07-28 spec is rolling out across Claude. The protocol moves from bidirectional and stateful to request/response, so MCP servers can now live on serverless and edge infrastructureEXTENSIONS — Three official extensions have landed: MCP Apps for server-rendered UI, Tasks for async and long-running work, and Enterprise Managed Auth for IdP-based org-wide provisioningADOPTION — MCP passed 400 million monthly SDK downloads, roughly 4x growth this year, settling into its role as the standard way to connect agents to applicationsQUOTA — Today, August 19, is the last day of the 50 percent weekly usage boost for Claude Code subscribers. If you have long agent runs queued, this is the windowPRICING — Claude Sonnet 5's introductory rate of $2 per million input tokens and $10 output ends August 31; standard pricing of $3 and $15 takes over on September 1, twelve days outFIX — A bug where MCP v2 connections endlessly reopened subscriptions against servers with fixed timeouts is resolved, and a forward_user_identity setting was added for user attributionMCP — Support for the 2026-07-28 spec is rolling out across Claude. The protocol moves from bidirectional and stateful to request/response, so MCP servers can now live on serverless and edge infrastructureEXTENSIONS — Three official extensions have landed: MCP Apps for server-rendered UI, Tasks for async and long-running work, and Enterprise Managed Auth for IdP-based org-wide provisioningADOPTION — MCP passed 400 million monthly SDK downloads, roughly 4x growth this year, settling into its role as the standard way to connect agents to applicationsQUOTA — Today, August 19, is the last day of the 50 percent weekly usage boost for Claude Code subscribers. If you have long agent runs queued, this is the windowPRICING — Claude Sonnet 5's introductory rate of $2 per million input tokens and $10 output ends August 31; standard pricing of $3 and $15 takes over on September 1, twelve days outFIX — A bug where MCP v2 connections endlessly reopened subscriptions against servers with fixed timeouts is resolved, and a forward_user_identity setting was added for user attribution
Articles/API & SDK
API & SDK/2026-04-30Advanced

Building a Production Claude API Pipeline on Cloudflare Queues: Fault Tolerance, Backpressure, and Cost Control

A practical, code-first walkthrough for routing Claude API calls through Cloudflare Queues — covering producer/consumer code, retry-vs-DLQ branching, priority lanes, and token budgeting for production workloads.

claude-api81cloudflare-queuescloudflare-workers5async2production111rate-limit7observability21

Premium Article

"All I want is to summarize 100 uploaded PDFs with Claude — but the Worker dies after 10 seconds." That was a real production incident I worked through, and the cause was painfully simple: a Cloudflare Worker's CPU budget collided with Claude's response latency. Some users sat watching a spinner that would never resolve.

This article is the cleaned-up version of the lesson I took from that incident: never call Claude API directly from a request handler. Cloudflare Queues, used carefully, gives you a place to absorb the impedance mismatch between user-facing latency and model latency. We'll build the pipeline end-to-end with copy-pasteable code, and we'll cover the parts that usually go wrong — retry logic, dead-letter handling, priority lanes, and token budgeting.

Why a request handler is the wrong place to call Claude

Cloudflare Workers cap CPU time at 50ms (free) or up to 30 seconds (paid). That's CPU time, not wall-clock, but for a single Claude API call you're realistically waiting 20–60 seconds of wall time on long outputs. Calling the API synchronously from a handler causes three failures at once:

  • The Worker exits with Exceeded CPU limit: the user gets a 502, no charge to you, but the work is also gone.
  • Client retries cascade: browsers and SDK retries kick in, and one logical job becomes 3–4 billable Claude calls.
  • 429s and 529s pile on: bursty retries hit the rate limit, and now unrelated users in the same org start failing too.

The fix is structurally simple. The handler queues a job and returns immediately. A separate consumer Worker picks the job up and calls Claude. User-perceived latency and model latency are now decoupled. If your workload is purely batch and you don't need user-facing immediacy, the Claude API Messages Batches endpoint is a fine alternative — but for any pipeline where individual user actions need to be tracked, Queues is the better fit.

Pipeline shape

The architecture has three layers:

  • Producer: receives the user request, writes the job to D1, drops a message onto a queue, returns 202 immediately.
  • Consumer: pulls messages off the queue, calls Claude, persists results to R2, updates D1.
  • Observability: failed jobs go to a dead-letter queue (DLQ), and we ship metrics to Logpush so we can alert when failure rates climb.

To keep interactive workloads from being starved by bulk imports, we run two queues: claude-jobs-high (chat-style, foreground work) and claude-jobs-bulk (background batches, uploads). Both feed the same consumer codebase but with different max_concurrency settings.

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
If you've struggled to fan out hundreds of Claude API calls without melting your Worker, you'll have a working pipeline by the end of the day
You'll learn the exact ack vs retry vs DLQ branching for 429s, 529s, and timeouts — copy-pasteable, with the reasoning baked in
By combining priority lanes with a Durable Object token budget, you'll be able to absorb traffic spikes and bulk uploads without trampling your interactive users
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

Related Articles

API & SDK2026-07-13
Coalescing Concurrent Claude API Calls: Single-Flight Against Duplicate Inference and Cache Stampede
A design for collapsing identical prompts that fire at the same instant into a single upstream Claude call, using single-flight (request coalescing). In-process and distributed implementations, jittered retries, and negative caching, with measured results.
API & SDK2026-06-18
When Your Claude API Response Cache Returns Stale Answers and Near-Miss Wrong Ones — Field Notes on Freshness and False-Hit Suppression
A Claude API response cache improves latency and cost immediately, but the problems that hurt in production are not average hit rate — they are stale hits and semantic false hits. Here is the key design, freshness management, false-hit suppression, and observability that keep a cache honest.
API & SDK2026-06-16
PII Masking for Claude API Lives or Dies on the Ledger — Restore, Encrypt, Measure
The hard part of masking PII before Claude API isn't detection — it's operating the token ledger you restore from. Encrypted storage, multi-instance sharing, and a daily leak-rate loop, with working code.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →