feat(sse): add GPT-4o mini to GitHub Copilot provider (#4797)

Integrated into release/v3.8.37 — cherry-picked defining commit onto release tip; CHANGELOG re-merged; tests green.
This commit is contained in:
Diego Rodrigues de Sa e Souza
2026-06-25 23:43:45 -03:00
committed by GitHub
parent b6917e8e81
commit 527ee1a6fc
2 changed files with 49 additions and 0 deletions

View File

@@ -31,6 +31,10 @@ export const githubProvider: RegistryEntry = {
// 9router#98 — Copilot still serves GPT-4o via chat/completions; keep it
// alongside the GPT-5.x family so apps that hard-code `gpt-4o` resolve here.
{ id: "gpt-4o", name: "GPT-4o", contextLength: 128000 },
// Copilot also serves the cheaper GPT-4o mini via chat/completions; keep it
// alongside gpt-4o so apps that hard-code `gpt-4o-mini` resolve to the Copilot
// (`gh`) provider rather than only the github-models (`ghm`) marketplace entry.
{ id: "gpt-4o-mini", name: "GPT-4o mini", contextLength: 128000 },
{ id: "gpt-5-mini", name: "GPT-5 Mini", targetFormat: "openai-responses" },
{ id: "gpt-5.3-codex", name: "GPT-5.3 Codex", targetFormat: "openai-responses" },
{ id: "gpt-5.4-mini", name: "GPT-5.4 Mini", targetFormat: "openai-responses" },

View File

@@ -0,0 +1,45 @@
import { test } from "node:test";
import assert from "node:assert/strict";
import { getRegistryEntry } from "../../open-sse/config/providerRegistry.ts";
// Regression guard: the GitHub Copilot (`gh`) provider must expose `gpt-4o-mini`
// alongside `gpt-4o`. Copilot serves the cheaper mini variant via
// chat/completions, so apps that hard-code `gpt-4o-mini` should resolve to the
// Copilot provider — not only to the separate github-models (`ghm`) marketplace
// entry, which lists it under the `openai/` prefix (`openai/gpt-4o-mini`).
//
// Ported from upstream decolua/9router (add GPT-4o mini to GitHub Copilot).
test("github (Copilot) provider exposes gpt-4o-mini next to gpt-4o", () => {
const entry = getRegistryEntry("github");
assert.ok(entry, "github registry entry should exist");
assert.ok(entry.models, "github registry entry should have a models array");
const ids = entry.models!.map((m) => m.id);
assert.ok(ids.includes("gpt-4o"), "gpt-4o should remain registered");
assert.ok(
ids.includes("gpt-4o-mini"),
"gpt-4o-mini should be registered on the Copilot (gh) provider"
);
const mini = entry.models!.find((m) => m.id === "gpt-4o-mini");
assert.equal(mini?.name, "GPT-4o mini");
assert.equal(mini?.contextLength, 128000);
});
test("Copilot gpt-4o-mini is distinct from the github-models openai/gpt-4o-mini", () => {
const copilot = getRegistryEntry("github");
const marketplace = getRegistryEntry("github-models");
const copilotIds = (copilot?.models ?? []).map((m) => m.id);
const marketplaceIds = (marketplace?.models ?? []).map((m) => m.id);
// The two providers reference the same upstream model under different ids:
// Copilot uses the bare `gpt-4o-mini`; the marketplace uses `openai/gpt-4o-mini`.
assert.ok(copilotIds.includes("gpt-4o-mini"));
assert.ok(marketplaceIds.includes("openai/gpt-4o-mini"));
assert.ok(
!copilotIds.includes("openai/gpt-4o-mini"),
"Copilot should not carry the marketplace-prefixed id"
);
});