Cloudflare Docs
AI Gateway
Edit this page
Report an issue with this page
Log into the Cloudflare dashboard
Set theme to dark (⇧+D)

Get started

Last reviewed:

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

​​ Create gateway

Then, create a new AI Gateway.

To set up an AI Gateway in the dashboard:

  1. Log into the Cloudflare dashboard 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.

To set up an AI Gateway using the API:

  1. Create an API token with the following permissions:

    • AI Gateway - Read
    • AI Gateway - Edit
  2. Get your Account ID.

  3. Using that API token and Account ID, send a POST request to the Cloudflare API.

​​ 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.

Supported providers

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

Onboarding tutorials

​​ 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 and select your account.
  2. Go to AI > AI Gateway.
  3. Make sure you have your gateway selected.

​​ Next steps

  • 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.