fix(oauth): mark Copilot models copilot() cannot call

Merged
OK
2mo ago
+43-4

Fixes #745.

  • copilot() posts to /chat/completions. Copilot rejects two kinds of listed models there, and /models already says which:
    • policy.state other than enabled: model_not_supported ("The requested model is not supported")
    • supported_endpoints without /chat/completions (gpt-6-luna, grok, codex, mai-code): unsupported_api_for_model
  • e2e models github-copilot now marks those not enabled and no chat completions (packages/e2e/src/oauth/providers/github-copilot.ts). Entries without the fields (gpt-4.1, gpt-4o) stay unmarked, and they work.
  • Docs: subscriptions.mdx explains both marks; reference/cli.mdx lists them.

Out of scope: running the Responses-only models through copilot(). That needs per-model endpoint selection and @ai-sdk/openai's Responses model, like chatgpt() uses. Copilot's /responses returns 200 for gpt-6-luna, so it is doable as a follow-up.

The reporter also saw gpt-5-mini, kimi-k3 and claude-haiku-4.5 rejected while their fields say enabled + chat completions. All three work on our login, so their plan probably has a restriction these fields don't show. That case is not covered here.

Verified

Ran it locally: yes

  • Built the CLI on main and on this branch, signed in with e2e login github-copilot (gh token, real Copilot plan), and ran e2e models github-copilot:
mainthis branch
claude-opus-5 Claude Opus 5 Anthropic, tools, visionclaude-opus-5 Claude Opus 5 Anthropic, tools, vision, not enabled
gpt-6-luna GPT-6 Luna OpenAI, tools, visiongpt-6-luna GPT-6 Luna OpenAI, tools, vision, no chat completions
gpt-5.5 GPT-5.5 OpenAI, tools, visiongpt-5.5 GPT-5.5 OpenAI, tools, vision, not enabled, no chat completions
claude-sonnet-5 Claude Sonnet 5 Anthropic, tools, visionunchanged
  • Sent every listed id to /chat/completions with the stored token: all 22 unmarked ids returned 200, and all 21 marked ids returned 400.
  • generateText with a tool through the built copilot():
claude-haiku-4.5 ok [{"target":"Click me"}]
gpt-5-mini ok [{"target":"Click me"}]
gpt-6-luna FAIL model "gpt-6-luna" is not accessible via the /chat/completions endpoint
claude-opus-5 FAIL The requested model is not supported.