Skip to main content

Crate aither_copilot

Crate aither_copilot 

Source
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:

  1. Call auth::request_device_code to get a device code and verification URL
  2. Direct the user to the verification URL to enter the code
  3. Call auth::poll_for_token to wait for the user to complete authentication
  4. Use the token to create a Copilot client
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 Copilot clients.
Copilot
GitHub Copilot language model client.
CopilotProvider
Provider capable of listing and instantiating Copilot models.

Enums§

CopilotError
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.