feat: Add GitHub Models provider (#579) - #584
Open
pranjalparmar wants to merge 3 commits into
Open
Conversation
Resolves andrewyng#546 by adding the Z AI Coding Plan provider (zai-coding). Implements dynamic configuration by updating the _compat factory to support model_choices, allowing users to select their preferred Coding Plan model (e.g., GLM-5.2 or GLM-4 Coder) directly from the settings menu.
There was a problem hiding this comment.
🟡 Changes recommended
Provider configuration logic may incorrectly treat prefilled defaults as an explicit user override, bypassing the intended “only add if suggested/available” gate.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds GitHub Models as a first-class model provider (via the OpenAI-compatible Azure inference endpoint) and adjusts provider configuration behavior so users can supply a custom “default model” string rather than being constrained to a curated list.
Changes:
- Introduces
github(GitHub Models) andzai-codingOpenAI-compatible providers in the provider registry. - Expands the curated model matrix with GitHub Models + Z AI Coding Plan entries.
- Tweaks provider configuration to auto-add user-entered custom model strings, and adjusts the matrix-size guardrail in tests.
File summaries
| File | Description |
|---|---|
tests/test_providers.py |
Raises the matrix size ceiling to accommodate newly added curated models. |
coworker/server/manager.py |
Adjusts auto-add logic for recommended models during provider configuration. |
coworker/providers/registry.py |
Adds configurable recommended_model field for OpenAI-compatible providers; registers GitHub Models + Z AI Coding Plan. |
coworker/providers/matrix.py |
Adds curated model entries for GitHub Models and Z AI Coding Plan. |
Review details
Suppressed comments (1)
coworker/providers/registry.py:628
- Using
env_key="GITHUB_TOKEN"will implicitly pick up the GitHub Actions-providedGITHUB_TOKENin CI environments even when the user hasn’t intentionally configured GitHub Models, which can lead to confusing auth failures (or unintended token reuse) when this provider is selected. Consider using a provider-specific env var name to avoid collisions.
_compat(
"github",
"GitHub Models",
base_url="https://models.inference.ai.azure.com",
recommended_model="gpt-4o",
env_key="GITHUB_TOKEN",
endpoint_help="GitHub Models API endpoint. Requires a GitHub Personal Access Token (PAT).",
- Files reviewed: 4/4 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| @@ -265,26 +265,39 @@ def _compat( | |||
| ) -> ProviderDescriptor: | |||
| """Descriptor for an OpenAI-compatible vendor: key + a prefilled, editable endpoint.""" | |||
Comment on lines
512
to
+515
| # Deliberately small: agent-capable current models only (owner call, 2026-07-04). | ||
| # 60→65 (2026-08-24): the stealth ox-alpha preview slug tipped it; reclaim slack by | ||
| # pruning retired entries before raising this again. | ||
| assert len(MATRIX) < 65 | ||
| assert len(MATRIX) < 75 |
Comment on lines
+3011
to
+3015
| # If the user explicitly typed a model, always add it. | ||
| # If falling back to the provider's default, only add it if the provider reports it as available. | ||
| should_add = bool(user_choice) or (rec and rec in self._suggested_models(name)) | ||
|
|
||
| if should_add and rec: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #579. Adds GitHub Models as an official provider using the OpenAI-compatible Azure inference endpoints. Based on user feedback, this also removes hardcoded model choices from all OpenAI-compatible providers, allowing users to enter any custom model string for ultimate flexibility.