BYOK: populate the /model picker from the provider's /models endpoint
- Lingua principale
- Shell
- Stelle
- 11.2k
- Fork
- 1.9k
- Merge medio
- 14h 16m
- PR unite (30g)
- 6
Descrizione
## Problem
When the CLI runs against a custom provider (`COPILOT_PROVIDER_BASE_URL`), exactly one model can be configured (`COPILOT_MODEL` / `COPILOT_PROVIDER_MODEL_ID`). In-session, `/models` shows only that single configured model — there is no way to browse or switch models without quitting and relaunching with `--model` (which must be guessed, since nothing lists what the provider serves).
## Request
For `COPILOT_PROVIDER_TYPE=openai` (and `azure`), populate the model picker from the provider's standard OpenAI-compatible catalog endpoint:
```
GET {COPILOT_PROVIDER_BASE_URL}/models
```
- Fall back silently to today's single-model behavior when the endpoint 404s or errors.
- `data[].id` is enough for a useful picker; if present, `capabilities.limits` / `supported_endpoints` style metadata could fill the Context column the way the native picker does.
A lighter-weight alternative (or complement): a `COPILOT_PROVIDER_MODELS` env var accepting a comma-separated id list, for providers whose catalog endpoint can't be reached at startup.
## Why it matters
Practically every OpenAI-compatible backend already serves `/models` — Ollama, vLLM, LiteLLM, Azure, and enterprise LLM gateways. We operate such a gateway: it fronts the Copilot API itself (billing stays on the user's Copilot seat) and serves `GET /models` with exactly the models the seat's plan/org policy allows — but the CLI never asks, so enrolled users see a one-entry picker and file "the CLI is broken" reports, while the native CLI right next to it shows the full list.
Observed on v1.0.77 and v1.0.78 (linux-x64 and darwin-arm64).
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Segui il picker /models della CLI e la configurazione dei provider personalizzati per trovare dove viene assemblato l'attuale elenco con un singolo modello. Inizia controllando i percorsi dei provider OpenAI e Azure e la relativa gestione degli errori esistente. Il lavoro è completato quando una risposta /models riuscita fornisce gli ID dei modelli, mentre i 404 o altri errori mantengono l'attuale comportamento con un singolo modello; i metadati opzionali e l'alternativa tramite variabile d'ambiente restano scelte di progettazione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- shell
- Ambito
- api, cli
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 52/100