# Cloudflare AI Gateway vs DeepInfra > Cloudflare AI Gateway scores 66.8 (B) to DeepInfra's 63 (B) for llm inference. Prices, MCP, x402, uptime and agent notes side by side. - Canonical: https://www.anchorterminal.com/compare/cloudflare-ai-gateway-vs-deepinfra - Markdown: https://www.anchorterminal.com/compare/cloudflare-ai-gateway-vs-deepinfra.md (~2,900 tokens) - Slim: https://www.anchorterminal.com/compare/cloudflare-ai-gateway-vs-deepinfra.min.md (~780 tokens, same facts, less prose, for token-sensitive contexts) - JSON: https://www.anchorterminal.com/compare/cloudflare-ai-gateway-vs-deepinfra.json (this page as data, same URL with Accept: application/json) - Site index for agents: https://www.anchorterminal.com/llms.txt (full text: https://www.anchorterminal.com/llms-full.txt) - API: https://www.anchorterminal.com/api/v1/index.json - Updated: 2026-10-09 Cloudflare AI Gateway scores 66.8 (B) on agent readiness against DeepInfra's 63 (B), and leads in 5 of 7 scored categories. Both do llm inference. - Cloudflare AI Gateway: grade B, 66.8/100, rank #275 of 950. Markdown https://www.anchorterminal.com/tools/cloudflare-ai-gateway.md · JSON https://www.anchorterminal.com/api/v1/tools/cloudflare-ai-gateway.json - DeepInfra: grade B, 63/100, rank #411 of 950. Markdown https://www.anchorterminal.com/tools/deepinfra.md · JSON https://www.anchorterminal.com/api/v1/tools/deepinfra.json - Best model APIs and inference for AI agents: https://www.anchorterminal.com/best/inference/index.md - All 136 models comparisons: https://www.anchorterminal.com/compare/inference/index.md ## Which one, for what ### 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: - Schema & documentation, 75 against 69 - Security & auth, 75 against 64 - Payments & pricing, 52 against 20 - Maintenance & community, 75 against 65 - Transparency & trust, 73 against 67 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 ### DeepInfra (B) Good for: Agents that want many open-weight models, embeddings, image and speech behind one OpenAI-style key at low per-token prices, with spend-capped tokens. Also in its favour: - No incidents deducted, where Cloudflare AI Gateway loses 3 points for them Watch for: A deprecated model gets at least one week's notice, and requests are then forwarded to a replacement model under the old id ## Score by category | Category | Weight | Cloudflare AI Gateway | DeepInfra | Edge | | --- | --- | --- | --- | --- | | Reliability | 16% (20 this run) | 66 | 70 | DeepInfra +4 | | Performance | 10%, pending | pending | pending | not scored in this run | | Schema & documentation | 13% (16.2 this run) | 75 | 69 | Cloudflare AI Gateway +6 | | Agent ergonomics | 13% (16.2 this run) | 73 | 77 | DeepInfra +4 | | Security & auth | 14% (17.5 this run) | 75 | 64 | Cloudflare AI Gateway +11 | | Payments & pricing | 10% (12.5 this run) | 52 | 20 | Cloudflare AI Gateway +32 | | Task success | 10%, pending | pending | pending | not scored in this run | | Maintenance & community | 7% (8.8 this run) | 75 | 65 | Cloudflare AI Gateway +10 | | Transparency & trust | 7% (8.8 this run) | 73 | 67 | Cloudflare AI Gateway +6 | | Negative events | ≤15 | -3 | 0 | | | **Total** | | **66.8 · B** | **63 · B** | | ## Facts side by side | Fact | Cloudflare AI Gateway | DeepInfra | | --- | --- | --- | | Kind | Model router | Model API | | Vendor | Cloudflare, Inc. | Deep Infra Inc. | | Hosted endpoint | `https://api.cloudflare.com/client/v4/accounts/{account_id}/ai` | `https://api.deepinfra.com/v1/openai` | | Transports | HTTP | HTTP | | Auth | API key | API key | | Pricing | Freemium | Pay per use | | x402 | payer tooling only | no | | Licence | 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 | Proprietary service under the DeepInfra Terms of Service. The Python and Node SDKs and the docs repository are MIT | | Read-only variant documented | no | no | | llms.txt | yes | yes | | Last release | 2026-10-06 | 2026-10-07 | | Terms last updated | 2025-09-12 | 2026-08-17 | | Privacy policy last updated | no date given | 2026-08-15 | | Customer content may train models | not found in the text | not found in the text | | Terms restrict automated access | yes | not found in the text | | Terms restrict benchmarking | not found in the text | yes | | Terms or service can change without notice | yes | not found in the text | | Arbitration or class-action waiver | yes | yes | | Popularity | 251k npm/wk | 21 stars, 1.2k npm/wk, 50 PyPI/wk | ## Verdicts **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. **DeepInfra.** The model list, context sizes and per-token prices are readable without a key, and keys can carry an IP allowlist, a monthly spending cap and model-limited JWTs. Deprecated models get one week's notice and are then redirected to another model, there is no changelog or SLA, and an account needs a card or prepayment before any call. ## Before you call either ### 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 ### DeepInfra 1. Call `GET https://api.deepinfra.com/v1/openai/models` at start-up for ids, context sizes and prices. No key is needed 2. Check the `model` field of each response. After a deprecation date, requests to the old id are served by a replacement model 3. Ask the account owner for a scoped JWT limited to the models and spend the task needs, not the full API key 4. Stay under 200 concurrent requests per model. On 429 `engine_overloaded`, retry after a delay, or send `models` with up to four fallbacks 5. Never inspect a JWT with `GET /v1/scoped-jwt?jwtoken=`, which puts the token in the URL. Keep credentials in the `Authorization` header ## Questions ### Which is better for AI agents, Cloudflare AI Gateway or DeepInfra? Cloudflare AI Gateway scores 66.8 (B) on agent readiness against DeepInfra's 63 (B), and leads in 5 of 7 scored categories. ### Do Cloudflare AI Gateway and DeepInfra need an API key? Both need an API key. ### Can an agent call Cloudflare AI Gateway and DeepInfra without installing anything? Yes. Cloudflare AI Gateway has a hosted endpoint at https://api.cloudflare.com/client/v4/accounts/{account_id}/ai and DeepInfra at https://api.deepinfra.com/v1/openai. ## For agents - This comparison as JSON: https://www.anchorterminal.com/compare/cloudflare-ai-gateway-vs-deepinfra.json, and with the fewest tokens: https://www.anchorterminal.com/compare/cloudflare-ai-gateway-vs-deepinfra.min.md - Over MCP at https://www.anchorterminal.com/mcp (no key): `compare_tools {"a": "cloudflare-ai-gateway", "b": "deepinfra"}`. From a terminal: `anchor compare cloudflare-ai-gateway deepinfra` - Each listing in full: https://www.anchorterminal.com/api/v1/tools/cloudflare-ai-gateway.json and https://www.anchorterminal.com/api/v1/tools/deepinfra.json ## Other comparisons with Cloudflare AI Gateway or DeepInfra - [Claude API vs Cloudflare AI Gateway](https://www.anchorterminal.com/compare/anthropic-api-vs-cloudflare-ai-gateway.md) - [Claude API vs DeepInfra](https://www.anchorterminal.com/compare/anthropic-api-vs-deepinfra.md) - [Antseed vs DeepInfra](https://www.anchorterminal.com/compare/antseed-vs-deepinfra.md) - [BlockRun.AI vs Cloudflare AI Gateway](https://www.anchorterminal.com/compare/blockrun-ai-vs-cloudflare-ai-gateway.md) - [BlockRun.AI vs DeepInfra](https://www.anchorterminal.com/compare/blockrun-ai-vs-deepinfra.md) - [Cloudflare AI Gateway vs Cloudflare Workers AI](https://www.anchorterminal.com/compare/cloudflare-ai-gateway-vs-cloudflare-workers-ai.md) - [Cloudflare AI Gateway vs Cohere Chat API (Command models)](https://www.anchorterminal.com/compare/cloudflare-ai-gateway-vs-cohere-chat.md) - [Cloudflare AI Gateway vs DeepSeek API](https://www.anchorterminal.com/compare/cloudflare-ai-gateway-vs-deepseek-api.md) - [Cloudflare AI Gateway vs Gemini Developer API](https://www.anchorterminal.com/compare/cloudflare-ai-gateway-vs-gemini-api.md) - [Cloudflare AI Gateway vs GroqCloud](https://www.anchorterminal.com/compare/cloudflare-ai-gateway-vs-groq.md) - [Cloudflare AI Gateway vs Mistral AI API](https://www.anchorterminal.com/compare/cloudflare-ai-gateway-vs-mistral-api.md) - [Cloudflare AI Gateway vs Novita AI](https://www.anchorterminal.com/compare/cloudflare-ai-gateway-vs-novita-ai.md) - [Cloudflare AI Gateway vs OpenAI API](https://www.anchorterminal.com/compare/cloudflare-ai-gateway-vs-openai-api.md) - [Cloudflare AI Gateway vs OpenRouter](https://www.anchorterminal.com/compare/cloudflare-ai-gateway-vs-openrouter.md) - [Cloudflare AI Gateway vs Prism Inference](https://www.anchorterminal.com/compare/cloudflare-ai-gateway-vs-prism-inference.md) - [Cloudflare AI Gateway vs SambaCloud](https://www.anchorterminal.com/compare/cloudflare-ai-gateway-vs-sambanova.md) - [Cloudflare AI Gateway vs SiliconFlow](https://www.anchorterminal.com/compare/cloudflare-ai-gateway-vs-siliconflow.md) - [Cloudflare Workers AI vs DeepInfra](https://www.anchorterminal.com/compare/cloudflare-workers-ai-vs-deepinfra.md) - [Cohere Chat API (Command models) vs DeepInfra](https://www.anchorterminal.com/compare/cohere-chat-vs-deepinfra.md) - [DeepInfra vs DeepSeek API](https://www.anchorterminal.com/compare/deepinfra-vs-deepseek-api.md) - [DeepInfra vs Gemini Developer API](https://www.anchorterminal.com/compare/deepinfra-vs-gemini-api.md) - [DeepInfra vs GroqCloud](https://www.anchorterminal.com/compare/deepinfra-vs-groq.md) - [DeepInfra vs Mistral AI API](https://www.anchorterminal.com/compare/deepinfra-vs-mistral-api.md) - [DeepInfra vs Novita AI](https://www.anchorterminal.com/compare/deepinfra-vs-novita-ai.md) - [DeepInfra vs OpenAI API](https://www.anchorterminal.com/compare/deepinfra-vs-openai-api.md) - [DeepInfra vs OpenRouter](https://www.anchorterminal.com/compare/deepinfra-vs-openrouter.md) - [DeepInfra vs Prism Inference](https://www.anchorterminal.com/compare/deepinfra-vs-prism-inference.md) - [DeepInfra vs SambaCloud](https://www.anchorterminal.com/compare/deepinfra-vs-sambanova.md) - [DeepInfra vs SiliconFlow](https://www.anchorterminal.com/compare/deepinfra-vs-siliconflow.md) - [Antseed vs Cloudflare AI Gateway](https://www.anchorterminal.com/compare/antseed-vs-cloudflare-ai-gateway.md)