Get started
In this guide, you will learn how to create your first AI Gateway. You can create multiple gateways to control different applications.
Before you get started, you need a Cloudflare account.
Sign up
Then, create a new AI Gateway.
To set up an AI Gateway in the dashboard:
- Log into the Cloudflare dashboard ↗ and select your account.
- Go to AI > AI Gateway.
- Select Create Gateway.
- Enter your Gateway name. Note: Gateway name has a 64 character limit.
- Select Create.
To set up an AI Gateway using the API:
-
Create an API token with the following permissions:
AI Gateway - Read
AI Gateway - Edit
-
Get your Account ID.
-
Using that API token and Account ID, send a
POST
request to the Cloudflare API.
When setting up a new gateway, you can choose between an authenticated and unauthenticated gateway. Enabling an authenticated gateway requires each request to include a valid authorization token, adding an extra layer of security. We recommend using an authenticated gateway when storing logs to prevent unauthorized access and protect against invalid requests that can inflate log storage usage and make it harder to find the data you need. Learn more about setting up an Authenticated Gateway.
Next, connect your AI provider to your gateway.
AI Gateway offers multiple endpoints for each Gateway you create - one endpoint per provider, and one Universal Endpoint.
Additionally, AI Gateway has a WebSockets API which provides a single persistent connection, enabling continuous communication. This API supports all AI providers connected to AI Gateway, including those that do not natively support WebSockets.
Below is a list of our supported model providers:
- Amazon Bedrock
- Anthropic
- Azure OpenAI
- Cohere
- Google AI Studio
- Google Vertex AI
- Grok
- Groq
- HuggingFace
- Mistral AI
- OpenAI
- Perplexity
- Replicate
- Universal Endpoint
- Workers AI
If you do not have a provider preference, start with one of our dedicated tutorials:
Now that your provider is connected to the AI Gateway, you can view analytics for requests going through your gateway.
Your AI Gateway dashboard shows metrics on requests, tokens, caching, errors, and cost. You can filter these metrics by time and provider-type.
To view analytics in the dashboard:
- Log into the Cloudflare dashboard ↗ and select your account.
- Go to AI > AI Gateway.
- Make sure you have your gateway selected.
- Learn more about caching for faster requests and cost savings and rate limiting to control how your application scales.
- Explore how to specify model or provider fallbacks for resiliency.
- Learn how to use low-cost, open source models on Workers AI - our AI inference service.