Skip to content

Commit 6f3f728

Browse files
authored
Merge pull request #44553 from github/repo-sync
Repo sync
2 parents 72e27c8 + 5e56f9f commit 6f3f728

39 files changed

Lines changed: 1896 additions & 286 deletions
-4 Bytes
Loading
-5 Bytes
Loading
53.1 KB
Loading

content/copilot/how-tos/copilot-sdk/auth/authenticate.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ await using var client = new CopilotClient();
9393
{% codetab java %}
9494

9595
```java
96-
import com.github.copilot.sdk.CopilotClient;
96+
import com.github.copilot.CopilotClient;
9797

9898
// Default: uses logged-in user credentials
9999
var client = new CopilotClient();
@@ -166,7 +166,7 @@ func main() {
166166
import copilot "github.com/github/copilot-sdk/go"
167167

168168
client := copilot.NewClient(&copilot.ClientOptions{
169-
GithubToken: userAccessToken, // Token from OAuth flow
169+
GitHubToken: userAccessToken, // Token from OAuth flow
170170
UseLoggedInUser: copilot.Bool(false), // Don't use stored CLI credentials
171171
})
172172
```
@@ -198,9 +198,11 @@ await using var client = new CopilotClient(new CopilotClientOptions
198198
{% endcodetab %}
199199
{% codetab java %}
200200

201+
<!-- docs-validate: skip -->
202+
201203
```java
202-
import com.github.copilot.sdk.CopilotClient;
203-
import com.github.copilot.sdk.json.*;
204+
import com.github.copilot.CopilotClient;
205+
import com.github.copilot.rpc.*;
204206

205207
var client = new CopilotClient(new CopilotClientOptions()
206208
.setGitHubToken(userAccessToken) // Token from OAuth flow
@@ -292,13 +294,15 @@ BYOK allows you to use your own API keys from model providers like Azure AI Foun
292294

293295
When multiple authentication methods are available, the SDK uses them in this priority order:
294296

295-
1. **Explicit `gitHubToken`** - Token passed directly to SDK constructor
297+
1. **Explicit `gitHubToken`** - Token passed directly to the SDK client or session configuration
296298
1. **HMAC key** - `CAPI_HMAC_KEY` or `COPILOT_HMAC_KEY` environment variables
297299
1. **Direct API token** - `GITHUB_COPILOT_API_TOKEN` with `COPILOT_API_URL`
298300
1. **Environment variable tokens** - `COPILOT_GITHUB_TOKEN``GH_TOKEN``GITHUB_TOKEN`
299301
1. **Stored OAuth credentials** - From previous `copilot` CLI login
300302
1. **GitHub CLI** - `gh auth` credentials
301303

304+
For multi-user server mode, pass a per-session `gitHubToken` so each session runs with the correct GitHub identity; see [AUTOTITLE](/copilot/how-tos/copilot-sdk/setup/multi-tenancy).
305+
302306
## Disabling auto-login
303307

304308
To prevent the SDK from automatically using stored credentials or `gh` CLI auth, use the `useLoggedInUser: false` option:
@@ -365,8 +369,8 @@ await using var client = new CopilotClient(new CopilotClientOptions
365369
{% codetab java %}
366370

367371
```java
368-
import com.github.copilot.sdk.CopilotClient;
369-
import com.github.copilot.sdk.json.*;
372+
import com.github.copilot.CopilotClient;
373+
import com.github.copilot.rpc.*;
370374

371375
var client = new CopilotClient(new CopilotClientOptions()
372376
.setUseLoggedInUser(false) // Only use explicit tokens

content/copilot/how-tos/copilot-sdk/auth/byok.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func main() {
126126
Provider: &copilot.ProviderConfig{
127127
Type: "openai",
128128
BaseURL: "https://your-resource.openai.azure.com/openai/v1/",
129-
WireApi: "responses", // Use "completions" for older models
129+
WireAPI: "responses", // Use "completions" for older models
130130
APIKey: os.Getenv("FOUNDRY_API_KEY"),
131131
},
132132
})
@@ -177,9 +177,8 @@ Console.WriteLine(response?.Data.Content);
177177
{% codetab java %}
178178

179179
```java
180-
import com.github.copilot.sdk.CopilotClient;
181-
import com.github.copilot.sdk.events.*;
182-
import com.github.copilot.sdk.json.*;
180+
import com.github.copilot.CopilotClient;
181+
import com.github.copilot.rpc.*;
183182

184183
var client = new CopilotClient();
185184
client.start().get();
@@ -214,15 +213,17 @@ client.stop().get();
214213
| `baseUrl` / `base_url` | string | **Required.** API endpoint URL |
215214
| `apiKey` / `api_key` | string | API key (optional for local providers like Ollama) |
216215
| `bearerToken` / `bearer_token` | string | Bearer token auth (takes precedence over apiKey) |
217-
| `wireApi` / `wire_api` | `"completions"` \| `"responses"` | API format (default: `"completions"`) |
216+
| `wireApi` / `wire_api` | `"completions"` \| `"responses"` | Select `"completions"` for broad model compatibility (the Chat Completions API); select `"responses"` for multi-turn state management, tool namespacing, and reasoning support (the Responses API). Anthropic models always use the Messages API regardless of this setting. |
218217
| `azure.apiVersion` / `azure.api_version` | string | Azure API version (default: `"2024-10-21"`) |
219218

220219
### Wire API format
221220

222221
The `wireApi` setting determines which OpenAI API format to use:
223222

224-
* **`"completions"`** (default) - Chat Completions API (`/chat/completions`). Use for most models.
225-
* **`"responses"`** - Responses API. Use for GPT-5 series models that support the newer responses format.
223+
* **`"completions"`** (default) - Chat Completions API (`/chat/completions`) for broad model compatibility.
224+
* **`"responses"`** - Responses API for multi-turn state management, tool namespacing, and reasoning support.
225+
226+
Anthropic models always use the Anthropic Messages API regardless of this setting.
226227

227228
### Type-specific notes
228229

@@ -450,8 +451,8 @@ var client = new CopilotClient(new CopilotClientOptions
450451
{% codetab java %}
451452

452453
```java
453-
import com.github.copilot.sdk.CopilotClient;
454-
import com.github.copilot.sdk.json.*;
454+
import com.github.copilot.CopilotClient;
455+
import com.github.copilot.rpc.*;
455456
import java.util.List;
456457
import java.util.concurrent.CompletableFuture;
457458

@@ -489,6 +490,7 @@ Some Copilot features may behave differently with BYOK:
489490
* **Model availability** - Only models supported by your provider are available
490491
* **Rate limiting** - Subject to your provider's rate limits, not Copilot's
491492
* **Usage tracking** - Usage is tracked by your provider, not GitHub Copilot
493+
* **Premium requests** - Do not count against Copilot premium request quotas
492494

493495
### Provider-specific limitations
494496

0 commit comments

Comments
 (0)