github / github/copilot-cli

BYOK: populate the /model picker from the provider's /models endpoint

未关闭
#4,358 1 条评论 9 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

triage
主要语言
Shell
星标
11.2k
派生
1.9k
平均合并
14 小时 16 分钟
30 天内合并 PR
6

描述

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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

跟踪 CLI 的 /models 选择器和自定义提供商配置,找出当前单模型列表的组装位置。首先检查 OpenAI 和 Azure 提供商路径及其现有的错误处理。完成的标准是:成功的 /models 响应提供模型 ID,而 404 或其他错误保留当前的单模型行为;可选元数据和环境变量替代方案仍由设计决定。

由索引模型根据 Issue 内容生成。

评估

技术栈
shell
领域
api, cli
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
52/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。