Cursor
Last updated Oct 16, 2026 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:
- Your Cloudflare account ID. To find it, refer to Find your account and zone IDs.
- A Cloudflare API token with Account > Workers AI > Read permission.
- Credits loaded on your account for third-party models.
-
Cursor ↗︎ installed and updated to the latest version.
-
In Cursor, go to Cursor Settings > Models. Under API Keys, enter your Cloudflare API token in the OpenAI API Key field, then select Save.
- Turn on Override OpenAI Base URL. Enter the following value, replacing
<ACCOUNT_ID>with your Cloudflare account ID:
txt
https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/ai/v1
Note
If Cursor does not show Override OpenAI Base URL, this Cursor version or plan does not support routing OpenAI-compatible requests through AI Gateway. 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.
Note
Workers AI models work with Cursor chat requests through the OpenAI Chat Completions API. Cursor agent mode uses the OpenAI Responses API. Use a third-party Responses-compatible model, such as openai/gpt-4.1-mini, for agent mode.
To confirm traffic reaches AI Gateway, refer to Verify it works.
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/ai-gateway/integrations/coding-agents/cursor/#page","headline":"Cursor","description":"Route Cursor chat and agent requests through AI Gateway using a custom OpenAI base URL.","url":"https://developers.cloudflare.com/ai-gateway/integrations/coding-agents/cursor/","inLanguage":"en","image":"https://developers.cloudflare.com/ai-gateway/integrations/coding-agents/cursor/og.png?v=fcc31784012b2f01","dateModified":"2026-10-16","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
description: Route Gemini CLI through an Access-protected AI Gateway custom domain. title: Gemini CLI image: https://developers.cloudflare.com/ai-gateway/integrations/coding-agents/gemini-cli/og.png?v=bfa3016cbc84b6de
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/ai-gateway/llms.txt
Use this file to discover all available pages before exploring further.
Docs