[github] Add Github Copilot

This commit is contained in:
Jeroen Evens 2026-02-06 18:38:18 +01:00
parent 831eb07945
commit b161fa4f9a
3 changed files with 13 additions and 2 deletions

View File

@ -892,7 +892,9 @@ def status():
p = getattr(config.providers, spec.name, None)
if p is None:
continue
if spec.is_local:
if spec.is_oauth:
console.print(f"{spec.label}: [green]✓ (OAuth)[/green]")
elif spec.is_local:
# Local deployments show api_base instead of api_key
if p.api_base:
console.print(f"{spec.label}: [green]✓ {p.api_base}[/green]")

View File

@ -298,7 +298,9 @@ class Config(BaseSettings):
if spec.is_oauth:
continue
p = getattr(self.providers, spec.name, None)
if p and p.api_key:
if p is None:
continue
if p.api_key:
return p, spec.name
return None, None

View File

@ -38,6 +38,9 @@ class LiteLLMProvider(LLMProvider):
# api_key / api_base are fallback for auto-detection.
self._gateway = find_gateway(provider_name, api_key, api_base)
# Detect GitHub Copilot (uses OAuth device flow, no API key)
self.is_github_copilot = "github_copilot" in default_model
# Configure environment variables
if api_key:
self._setup_env(api_key, api_base, default_model)
@ -76,6 +79,10 @@ class LiteLLMProvider(LLMProvider):
def _resolve_model(self, model: str) -> str:
"""Resolve model name by applying provider/gateway prefixes."""
# GitHub Copilot models pass through directly
if self.is_github_copilot:
return model
if self._gateway:
# Gateway mode: apply gateway prefix, skip provider-specific prefixes
prefix = self._gateway.litellm_prefix