Head to head · LLM inference · October 2026 research run

Claude API vs Cloudflare AI Gateway

Claude API scores 77.3 (BB) on agent readiness against Cloudflare AI Gateway's 66.8 (B), and leads in 5 of 7 scored categories. Cloudflare AI Gateway leads on reliability and payments & pricing. Both do llm inference.

Best model APIs and inference for AI agents · All 136 models comparisons

Which one, for what

Claude API BB

Good for Long agent loops that lean on tool use, strict schemas and caching, and teams that want 1M context at Opus or Sonnet prices.

Ahead on

  • Schema & documentation, 90 against 75
  • Agent ergonomics, 95 against 73
  • Security & auth, 92 against 75
  • Maintenance & community, 91 against 75
  • Transparency & trust, 85 against 73

Also in its favour

  • Agent-ready, a grade of BB or better
  • No incidents deducted, where Cloudflare AI Gateway loses 3 points for them

Watch for

Three incidents of 80 minutes or more with elevated errors across several models between 24 August and 22 September 2026

Cloudflare AI Gateway B

Good for Teams that already hold a Cloudflare account and want one token, one bill, logs, budgets and fallbacks in front of several model providers, or that want to keep their own provider keys behind a proxy with spend limits.

Ahead on

  • Reliability, 66 against 60
  • Payments & pricing, 52 against 30

Watch for

API tokens are account-scoped. Any token with AI Gateway Run can send requests through every gateway in the account and spend its stored provider keys

Score by category

CategoryWeight this runClaude APICloudflare AI GatewayEdge
Reliability16%206066Cloudflare AI Gateway +6
Performance10%pendingpendingpendingnot scored in this run
Schema & documentation13%16.29075Claude API +15
Agent ergonomics13%16.29573Claude API +22
Security & auth14%17.59275Claude API +17
Payments & pricing10%12.53052Cloudflare AI Gateway +22
Task success10%pendingpendingpendingnot scored in this run
Maintenance & community7%8.89175Claude API +16
Transparency & trust7%8.88573Claude API +12
Negative events≤150-3
Total77.3 · BB66.8 · B

Facts side by side

FactClaude APICloudflare AI Gateway
KindModel APIModel router
VendorAnthropicCloudflare, Inc.
Hosted endpointhttps://api.anthropic.com/v1/messageshttps://api.cloudflare.com/client/v4/accounts/{account_id}/ai
TransportsHTTPHTTP
AuthAPI keyAPI key
PricingPay per useFreemium
x402nopayer tooling only
LicenceMIT (SDKs)Proprietary service under Cloudflare's Self-Serve Subscription Agreement and its service-specific terms. Third-party models carry their providers' terms, linked from each model page. ai-gateway-provider is MIT and Cloudflare's OpenAPI repository is BSD-3-Clause
Read-only variant documentednono
llms.txtyesyes
Last release2026-10-012026-10-06
Terms last updatedno date given2025-09-12
Privacy policy last updatedno date givenno date given
Customer content may train modelsyes, with an opt-outnot found in the text
Terms restrict automated accessnot found in the textyes
Terms restrict benchmarkingyesnot found in the text
Terms or service can change without noticenot found in the textyes
Arbitration or class-action waiveryesyes
Popularity3.9k stars251k npm/wk

Verdicts

Claude API

Structured outputs and strict tool use are GA, with grammar-constrained sampling on every current model. Three incidents of 80 minutes or more with elevated errors across several models between 24 August and 22 September 2026.

Cloudflare AI Gateway

The gateway layer is free, per-model prices are public with no markup, and logs, spend limits and fallbacks are set per gateway. API tokens cannot be limited to one gateway, the service terms take third-party models outside Cloudflare's DPA, no SLA names the product, and error codes changed on 6 October 2026 with same-day notice.

Before you call either

Claude API

  1. Default to claude-opus-5-5 and keep claude-fable-5-1 for tasks that fail on Opus, at 2.5 times the price
  2. Don't send tool_choice any or tool to Opus 5.5, Sonnet 5.5 or Fable 5.1. Use auto with strict: true on the tool
  3. Put cache_control on the system prompt and tool list. Reads cost 0.05x input on Opus 5.5
  4. Wait out a 429 by its retry-after seconds, but a spend-cap 429 has no header and won't clear by waiting
  5. Move off claude-sonnet-4-5-20250929 before 2026-11-30. Retired ids fail, they don't redirect

Cloudflare AI Gateway

  1. Use the REST API at api.cloudflare.com/client/v4/accounts/{account_id}/ai/v1 with a token holding Workers AI Read. A token with only an AI Gateway permission returns 401 with code 10000
  2. Send cf-aig-gateway-id on every Workers AI (@cf/) call and on dynamic routes. Without it a dynamic route resolves against the default gateway and returns 404
  3. Set cf-aig-collect-log: false or cf-aig-collect-log-payload: false on sensitive requests. Logging of prompts and responses is on by default
  4. Treat a 429 as a rate limit or a spent budget and a 401 with code 2009 as a rejected provider key. Do not retry a 2009
  5. Set byok_only on the gateway or send cf-aig-no-wholesale: true to stop a request without a provider key falling through to paid Unified Billing credits

Questions

Which is better for AI agents, Claude API or Cloudflare AI Gateway?

Claude API scores 77.3 (BB) on agent readiness against Cloudflare AI Gateway's 66.8 (B), and leads in 5 of 7 scored categories. Cloudflare AI Gateway leads on reliability and payments & pricing.

Do Claude API and Cloudflare AI Gateway need an API key?

Both need an API key.

Can an agent call Claude API and Cloudflare AI Gateway without installing anything?

Yes. Claude API has a hosted endpoint at https://api.anthropic.com/v1/messages and Cloudflare AI Gateway at https://api.cloudflare.com/client/v4/accounts/{account_id}/ai.

Other comparisons with Claude API or Cloudflare AI Gateway

Disclosure

Anthropic makes the models this research run and the review panel run on. This listing was graded by agents running on Claude, by the same published checklist as every other listing, and the panel doesn't review it, because every reviewer runs on Claude too.

Machine-readable

For companies

Do agents find, use and choose your tools?

An agent-readiness audit runs our probes, task suite and eight reviewer agents against your public and internal tools, and comes back with a scorecard, the transcripts of what failed, and a fix list in priority order. From $2,500, re-run included. We never take payment to move a rank. We do help companies earn one.