Govern GitHub Copilot with DVARA
GitHub Copilot can send its chat and agent model calls to an endpoint you name, using its "bring your own key" settings. Point those settings at the DVARA AI governance platform and each of those calls gets policy, PII rules, guardrails, budgets, cost records and an audit entry, billed to one DVARA workspace. There is no TLS interception and no change to Copilot itself.
Covered — Copilot's model calls that a bring-your-own-key setting sends to DVARA:
- VS Code: Copilot Chat, inline chat and agent mode, with a Custom Endpoint model.
- Copilot CLI, with its provider settings. Tested with Copilot CLI 1.0.95.
Not covered — these stay on GitHub's own service, and no supported setting sends them anywhere else:
- Inline code completions (the grey suggestions as you type).
- The Copilot cloud agent (the coding agent that works on github.com).
- Copilot code review.
- Semantic search and embeddings in the editor.
Each developer sets the endpoint on their own machine. An admin can switch bring-your-own-key off for an organization, but no setting forces it on or forces it to point at DVARA.
What you need
- A running DVARA 1.9.0 Gateway that the developer's machine can reach.
- A provider on the Gateway for the models you pick: Anthropic models need
ANTHROPIC_API_KEYon the Gateway, OpenAI models needOPENAI_API_KEY. - A DVARA workspace API key for each developer. If the key has scopes, it needs
completions:write. One key per developer lets you see each developer's usage and cost.
Point Copilot CLI at DVARA
Copilot CLI reads its provider from environment variables. Pick one of the provider types below. Use the Anthropic or the Responses type. See Which provider type to choose.
Anthropic models, through DVARA's Messages API:
export COPILOT_PROVIDER_TYPE=anthropic
export COPILOT_PROVIDER_BASE_URL=https://gateway.acme.example.com # no /v1
export COPILOT_PROVIDER_API_KEY=<dvara-workspace-key>
export COPILOT_PROVIDER_MAX_OUTPUT_TOKENS=32000
export COPILOT_MODEL=<anthropic-model-id>
copilot
OpenAI models, through DVARA's Responses API:
export COPILOT_PROVIDER_TYPE=openai
export COPILOT_PROVIDER_WIRE_API=responses
export COPILOT_PROVIDER_BASE_URL=https://gateway.acme.example.com/v1
export COPILOT_PROVIDER_API_KEY=<dvara-workspace-key>
export COPILOT_PROVIDER_MAX_OUTPUT_TOKENS=32000
export COPILOT_MODEL=<openai-model-id>
copilot
- Use a DVARA key, not an Anthropic or OpenAI key.
- The Anthropic type takes the Gateway address with no
/v1. Copilot CLI adds/v1/messagesitself. The OpenAI type takes the address ending in/v1. - GitHub sign-in is not needed for model calls through your own provider.
To stop Copilot CLI contacting GitHub at all, also set
COPILOT_OFFLINE=true. - The model must support tools and streaming. Copilot CLI needs both.
- Set
COPILOT_PROVIDER_MAX_OUTPUT_TOKENSto a value at or below your model's output limit. Without it, Copilot CLI asks for 128,000 output tokens, and Anthropic refuses the request: the error saysmax_tokens: 128000 > 64000for Claude Sonnet 4.5.
Point VS Code Copilot Chat at DVARA
In VS Code, add a model from the Custom Endpoint provider in Copilot
Chat's language model settings. VS Code keeps these models in its
chatLanguageModels.json file. For each model, enter:
| Setting | Value |
|---|---|
| API type | messages for Anthropic models, or responses for OpenAI models |
| Endpoint URL | https://gateway.acme.example.com/v1/messages, or https://gateway.acme.example.com/v1/responses |
| API key | Your DVARA workspace key |
| Model | A model id your Gateway routes |
Then pick that model in the Chat view's model picker. Chat, inline chat and agent mode use it. Inline completions do not. VS Code can also use your model for small background tasks such as chat titles and commit messages; see VS Code's language model settings.
Which provider type to choose
| Provider type | DVARA endpoint | Use it? |
|---|---|---|
Anthropic (anthropic, or API type messages) | /v1/messages | Yes, for Anthropic models |
Responses (openai with wire API responses, or API type responses) | /v1/responses | Yes, for OpenAI models |
OpenAI chat (openai, the default) | /v1/chat/completions | Only if you must |
With the OpenAI chat type, Copilot asks GPT-5-class models for tools and a reasoning effort on the Chat Completions API. OpenAI refuses some of those combinations, and DVARA passes OpenAI's own refusal on to Copilot. The same request fails the same way against OpenAI directly. The Responses type does not have this problem.
What DVARA refuses
DVARA refuses tools that the provider would run itself, such as the provider's own web search, because what they fetch is never checked. Copilot's own tools, including its patch tool, run on the developer's machine and go through.
A refusal comes back as an HTTP error with a JSON body naming the reason, so Copilot shows it. On the Anthropic type it is in Anthropic's error shape; see What does a refusal look like?.
Known limits
- Only what the settings above send reaches DVARA. See the box at the top.
- The admin-managed "custom models" feature is different. GitHub's servers, not the developer's machine, make those calls. DVARA would have to be reachable from the internet, and it would see one shared key rather than each developer. This page does not cover it.
- Copilot's local actions are not governed. File edits and terminal commands run on the developer's machine.
Where to go next
- Govern Claude Code for the Messages API in detail.
- Data-plane API overview
for what
/v1/responsesaccepts. - Authenticate data-plane calls for key scopes.