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
|`bearerTokenProvider` / `bearer_token_provider`| callback | Returns a bearer token on demand (takes precedence over `apiKey` and `bearerToken`) |
208
209
|`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. |
209
210
|`azure.apiVersion` / `azure.api_version`| string | Azure API version (default: `"2024-10-21"`) |
210
211
@@ -326,7 +327,9 @@ provider: {
326
327
327
328
### Bearer token authentication
328
329
329
-
Some providers require bearer token authentication instead of API keys:
330
+
Some providers require bearer token authentication instead of API keys. Supply a static token with `bearerToken`, or supply a `bearerTokenProvider` callback that the GitHub Copilot SDK runtime invokes before outbound provider requests. The callback or identity library it wraps manages token caching and refresh.
331
+
332
+
Use `bearerToken` when your application already has a token:
330
333
331
334
```typescript
332
335
provider: {
@@ -339,6 +342,22 @@ provider: {
339
342
> [!NOTE]
340
343
> The `bearerToken` option accepts a **static token string** only. The SDK does not refresh this token automatically. If your token expires, requests will fail and you'll need to create a new session with a fresh token.
341
344
345
+
Use `bearerTokenProvider` to acquire tokens on demand:
For more details about acquiring and refreshing Microsoft Entra bearer tokens, see [Azure Managed Identity with BYOK](../setup/azure-managed-identity.md).
360
+
342
361
## Custom model listing
343
362
344
363
When using BYOK, the CLI server may not know which models your provider supports. You can supply a custom `onListModels` handler at the client level so that `client.listModels()` returns your provider's models in the standard `ModelInfo` format. This lets downstream consumers discover available models without querying the CLI.
0 commit comments