Repository navigation
feat(providers): expose gpt-4o on built-in GitHub Copilot (gh) provider #4487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
45 changes: 45 additions & 0 deletions
45
tests/unit/provider-registry-github-copilot-gpt-4o.test.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| /** | ||
| * Port of 9router PR #98 — add GPT-4o to GitHub Copilot (`github`/alias `gh`). | ||
| * | ||
| * Copilot still serves the original `gpt-4o` chat model via its chat/completions | ||
| * endpoint. The OmniRoute registry only ships the GPT-5.x family, so apps that | ||
| * explicitly request `gpt-4o` against the `gh` alias get an "unknown model" | ||
| * error. Adding the entry restores parity with the upstream Copilot catalog | ||
| * without disturbing the GPT-5.x / Claude / Gemini lineups already curated. | ||
| * | ||
| * GPT-4o is a chat/completions model — it must NOT use `openai-responses`. | ||
| */ | ||
| import test from "node:test"; | ||
| import assert from "node:assert/strict"; | ||
|
|
||
| const { REGISTRY } = await import("../../open-sse/config/providerRegistry.ts"); | ||
| const { getModelsByProviderId } = await import("../../open-sse/config/providerModels.ts"); | ||
|
|
||
| type ModelEntry = { id: string; name?: string; targetFormat?: string; [k: string]: unknown }; | ||
|
|
||
| function githubModel(id: string): ModelEntry | undefined { | ||
| const provider = (REGISTRY as Record<string, { models?: ModelEntry[] }>)["github"]; | ||
| return provider?.models?.find((m) => m.id === id); | ||
| } | ||
|
|
||
| test("9router#98 github/gpt-4o is registered under the gh provider", () => { | ||
| const model = githubModel("gpt-4o"); | ||
| assert.ok(model, "gpt-4o must be registered under the github (gh) provider"); | ||
| assert.equal(typeof model?.name, "string"); | ||
| }); | ||
|
|
||
| test("9router#98 github/gpt-4o routes via chat/completions (no openai-responses)", () => { | ||
| const model = githubModel("gpt-4o"); | ||
| assert.ok(model); | ||
| assert.notEqual( | ||
| model.targetFormat, | ||
| "openai-responses", | ||
| "GPT-4o on GitHub Copilot is a chat/completions model — Responses API would reject it" | ||
| ); | ||
| }); | ||
|
|
||
| test("9router#98 getModelsByProviderId(github) exposes gpt-4o", () => { | ||
| const models = getModelsByProviderId("github") as ModelEntry[]; | ||
| const gpt4o = models.find((m) => m.id === "gpt-4o"); | ||
| assert.ok(gpt4o, "gpt-4o resolvable via getModelsByProviderId(github)"); | ||
| }); | ||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using static
importstatements is preferred over top-level dynamicawait import(...)unless there is a specific reason for lazy loading or conditional importing. Static imports allow for better static analysis, type checking, and are more idiomatic in TypeScript.