You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|[BYOK (Bring Your Own Key)](./byok.md)| Using your own API keys (Azure AI Foundry, OpenAI, etc.) | No|
13
13
14
14
## GitHub Signed-in User
15
15
16
16
This is the default authentication method when running the Copilot CLI interactively. Users authenticate via GitHub OAuth device flow, and the SDK uses their stored credentials.
17
17
18
18
**How it works:**
19
+
19
20
1. User runs `copilot` CLI and signs in via GitHub OAuth
20
21
2. Credentials are stored securely in the system keychain
21
22
3. SDK automatically uses stored credentials
@@ -51,6 +52,7 @@ await client.start()
51
52
<summary><strong>Go</strong></summary>
52
53
53
54
<!-- docs-validate: skip -->
55
+
54
56
```go
55
57
import copilot "github.com/github/copilot-sdk/go"
56
58
@@ -73,6 +75,7 @@ await using var client = new CopilotClient();
73
75
</details>
74
76
75
77
**When to use:**
78
+
76
79
- Desktop applications where users interact directly
77
80
- Development and testing environments
78
81
- Any scenario where a user can sign in interactively
@@ -82,6 +85,7 @@ await using var client = new CopilotClient();
82
85
Use an OAuth GitHub App to authenticate users through your application and pass their credentials to the SDK. This enables your application to make Copilot API requests on behalf of users who authorize your app.
83
86
84
87
**How it works:**
88
+
85
89
1. User authorizes your OAuth GitHub App
86
90
2. Your app receives a user access token (`gho_` or `ghu_` prefix)
87
91
3. Pass the token to the SDK via `githubToken` option
@@ -95,8 +99,8 @@ Use an OAuth GitHub App to authenticate users through your application and pass
GithubToken=userAccessToken, // Token from OAuth flow
150
+
GitHubToken=userAccessToken, // Token from OAuth flow
145
151
UseLoggedInUser=false, // Don't use stored CLI credentials
146
152
});
147
153
```
148
154
149
155
</details>
150
156
151
157
**Supported token types:**
158
+
152
159
-`gho_` - OAuth user access tokens
153
-
-`ghu_` - GitHub App user access tokens
160
+
-`ghu_` - GitHub App user access tokens
154
161
-`github_pat_` - Fine-grained personal access tokens
155
162
156
163
**Not supported:**
164
+
157
165
-`ghp_` - Classic personal access tokens (deprecated)
158
166
159
167
**When to use:**
168
+
160
169
- Web applications where users sign in via GitHub
161
170
- SaaS applications building on top of Copilot
162
171
- Any multi-user application where you need to make requests on behalf of different users
@@ -166,11 +175,13 @@ await using var client = new CopilotClient(new CopilotClientOptions
166
175
For automation, CI/CD pipelines, and server-to-server scenarios, you can authenticate using environment variables.
167
176
168
177
**Supported environment variables (in priority order):**
178
+
169
179
1.`COPILOT_GITHUB_TOKEN` - Recommended for explicit Copilot usage
170
180
2.`GH_TOKEN` - GitHub CLI compatible
171
181
3.`GITHUB_TOKEN` - GitHub Actions compatible
172
182
173
183
**How it works:**
184
+
174
185
1. Set one of the supported environment variables with a valid token
175
186
2. The SDK automatically detects and uses the token
176
187
@@ -204,6 +215,7 @@ await client.start()
204
215
</details>
205
216
206
217
**When to use:**
218
+
207
219
- CI/CD pipelines (GitHub Actions, Jenkins, etc.)
208
220
- Automated testing
209
221
- Server-side applications with service accounts
@@ -214,12 +226,14 @@ await client.start()
214
226
BYOK allows you to use your own API keys from model providers like Azure AI Foundry, OpenAI, or Anthropic. This bypasses GitHub Copilot authentication entirely.
215
227
216
228
**Key benefits:**
229
+
217
230
- No GitHub Copilot subscription required
218
231
- Use enterprise model deployments
219
232
- Direct billing with your model provider
220
233
- Support for Azure AI Foundry, OpenAI, Anthropic, and OpenAI-compatible endpoints
221
234
222
235
**See the [BYOK documentation](./byok.md) for complete details**, including:
236
+
223
237
- Azure AI Foundry setup
224
238
- Provider configuration options
225
239
- Limitations and considerations
@@ -245,7 +259,7 @@ To prevent the SDK from automatically using stored credentials or `gh` CLI auth,
245
259
246
260
```typescript
247
261
const client =newCopilotClient({
248
-
useLoggedInUser: false,// Only use explicit tokens
262
+
useLoggedInUser: false, // Only use explicit tokens
249
263
});
250
264
```
251
265
@@ -255,6 +269,7 @@ const client = new CopilotClient({
255
269
<summary><strong>Python</strong></summary>
256
270
257
271
<!-- docs-validate: skip -->
272
+
258
273
```python
259
274
client = CopilotClient({
260
275
"use_logged_in_user": False, # Only use explicit tokens
0 commit comments