Developers using Cursor send code, file contents and pasted logs to models all day, and a team lead usually cannot say which models, at what cost, or whether a secret went along. Pointing Cursor's chat at a gateway you control gives you per-person keys, content checks and a record of each request. It does not cover everything Cursor does, and this guide is explicit about where the line is.
The examples use AgentKeyRoute, an AI governance gateway (our product).
What goes through the gateway and what doesn't
Check these limits before you promise anyone a "full audit":
- Custom keys are for chat models. The API key help page says they only work with chat models, and that Tab completion continues to use built-in models. Tab traffic will not appear in your gateway.
- Requests pass through the vendor's backend. Cursor's data use page says that even with your own API key, requests still go through its backend, where final prompt building happens. A gateway only sees a request after that.
- Zero data retention changes. The same help page says Grok Build's zero data retention policy does not apply when you use your own API keys. Data handling then follows your provider's policy.
- The base URL override is not on that help page. It lists OpenAI, Anthropic, Google, Azure OpenAI and AWS Bedrock keys, and does not mention overriding the base URL. Treat the setting as something to verify on your client version and plan, and retest after upgrades.
At the time of writing, cursor.com carries a "Cursor is now Grok Build" banner and the old help address redirects to Grok Build documentation. Menu names may differ from what you see below.
So the accurate claim is this: chat requests that use your custom endpoint are governed and audited. Tab completion and anything on the vendor's built-in models are not.
Step 1: Add providers and say what they are
In the AgentKeyRoute console, open Providers & models. Add OpenAI, Anthropic, Azure, Bedrock or another endpoint and paste its key. Mark where each one runs (public, private cloud or on-prem) and tick only the contracts and attestations you actually hold.
Those ticks drive routing. The coding profile below applies SOC 2, which only lets sensitive data reach providers marked SOC 2 Type II or ISO 27001, or on-prem models. If your only provider doesn't qualify for some data, the request is refused. That is the gateway failing closed, so decide where source code may go before you roll out.
Provider keys stay in the gateway. Developers never hold them.
Step 2: Create one key per developer
Open Connect an app, pick Cursor, and describe who uses it and what data it sees. The recommended profile is usually Coding agents & developer tools. As shipped, it:
- allows source code, subject to the provider requirements above
- always blocks credentials and API keys
- blocks patient data
- redacts personal data
- asks for redacted content capture and one year of retention, within what your plan allows
Issue a separate key to each developer. With a shared key you learn that the team spent money. With personal keys you learn who did, and you can revoke one lost laptop without interrupting everyone else.
Step 3: Point Cursor at the gateway
In Cursor:
1. Cursor Settings → Models. 2. OpenAI API Key: <your API key> 3. Turn on Override OpenAI Base URL: https://gateway.agentkeyroute.com/v1 4. Add custom model: gpt-4.1 5. Click Verify, then pick gpt-4.1 in chat. The key is your AgentKeyRoute key, not an OpenAI key. The base URL ends in /v1.
gpt-4.1 is only an example. One gateway key can be allowed several models across providers. To list exactly what a key may use:
curl https://gateway.agentkeyroute.com/v1/models \ -H "Authorization: Bearer <your API key>" Add the names you want as custom models, and test each one in Cursor before telling the team it works.
A community post on the Cursor forum reports that while the override is on, OpenAI-family requests go to the custom endpoint, including some for Cursor-managed models. It is a report from a user who also runs their own gateway service, not official documentation, but test for it. If a built-in model starts failing after you enable the override, check this first.
Step 4: Verify before you trust it
Test the gateway key from a terminal first, so you can separate gateway problems from editor problems:
curl https://gateway.agentkeyroute.com/v1/chat/completions \ -H "Authorization: Bearer <your API key>" \ -H "Content-Type: application/json" \ -d '{"model":"gpt-4.1","messages":[{"role":"user","content":"Hello"}]}' Then, in Cursor:
- Ask a trivial question in chat with your custom model selected.
- Open Requests in the console. The entry shows what was detected, which rule matched, which model answered, what was redacted, the cost and the timing. No entry means that request did not use your endpoint.
- Paste a fake but realistically formatted API key into a prompt. It should be refused with
data_blocked. - Repeat with each feature your team relies on, such as agent runs and inline edits, and note which ones produce entries. That list is your real audit coverage, and it is what you should tell a reviewer.
If policy doesn't allow the model you picked for some data, the gateway may answer with an allowed one and name it in the X-AIGov-Model response header. The request record shows both the model asked for and the model used.
Every error message ends with a request ID. A developer who hits a refusal can send you that string, and you can search for it and see the decision trace.
Close the gaps with policy
A gateway setting inside an editor is configuration, not a network boundary. A developer can switch the override off. Practical controls:
- Keep raw provider API keys off developer machines, so the gateway key is the only company-paid route.
- Decide in writing whether built-in models and Tab are allowed on sensitive repositories, since the gateway cannot enforce that for you.
- Compare gateway usage per person with what you expect. A developer with no requests is either not using chat or not using your endpoint.
What you get
Audit. Decisions and configuration changes are hash-chained, so editing or deleting a record breaks the chain. You can verify it in one click and export it. Custom plans can stream decisions and incidents to a SIEM.
Redaction and blocking. Detection covers secrets, personal, health and card data and confidential material. Because this runs behind Cursor's backend, it controls what reaches the model provider. It does not stop data from reaching Cursor.
Budgets and kill switches. An app registered through Connect an app is a workload with an owner and an optional monthly budget. When it is used up, requests return budget_exceeded. For a budget per developer, register one app per developer. You can stop a key, a workload, a provider or all workloads, with the reason recorded.
Plan limits. The Free plan fits a small pilot: 3 users, 3 keys, 3 apps and 25,000 requests a month, with 7-day retention and no content capture. See pricing for more.
Deploying air-gapped
AgentKeyRoute can run on-premises, but Cursor is not an air-gapped client: its requests go through the vendor's backend. That also means a gateway address reachable only on localhost or your private network should not be expected to work with it. If code cannot leave your network, use a tool that calls your gateway directly, confirm its other network traffic with your egress firewall, and serve local models through Ollama or vLLM.
Start with two developers
Issue two keys, run for a week, and read the Requests view. You will learn which rules are too strict, which Cursor features your endpoint covers, and what your team actually sends. See AgentKeyRoute for startups, or for enterprises if you need company-wide controls, and sign up free.
Sources
- API keys help page (cursor.com help, now redirecting to Grok Build docs)
- Cursor data use and privacy overview
- Cursor community forum: using a custom OpenAI-compatible API
- AgentKeyRoute documentation
Originally published at agentkeyroute.com. AgentKeyRoute is an AI governance gateway for coding agents, apps and AI websites.
