---
title: Getting started · Cloudflare AI Gateway docs
description: In this guide, you will learn how to create your first AI Gateway. You can create multiple gateways to control different applications.
lastUpdated: 2025-03-13T17:52:53.000Z
source_url:
  html: https://a74404c8.preview.developers.cloudflare.com/ai-gateway/get-started/index.md
  md: https://a74404c8.preview.developers.cloudflare.com/ai-gateway/get-started/
---

In this guide, you will learn how to create your first AI Gateway. You can create multiple gateways to control different applications.

## Prerequisites

Before you get started, you need a Cloudflare account.

[Sign up](https://dash.cloudflare.com/sign-up)

## Create gateway

Then, create a new AI Gateway.

* Dashboard

  To set up an AI Gateway in the dashboard:

  1. Log into the [Cloudflare dashboard](https://dash.cloudflare.com/) and select your account.
  2. Go to **AI** > **AI Gateway**.
  3. Select **Create Gateway**.
  4. Enter your **Gateway name**. Note: Gateway name has a 64 character limit.
  5. Select **Create**.

* API

  To set up an AI Gateway using the API:

  1. [Create an API token](https://developers.cloudflare.com/fundamentals/api/get-started/create-token/) with the following permissions:

     * `AI Gateway - Read`
     * `AI Gateway - Edit`

  2. Get your [Account ID](https://developers.cloudflare.com/fundamentals/setup/find-account-and-zone-ids/).

  3. Using that API token and Account ID, send a [`POST` request](https://developers.cloudflare.com/api/resources/ai_gateway/methods/create/) to the Cloudflare API.

## Choosing gateway authentication

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](https://developers.cloudflare.com/ai-gateway/configuration/authentication/).

## Connect application

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. To use AI Gateway, you will need to create your own account with each provider and provide your API key. AI Gateway acts as a proxy for these requests, enabling observability, caching, and more.

Additionally, AI Gateway has a [WebSockets API](https://developers.cloudflare.com/ai-gateway/configuration/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](https://developers.cloudflare.com/ai-gateway/providers/bedrock/)
* [Anthropic](https://developers.cloudflare.com/ai-gateway/providers/anthropic/)
* [Azure OpenAI](https://developers.cloudflare.com/ai-gateway/providers/azureopenai/)
* [Cartesia](https://developers.cloudflare.com/ai-gateway/providers/cartesia/)
* [Cerebras](https://developers.cloudflare.com/ai-gateway/providers/cerebras/)
* [Cohere](https://developers.cloudflare.com/ai-gateway/providers/cohere/)
* [DeepSeek](https://developers.cloudflare.com/ai-gateway/providers/deepseek/)
* [ElevenLabs](https://developers.cloudflare.com/ai-gateway/providers/elevenlabs/)
* [Google AI Studio](https://developers.cloudflare.com/ai-gateway/providers/google-ai-studio/)
* [Google Vertex AI](https://developers.cloudflare.com/ai-gateway/providers/vertex/)
* [Grok](https://developers.cloudflare.com/ai-gateway/providers/grok/)
* [Groq](https://developers.cloudflare.com/ai-gateway/providers/groq/)
* [HuggingFace](https://developers.cloudflare.com/ai-gateway/providers/huggingface/)
* [Mistral AI](https://developers.cloudflare.com/ai-gateway/providers/mistral/)
* [OpenAI](https://developers.cloudflare.com/ai-gateway/providers/openai/)
* [OpenRouter](https://developers.cloudflare.com/ai-gateway/providers/openrouter/)
* [Perplexity](https://developers.cloudflare.com/ai-gateway/providers/perplexity/)
* [Replicate](https://developers.cloudflare.com/ai-gateway/providers/replicate/)
* [Universal Endpoint](https://developers.cloudflare.com/ai-gateway/providers/universal/)
* [Workers AI](https://developers.cloudflare.com/ai-gateway/providers/workersai/)

If you do not have a provider preference, start with one of our dedicated tutorials:

* [OpenAI](https://developers.cloudflare.com/ai-gateway/integrations/aig-workers-ai-binding/)
* [Workers AI](https://developers.cloudflare.com/ai-gateway/tutorials/create-first-aig-workers/)

## View analytics

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:

1. Log into the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account.
2. Go to **AI** > **AI Gateway**.
3. Make sure you have your gateway selected.

Note

The cost metric is an estimation based on the number of tokens sent and received in requests. While this metric can help you monitor and predict cost trends, refer to your provider’s dashboard for the most accurate cost details.

## Next steps

* Learn more about [caching](https://developers.cloudflare.com/ai-gateway/configuration/caching/) for faster requests and cost savings and [rate limiting](https://developers.cloudflare.com/ai-gateway/configuration/rate-limiting/) to control how your application scales.
* Explore how to specify model or provider [fallbacks](https://developers.cloudflare.com/ai-gateway/configuration/fallbacks/) for resiliency.
* Learn how to use low-cost, open source models on [Workers AI](https://developers.cloudflare.com/ai-gateway/providers/workersai/) - our AI inference service.
