CopilotAdapter
Category: Providers
Source: copilot_adapter.dart
Adapter for GitHub Copilot using OAuth 2.0 device authorization + a periodically-refreshed short-lived Copilot bearer token.
Endpoints (all public; same client id as the Copilot CLI / LiteLLM):
github.com/login/device/code— start device flowgithub.com/login/oauth/access_token— poll for user approvalapi.github.com/copilot_internal/v2/token— exchange → Copilot bearerapi.githubcopilot.com/chat/completions— OpenAI-compatible inference
Classes
CopilotAdapter
Constructor
dart
CopilotAdapter({
http.Client? client,
CredentialStore? credentialStore,
this._requestClientFactory,
})Properties
| Property | Type | Description |
|---|---|---|
adapterId | String get | |
deviceCode | String | |
userCode | String | |
verificationUri | String | |
interval | Duration | |
expiresIn | Duration | |
store | CredentialStore | |
model | String | |
systemPrompt | String | |
baseUrl | String | |
adapterId | String get |
Methods
ProviderHealth validate(ResolvedProvider provider)
bool isConnected(ProviderDef provider, CredentialStore store)
`LlmClient createClient({
required ResolvedProvider provider,
required ResolvedModel model,
required String systemPrompt,
})`
`Future<AuthFlow?> beginInteractiveAuth({
required ProviderDef provider,
required CredentialStore store,
})`