# Use GitHub Copilot on AnyRouter

> Sign in with GitHub or create a fine-grained token with Copilot Requests, then use your own Copilot subscription through AnyRouter's OpenAI-compatible API.


# Use GitHub Copilot on AnyRouter

You can route inference through your own GitHub Copilot subscription with [BYOK](/features/byok). AnyRouter spends no credits on these requests. You need an active Copilot plan (Free, Pro, Business or Enterprise), and the models available to you follow your plan.

> **GitHub Models is not the same service.** GitHub retired the Models inference API on 30 July 2026. This guide uses the Copilot inference API, which is still available to Copilot subscribers.

## Option 1. Sign in with GitHub

1. Open [Dashboard → BYOK](https://anyrouter.dev/dashboard/byok) and add the **GitHub Copilot** key.
2. Choose **Sign in with GitHub**. AnyRouter shows a short code and a link to GitHub.
3. Open [github.com/login/device](https://github.com/login/device), enter the code, and approve with the account that has your Copilot plan.
4. Return to the dashboard. The token is filled in for you. Save the key.

The sign-in never leaves a token in your browser history. Only the short user code is shown, and AnyRouter stores the resulting token encrypted.

## Option 2. Create a fine-grained personal access token

1. Go to [github.com/settings/personal-access-tokens](https://github.com/settings/personal-access-tokens). In GitHub's menus this is **Settings → Developer Settings → Fine-grained personal access tokens**.
2. Select **Generate new token** and choose the resource owner that holds your Copilot plan.
3. Under **Permissions**, find **Copilot Requests** and set it to **Read-only**.
4. Generate the token and copy it. GitHub shows it only once.
5. In [Dashboard → BYOK](https://anyrouter.dev/dashboard/byok), add the **GitHub Copilot** key and paste the token. Save it.

Classic tokens that start with `ghp_` do not work with the Copilot API. Use the fine-grained token or the device sign-in above.

## Use the key

There is no special header or provider field. Send an ordinary Chat Completions request with an AnyRouter key and a model that has a Copilot route, for example `openai/gpt-4o-mini`.

```bash
curl https://anyrouter.dev/v1/chat/completions \
  -H "Authorization: Bearer sk-ar-v1-..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-4o-mini",
    "messages": [{"role": "user", "content": "Say hello in one sentence."}]
  }'
```

AnyRouter exchanges your stored GitHub token for a short-lived Copilot session on each request and refreshes it automatically. Your GitHub token is never sent to the inference upstream.

## Limits

- An active Copilot plan is required. A GitHub account alone is not enough.
- Individual plans are supported today. Copilot Enterprise proxy endpoints return an error until a dedicated gateway host is registered.
- Your plan controls which model ids Copilot accepts. A model outside your plan returns an error from GitHub.
- Copilot keys are BYOK only. They are never added to the shared pool and never billed to AnyRouter credits.


## Related

- [Bring Your Own Key (BYOK)](/docs/features/byok.md)
- [BYOK Provider Setup Guide](/docs/features/byok-providers.md)
- [Get a provider API key](/docs/guides/byok-provider-keys.md)
