← Back to docs
Docs / Reference

GitHub Copilot setup

Run GitHub Copilot as the gateway's upstream. You sign in with GitHub instead of an API key, TokenBeaver slims each request, and savings show as capacity — tokens and requests reclaimed, honestly framed.

Two ways Copilot shows up

There are two distinct setups. This page is mainly about the first.

Primary

Copilot as the upstream

Set the gateway's provider to copilot. The gateway talks to Copilot on your behalf using your GitHub sign-in — no API key. Your OpenAI-compatible agent points at the gateway as usual.

Alternative

Copilot BYOK

If you use Copilot's own BYOK setting, point Copilot's custom endpoint at the gateway instead. Full steps are on the providers page.

Auth setup

No API key — the gateway uses a GitHub token. It looks for one in this order: GITHUB_TOKEN → GH_TOKEN → gh auth token. Then set the provider to copilot (restart required).

CLI

Sign in, set the provider

# sign in with the GitHub CLI... gh auth login # ...or export a token instead export GITHUB_TOKEN=ghp_xxx TOKENBEAVER_PROVIDER=copilot tokenbeaver-gateway

Restart the gateway after changing the provider.

VS Code extension

Set the provider on the Settings page

Run gh auth login in a terminal (or set GITHUB_TOKEN), then open TokenBeaver: Settings and pick copilot from the provider dropdown. Restart to apply.

Individual vs business / enterprise

By default the gateway uses the individual Copilot endpoint (https://api.individual.githubcopilot.com as the fallback). On a business or enterprise plan it falls back to the business endpoint — this path is experimental, and it depends on your org allowing programmatic API access (see troubleshooting).

OpenAI-wire only

Copilot speaks the OpenAI wire protocol. It works on /v1/chat/completions; sending an Anthropic /v1/messages request returns HTTP 400. Point your agent at the gateway in OpenAI-compatible mode — use OPENAI_BASE_URL, not ANTHROPIC_BASE_URL.

What savings look like
Capacity, not dollars

Copilot is treated as capacity: the dashboard shows tokens and requests saved, and it forces the capacity view when Copilot is more than half your traffic. You won't see a verified dollar figure, and Copilot savings don't count toward the Pro guarantee's dollar leg.

This is an upfront owner decision: Copilot's credits-based billing makes a token→dollar conversion unverifiable, so we don't claim dollars we can't verify. You still get the real benefit — the same answers from fewer tokens, so your Copilot allowance goes further.

Troubleshooting

no_github_token / invalid_github_token
The gateway couldn't find a valid GitHub token. Run gh auth login (or set GITHUB_TOKEN / GH_TOKEN) and restart the gateway.
saml_required (403)
Your token needs SSO authorization. In GitHub: Settings → Developer settings → Personal access tokens → Configure SSO → Authorize for the org. Then restart the gateway.
org_policy_blocked (403, business)
An org admin must allow programmatic API access to Copilot, or you can use an Individual Copilot subscription instead.
429 rate limit
Transient — the gateway auto-retries. If it persists, you're hitting Copilot's own rate limits; slow down or try again shortly.
My "$ saved" isn't showing
By design — Copilot is capacity-only. You see tokens and requests saved, not verified dollars, because Copilot's credits billing makes token→dollar unverifiable.
Found a bug or have a feature request?

Open a GitHub issue →  ·  Questions? Support

Stuck on setup?

Email [email protected] or visit the support page — a real developer will get back to you.