BYOK: populate the /model picker from the provider's /models endpoint
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Shell
- Star
- 11.2k
- Fork
- 1.9k
- Merge trung bình
- 14 giờ 16 phút
- Pull request đã merge (30 ngày)
- 6
Mô tả
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[].idis enough for a useful picker; if present,capabilities.limits/supported_endpointsstyle 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).
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Theo dõi picker /models của CLI và cấu hình nhà cung cấp tùy chỉnh để tìm nơi danh sách một mô hình hiện tại được tập hợp. Trước tiên, hãy kiểm tra các đường dẫn của nhà cung cấp OpenAI và Azure cùng cách xử lý lỗi hiện có của chúng. Hoàn tất khi một phản hồi /models thành công cung cấp các ID mô hình, còn 404 hoặc các lỗi khác vẫn giữ nguyên hành vi một mô hình hiện tại; metadata tùy chọn và phương án thay thế bằng biến môi trường vẫn là các lựa chọn thiết kế.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- shell
- Lĩnh vực
- api, cli
- Loại issue
- Tính năng
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 52/100