Expand description
GitHub Copilot integration for the Aither framework.
This crate provides a Copilot client that implements the LanguageModel trait,
allowing you to use GitHub Copilot’s chat API through the unified aither interface.
GitHub Copilot uses OAuth device flow for authentication. The typical flow is:
- Call
auth::request_device_codeto get a device code and verification URL - Direct the user to the verification URL to enter the code
- Call
auth::poll_for_tokento wait for the user to complete authentication - Use the token to create a
Copilotclient
use aither_copilot::{Copilot, auth};
use aither_core::LanguageModel;
// Request device code
let device_code = auth::request_device_code().await?;
println!("Visit {} and enter code: {}", device_code.verification_uri, device_code.user_code);
// Poll for token
let token = auth::poll_for_token(&device_code.device_code, device_code.interval).await?;
// Create client
let copilot = Copilot::new(token.access_token);Modules§
- auth
- OAuth device flow authentication for GitHub Copilot.
Structs§
- Builder
- Builder for
Copilotclients. - Copilot
- GitHub Copilot language model client.
- Copilot
Provider - Provider capable of listing and instantiating
Copilotmodels.
Enums§
- Copilot
Error - Errors that can arise when calling the GitHub Copilot API.
Constants§
- CLAUDE_
FABLE_ 5 - Claude Fable 5.
- CLAUDE_
HAIKU_ 4_ 5 - Claude Haiku 4.5.
- CLAUDE_
OPUS_ 5 - Claude Opus 5.
- CLAUDE_
OPUS_ 4_ 7 - Claude Opus 4.7.
- CLAUDE_
OPUS_ 4_ 8 - Claude Opus 4.8.
- CLAUDE_
SONNET_ 5 - Claude Sonnet 5.
- COPILOT_
BASE_ URL - Base URL for GitHub Copilot API.
- COPILOT_
CLIENT_ ID - OAuth client ID for GitHub Copilot (VS Code’s client ID).
- COPILOT_
INTEGRATION_ ID - Copilot integration ID header value.
- COPILOT_
TOKEN_ URL - GitHub API endpoint to exchange OAuth token for Copilot session token.
- DEFAULT_
MODEL - Default model for chat completions.
- EDITOR_
VERSION - Editor version header value (identifies as VS Code).
- GITHUB_
DEVICE_ CODE_ URL - GitHub OAuth device authorization endpoint.
- GITHUB_
TOKEN_ URL - GitHub OAuth token endpoint.
- GPT5_4
- GPT-5.4.
- GPT5_5
- GPT-5.5.
- GPT5_
3_ CODEX - GPT-5.3-Codex — the base and long-term-support model.
- GPT5_
4_ MINI - GPT-5.4 mini.
- GPT5_
6_ LUNA - GPT-5.6 Luna — efficient, for high-volume work.
- GPT5_
6_ SOL - GPT-5.6 Sol — frontier capability.
- GPT5_
6_ TERRA - GPT-5.6 Terra — strong performance at lower cost.
- GPT5_
MINI - GPT-5 mini.