AI coding assistant governance: how to govern Claude Code, Codex and Cursor in an enterprise
AI coding assistant governance for enterprises: route Claude Code, Codex and Cursor through one gateway, assign models by group, set budgets and keep an audit trail.
AI coding assistant governance is how an enterprise lets developers use tools such as Claude Code, Codex and Cursor while keeping control of the code, secrets, models and money involved. The most practical way to do it is one gateway: every request from every assistant passes through a single control point that knows who the developer is, which models they may use, what must not leave, and how much has been spent.
This guide shows how to set that up — from inventory to enforcement — without slowing your engineering teams down.
Why are coding assistants different from chat tools?
Coding assistants are not a browser tab. They run in the terminal and IDE, read files from the repository, run commands and send large amounts of context to the model on every turn. That changes the risk profile:
- More data leaves, more often. An agentic assistant may send several files with each request, including configuration files that hold secrets.
- Usage is heavy and variable. One long agent session can consume far more tokens than a week of chat use.
- They are easy to install privately. A developer can install a CLI tool and use a personal API key in minutes — a common form of shadow AI.
- They touch regulated code. In a bank or hospital, the repository may contain logic that handles personal data, and test fixtures that contain real-looking identifiers.
Banning them is rarely realistic; developers who have used them do not want to go back. Governing them is.
What should coding assistant governance cover?
| Area | Question it answers | Control |
|---|---|---|
| Identity | Who sent this request? | Per-user credentials from your directory, no shared API keys |
| Tool approval | Which assistants are allowed? | Approved list; direct access to provider APIs blocked |
| Model access | Which models may this team use? | Model assignment by group |
| Data protection | What must never reach the model? | Block secrets and keys; redact Aadhaar, PAN, card numbers |
| Cost | How much can this team spend? | Budgets and token quotas, alert or stop |
| Behaviour | What should the assistant be told about our standards? | Instructions per group |
| Evidence | What happened, and when? | Searchable request history per user, app and model |
Step 1: Inventory what developers already use
Before you configure anything, find out what is in use. Check endpoint software inventories for CLI tools and IDE extensions, web proxy logs for model provider domains, and expense claims for subscriptions. Ask engineering leads directly; most will tell you, because they want a sanctioned route.
Step 2: Choose the approved assistants and models
Pick the assistants that cover real needs — often one terminal-based agent and one IDE-based tool — and the models they will use. Compare models on capability and price for your workloads. A strong model for complex refactoring may cost several times more per token than a fast model that is fine for test generation and explanations.
Step 3: Route every assistant through one gateway
Each tool has its own way of pointing at a custom endpoint:
- Claude Code. Anthropic documents connecting Claude Code to an LLM gateway by setting
ANTHROPIC_BASE_URL(with a credential). Administrators can deliver this through managed settings, so the gateway address is set centrally rather than by each developer. - Codex. The Codex configuration file supports defining a model provider with its own
base_url, or pointing the built-in OpenAI provider at a proxy. OpenAI’s advanced configuration documentation describes both. - Cursor. Configure Cursor to use the gateway following Cursor’s and your gateway’s documented setup for custom endpoints and keys, and test that requests appear in the gateway’s log.
Whatever the tool, the principle is the same: developers authenticate to the gateway as themselves, and only the gateway holds the provider credentials. Personal API keys stop being necessary, and you can revoke access for a leaver in one place.
Once approved tools work through the gateway, block direct access to model provider APIs from corporate devices at your web proxy or endpoint DLP. Otherwise the gateway is optional.
Step 4: Assign models by group
Use directory groups — synchronised from Microsoft Entra ID, for example — to decide who gets which model:
- Platform and core engineering: the most capable coding model, for complex multi-file work.
- Application teams: a balanced model for day-to-day development.
- Interns and contractors: a cheaper model, with tighter quotas.
- AI evaluation group: access to new models under review before wider rollout.
Model assignment by group also keeps regulated work on approved deployments — for instance, routing a team that handles customer data to your own Azure or Anthropic deployment rather than a general endpoint.
Step 5: Protect secrets and personal data in prompts
Coding assistants send files, and files contain secrets. Put rules at the gateway:
- Block private keys, cloud credentials, API tokens, passwords and connection strings. Tell the developer which file or line triggered the block.
- Redact Aadhaar, PAN and card numbers that appear in test data, logs or fixtures.
- Alert on internal code names or classification labels while you tune.
When a secret is caught, rotate it. It was already sitting in a file on a developer machine, which is a finding in itself. Our guide to PII redaction for LLM prompts explains how to design detection rules that do not drown developers in false positives.
Step 6: Set budgets and quotas
Agentic tools make cost unpredictable. Set:
- Group budgets per month, with an alert at a threshold and an optional hard stop at the limit.
- Per-user token quotas to catch runaway sessions or scripts.
- A monthly review of cost per team against output, so you can move teams to cheaper models where quality is equal.
A worked example: a 120-developer engineering organisation at contoso.in sets a monthly budget for each of its four squads. One squad hits 80 per cent of its budget in the second week; the alert prompts a look at usage, which shows a scheduled script calling the most expensive model in a loop. The fix is a five-minute change. Without the budget alert, it would have been discovered on the invoice.
Step 7: Give assistants your standards, per group
Most assistants accept standing instructions. Setting instructions per group at the gateway lets you tell every assistant used by a team about your secure coding standards, approved libraries, logging rules or the requirement never to generate code that logs personal data — consistently, without relying on each developer’s local configuration.
Step 8: Keep the record
Every request should be searchable by developer, group, tool, model, date, tokens, cost and outcome (allowed, redacted, blocked). Access to view prompt content should be limited to named reviewers and itself audited, because prompts contain code and occasionally personal data. Dashboards per user, group and app help engineering managers see adoption and spend without reading anyone’s prompts.
A rollout checklist
- Inventory of AI coding tools in use
- Approved assistants and models chosen for real workloads
- Claude Code, Codex and Cursor configured to use the gateway, centrally where possible
- Per-user authentication; no shared or personal provider keys
- Direct access to provider APIs blocked from corporate devices
- Models assigned by directory group
- Secrets blocked; Aadhaar, PAN and card numbers redacted
- Group budgets and per-user quotas, with alerts
- Instructions per group for coding standards
- Searchable audit trail; prompt viewing restricted and audited
Where Ayati AI Governance fits
Ayati AI Governance is the gateway for Claude Code, Codex, Cursor and chat apps, including your own Azure or Anthropic deployments. It assigns models by group with users synced from Entra ID, compares models side by side on live prices, enforces budgets and token quotas, sets instructions per group, and redacts Aadhaar, PAN, card numbers and secrets before a prompt leaves your network. Every request is on the record, with prompt viewing audited.
For the wider programme, read what AI governance means for enterprises. To see your own developers’ tools running through a governed gateway, book a demo.
Frequently asked questions
What is AI coding assistant governance?
It is the set of controls that decide which developers can use which AI coding tools and models, what code and secrets may be sent to them, how much they can spend, and how every request is recorded.
Can Claude Code be routed through a corporate gateway?
Yes. Anthropic documents connecting Claude Code to an LLM gateway using the ANTHROPIC_BASE_URL setting, and administrators can deliver that setting through managed settings so developers do not configure it by hand.
Can Codex use a custom endpoint?
Yes. The Codex configuration file lets you define a model provider with its own base URL, or point the built-in OpenAI provider at a proxy, so requests can go through a governed gateway.
How do you stop secrets being sent to a coding assistant?
Inspect prompts at a gateway and block requests that contain private keys, cloud credentials, tokens or passwords, with a clear message to the developer. Rotate any secret that was caught, because it was already exposed on the developer’s machine.