[github] Add Github Copilot
This commit is contained in:
parent
831eb07945
commit
b161fa4f9a
@ -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]")
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user