feat(provider): github copilot auto model#20522
feat(provider): github copilot auto model#20522Aarogaming wants to merge 4 commits intoanomalyco:devfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a native github-copilot/auto model entry so the Copilot provider can delegate “model selection” to GitHub Copilot (“Auto”) rather than requiring users to pick a concrete model ID.
Changes:
- Extend the
github-copilotcustom loader to inject anautomodel into the provider’s model list. - Define metadata/capabilities/limits for the new
automodel entry. - Keep the existing Copilot
getModelselection logic (chat vs responses) unchanged.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| family: "copilot-auto", | ||
| api: { | ||
| id: "auto", | ||
| url: "https://api.github.com/copilot", |
There was a problem hiding this comment.
The new Copilot "auto" model hard-codes api.url to https://api.github.com/copilot, but the rest of the Copilot integration (and existing tests) expect the Copilot base URL to be https://api.githubcopilot.com. This will route requests to the wrong host. Use the same base URL as the other github-copilot models (e.g., copy from an existing model in input.models) or update the URL to the correct Copilot endpoint.
| url: "https://api.github.com/copilot", | |
| url: "https://api.githubcopilot.com", |
| input.models["auto"] = { | ||
| id: ModelID.make("auto"), | ||
| providerID: ProviderID.make("github-copilot"), | ||
| name: "Auto (Server Selected)", | ||
| family: "copilot-auto", |
There was a problem hiding this comment.
input.models["auto"] is assigned unconditionally. Because CUSTOM_LOADERS run after the config-based database extension, this will overwrite any user-specified provider.github-copilot.models.auto configuration (and would also clobber a future models.dev-provided auto entry). Add a guard (only create the model when it doesn’t already exist) or merge with the existing definition so config can override fields like limits/headers/options.
| "github-copilot": async (input) => { | ||
| input.models["auto"] = { | ||
| id: ModelID.make("auto"), | ||
| providerID: ProviderID.make("github-copilot"), | ||
| name: "Auto (Server Selected)", | ||
| family: "copilot-auto", | ||
| api: { | ||
| id: "auto", | ||
| url: "https://api.github.com/copilot", | ||
| npm: "@ai-sdk/github-copilot", |
There was a problem hiding this comment.
This change adds a new built-in model entry ("github-copilot/auto") via a custom loader, but there isn’t any test coverage ensuring it shows up in Provider.list() (and that its api.url/api.npm are correct) under typical config/env setups. Please add a provider-layer test (similar to existing packages/opencode/test/provider/provider.test.ts cases) that asserts the auto model is present and uses the expected Copilot base URL.
Issue for this PR
Closes #20607
Type of change
What does this PR do?
Adds support for GitHub Copilot Auto model provider as a native integration, expanding our supported LLMs.
How did you verify your code works?
Tested the new provider internally via the UI and checked the network requests and token authentication.
Screenshots / recordings
Checklist