AI Gateway - Call any AI model through AI Gateway's new REST API
1mo ago
Source
CloudflareAI Gateway - Call any AI model through AI Gateway's new REST APIcloudflare.comAI Gateway now uses the AI REST API on api.cloudflare.com . You can call any model — whether from OpenAI, Anthropic, Google, or hosted on Workers AI — through one unified API, using the same endpoints and authentication regardless of provider. Four endpoints are available: POST /ai/run — universal endpoint for all models and modalities POST /ai/v1/chat/completions — OpenAI SDK compatible POST /ai/v1/responses — OpenAI Responses API compatible POST /ai/v1/messages — Anthropic SDK compatible curl -X POST " $CLOUDFLARE_ACCOUNT_ID /ai/v1/chat/completions" \ --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN " \ --header "Content-Type: application/json" \ --data '{ "model": "openai/gpt-5.5", "messages": [{"role": "user", "content": "What is Cloudflare?"}] }' All AI Gateway features — logging, caching, rate limiting, and guardrails — are applied automatically. Third-party models are billed through Unified Billing , so you do not need to manage separate provider API keys. Third-party model requests are routed through your account's default gateway, which is created automatically on first use. To route requests through a specific gateway, add the cf-aig-gateway-id header. If you are already calling Workers AI models through the existing REST API, that path ( /ai/run/@cf/{model} ) continues to work. To call Workers AI models through AI Gateway, use the @cf/ model prefix (for example, @cf/moonshotai/kimi-k2.6 ) and include the cf-aig-gateway-id header to specify which gateway to route through. For more details and examples, refer to the REST API documentation .
You might also wanna read
Cloudflare Evolves AI Gateway into Unified Inference Layer for AI Agents
Cloudflare is evolving its AI Gateway into a unified inference layer for AI agents, allowing developers to access models from 14+ providers
GenAI API for Apple Shortcuts: Cloudflare Worker Integration with OpenAI
A TypeScript API built with Hono and OpenAI, deployed as a Cloudflare Worker, that enables developers to integrate generative AI capabilitie
LLM Gateway: Unified API for Accessing Multiple AI Models
LLM Gateway is a unified API platform that allows developers to access multiple AI models from different providers through a single interfac
API that auto-routes to the cheapest AI provider (OpenAI/Anthropic/Gemini)
tokensaver.org·7mo ago
GoModel: High-Performance Go-Based AI Gateway with Unified API for Multiple AI Providers
GoModel is a high-performance AI gateway written in Go that provides a unified OpenAI-compatible API for multiple AI providers including Ope
Cloudflare enables AI agents to autonomously create accounts, buy domains, and deploy code
Cloudflare now allows AI coding agents to create accounts, purchase domains, set up paid subscriptions, and obtain API tokens autonomously o

Comments
Sign in to join the conversation.
No comments yet. Be the first.