Skip to content

Commit cdd1546

Browse files
committed
docs: Improve GitHub Copilot connection docs tone and structure
1 parent 6a3bb0f commit cdd1546

File tree

1 file changed

+50
-27
lines changed

1 file changed

+50
-27
lines changed

aider/website/docs/llms/github.md

Lines changed: 50 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,56 @@ parent: Connecting to LLMs
33
nav_order: 510
44
---
55

6-
# GitHub Copilot models
6+
# GitHub Copilot compatible API
77

8-
Aider can talk to the GitHub Copilot LLMs because Copilot exposes an **OpenAI-compatible** REST
9-
API at `https://api.githubcopilot.com`.
10-
11-
The only trick is getting an OAuth access token that has permission to call the Copilot
12-
endpoint.
13-
The easiest, **official** way is to sign in to Copilot from any JetBrains IDE
14-
(Goland, PyCharm, etc).
15-
After you sign in, a file appears at:
8+
Aider can connect to GitHub Copilot’s LLMs because Copilot exposes a standard **OpenAI-style**
9+
endpoint at:
1610

1711
```
18-
~/.config/github-copilot/apps.json
12+
https://api.githubcopilot.com
1913
```
2014

21-
Inside you will find an `oauth_token` value – copy that string, **it is your API key**.
15+
First, install aider:
16+
17+
{% include install.md %}
2218

2319
---
2420

25-
## Configure the environment
21+
## Configure your environment
2622

2723
```bash
2824
# macOS/Linux
2925
export OPENAI_API_BASE=https://api.githubcopilot.com
30-
export OPENAI_API_KEY=<oauth_token from apps.json>
26+
export OPENAI_API_KEY=<oauth_token>
3127

3228
# Windows (PowerShell)
3329
setx OPENAI_API_BASE https://api.githubcopilot.com
3430
setx OPENAI_API_KEY <oauth_token>
35-
# …restart the shell so the variables are picked up
31+
# …restart the shell after setx commands
3632
```
3733

3834
---
3935

40-
## Pick a model
36+
### Where do I get the token?
37+
The easiest path is to sign in to Copilot from any JetBrains IDE (PyCharm, GoLand, etc).
38+
After you authenticate a file appears:
39+
40+
```
41+
~/.config/github-copilot/apps.json
42+
```
43+
44+
Copy the `oauth_token` value – that string is your `OPENAI_API_KEY`.
45+
46+
*Note:* tokens created by the Neovim **copilot.lua** plugin (old `hosts.json`) sometimes lack the
47+
needed scopes. If you see “access to this endpoint is forbidden”, regenerate the token with a
48+
JetBrains IDE or the VS Code Copilot extension.
49+
50+
---
51+
52+
## Discover available models
4153

4254
Copilot hosts many models (OpenAI, Anthropic, Google, etc).
43-
You can discover the list that your subscription allows with:
55+
List the models your subscription allows with:
4456

4557
```bash
4658
curl -s https://api.githubcopilot.com/models \
@@ -49,16 +61,29 @@ curl -s https://api.githubcopilot.com/models \
4961
-H "Copilot-Integration-Id: vscode-chat" | jq -r '.data[].id'
5062
```
5163

52-
The returned IDs are used exactly like OpenAI models, but **prefixed with `openai/`** when you
53-
pass them to aider:
64+
Each returned ID can be used with aider by **prefixing it with `openai/`**:
5465

5566
```bash
5667
aider --model openai/gpt-4o
5768
# or
5869
aider --model openai/claude-3.7-sonnet-thought
5970
```
6071

61-
You can also store this in `~/.aider.conf.yml`:
72+
---
73+
74+
## Quick start
75+
76+
```bash
77+
# change into your project
78+
cd /to/your/project
79+
80+
# talk to Copilot
81+
aider --model openai/gpt-4o
82+
```
83+
84+
---
85+
86+
## Optional config file (`~/.aider.conf.yml`)
6287

6388
```yaml
6489
openai-api-base: https://api.githubcopilot.com
@@ -70,13 +95,11 @@ show-model-warnings: false
7095
7196
---
7297
73-
## Notes & FAQ
98+
## FAQ
7499
75-
* Copilot billing is handled entirely by GitHub. Calls made through aider count against your
76-
Copilot subscription, even though aider will still print estimated costs.
77-
* Tokens created by **Neovim copilot.lua** or older `hosts.json` files sometimes lack the
78-
required scopes. If you get `access to this endpoint is forbidden`, regenerate the token via a
79-
JetBrains IDE or VS Code Copilot extension.
80-
* The Copilot terms of service allow third-party “agents” that access the LLM endpoint. Aider
81-
merely follows the documented API and **does not scrape the web UI**.
100+
* Calls made through aider are billed through your Copilot subscription
101+
(aider will still print *estimated* costs).
102+
* The Copilot docs explicitly allow third-party “agents” that hit this API – aider is playing by
103+
the rules.
104+
* Aider talks directly to the REST endpoint—no web-UI scraping or browser automation.
82105

0 commit comments

Comments
 (0)