fix(catalog): routed copilot mai-code models to responses api
GitHub Copilot's mai-code-1-flash-picker (and other mai-* models) are served only through the /responses endpoint; the classifier routed them to /chat/completions, which returned 400 unsupported_api_for_model. Added the mai- prefix to isCopilotResponsesModelId so both dynamic discovery (inferCopilotApi) and bundled resolution (COPILOT_API_RESOLUTION_RULES) select openai-responses, and updated the bundled models.json entry to match. Fixes #5612
This commit is contained in:
@@ -2,6 +2,10 @@
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed GitHub Copilot `mai-code-1-flash-picker` (and other `mai-*` models) to route through the `/responses` endpoint instead of `/chat/completions`, which rejected them with `400 unsupported_api_for_model` ([#5612](https://github.com/can1357/oh-my-pi/issues/5612)).
|
||||
|
||||
## [16.5.2] - 2026-07-14
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -19406,7 +19406,7 @@
|
||||
"mai-code-1-flash-picker": {
|
||||
"id": "mai-code-1-flash-picker",
|
||||
"name": "MAI-Code-1-Flash",
|
||||
"api": "openai-completions",
|
||||
"api": "openai-responses",
|
||||
"provider": "github-copilot",
|
||||
"baseUrl": "https://api.githubcopilot.com",
|
||||
"reasoning": true,
|
||||
@@ -19425,11 +19425,6 @@
|
||||
"User-Agent": "opencode/1.3.15",
|
||||
"X-GitHub-Api-Version": "2026-06-01"
|
||||
},
|
||||
"compat": {
|
||||
"supportsStore": false,
|
||||
"supportsDeveloperRole": false,
|
||||
"supportsReasoningEffort": false
|
||||
},
|
||||
"thinking": {
|
||||
"mode": "effort",
|
||||
"efforts": [
|
||||
|
||||
@@ -3724,7 +3724,7 @@ export interface GithubCopilotModelManagerConfig {
|
||||
|
||||
const COPILOT_ANTHROPIC_MODEL_PATTERN = /^claude-(haiku|sonnet|opus|fable|mythos)-\d/;
|
||||
const isCopilotResponsesModelId = (modelId: string): boolean =>
|
||||
modelId.startsWith("gpt-5") || modelId.startsWith("oswe");
|
||||
modelId.startsWith("gpt-5") || modelId.startsWith("oswe") || modelId.startsWith("mai-");
|
||||
|
||||
function inferCopilotApi(modelId: string): Api {
|
||||
if (COPILOT_ANTHROPIC_MODEL_PATTERN.test(modelId)) {
|
||||
|
||||
@@ -303,6 +303,22 @@ describe("github copilot model limits mapping", () => {
|
||||
// not the OpenAI global reference (1050k).
|
||||
expect(model?.contextWindow).toBe(272_000);
|
||||
});
|
||||
it("routes mai-code models to the openai-responses endpoint (#5612)", async () => {
|
||||
// Copilot's /chat/completions rejects mai-* models with
|
||||
// `unsupported_api_for_model` (400); they are served only via /responses.
|
||||
const { models } = await discoverCopilotModels({
|
||||
data: [
|
||||
{
|
||||
id: "mai-code-1-flash-picker",
|
||||
name: "MAI-Code-1-Flash",
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
const model = models.find(candidate => candidate.id === "mai-code-1-flash-picker");
|
||||
expect(model).toBeDefined();
|
||||
expect(model?.api).toBe("openai-responses");
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user