Skip to content

Cursor

Last updated View as MarkdownAgent setup

Cursor ↗︎ supports a custom OpenAI base URL for models that use a custom API key. Point it at AI Gateway's REST API to route Cursor chat and agent requests through AI Gateway. Cursor sends requests through its servers, so your AI Gateway endpoint must be publicly reachable.

Prerequisites

Before you start, you need:

  1. In Cursor, go to Cursor Settings > Models. Under API Keys, enter your Cloudflare API token in the OpenAI API Key field, then select Save.

  2. Turn on Override OpenAI Base URL. Enter the following value, replacing <ACCOUNT_ID> with your Cloudflare account ID:

    https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/ai/v1
  3. Select + Add Custom Model. Enter a model name, then turn on the model.

    Use a Workers AI model for chat, such as @cf/meta/llama-3.3-70b-instruct-fp8-fast. For agent mode, use a third-party model that supports the OpenAI Responses API, such as openai/gpt-4.1-mini.

    For available models, refer to the model catalog.

  4. Select the custom model in Cursor and send a prompt. Requests now route through AI Gateway.

To confirm traffic reaches AI Gateway, refer to Verify it works.

Was this helpful?