fix(ai): route Copilot Grok 4.5 through Responses, closes #7560

This commit is contained in:
Vegard Stikbakke
2026-08-04 12:42:01 +02:00
parent e741cb05ca
commit 720f0e8eeb
4 changed files with 15 additions and 4 deletions
+1
View File
@@ -75,6 +75,7 @@
### Fixed
- Fixed GitHub Copilot Grok 4.5 requests to use the supported Responses API ([#7560](https://github.com/earendil-works/pi/issues/7560)).
- Bounded OAuth token refreshes so stalled requests release the credential-store lock ([#7508](https://github.com/earendil-works/pi/issues/7508)).
- Fixed tool argument validation to preserve values that already match an `anyOf`/`oneOf` union arm before attempting coercion, avoiding nullable unions converting `null` to another primitive value ([#7328](https://github.com/earendil-works/pi/issues/7328)).
- Fixed cancellation of model catalog refreshes so callers stop waiting even when a custom provider ignores its abort signal ([#7027](https://github.com/earendil-works/pi/issues/7027)).
+6 -3
View File
@@ -1862,10 +1862,13 @@ async function loadModelsDevData(): Promise<Model<any>[]> {
// Claude 4.x and 5.x models route to Anthropic Messages API
const isCopilotClaude = /^claude-(haiku|sonnet|opus)-[45]([.\-]|$)/.test(modelId);
// gpt-5, oswe, and MAI-Code models are only served through the
// Copilot /responses endpoint.
// Grok 4.5, gpt-5, oswe, and MAI-Code models are only served through
// the Copilot /responses endpoint.
const needsResponsesApi =
modelId.startsWith("gpt-5") || modelId.startsWith("oswe") || modelId.startsWith("mai-");
modelId === "grok-4.5" ||
modelId.startsWith("gpt-5") ||
modelId.startsWith("oswe") ||
modelId.startsWith("mai-");
const api: Api = isCopilotClaude
? "anthropic-messages"
+7 -1
View File
@@ -1,4 +1,5 @@
import { expectTypeOf, it } from "vitest";
import { expect, expectTypeOf, it } from "vitest";
import { GITHUB_COPILOT_MODELS } from "../src/providers/github-copilot.models.ts";
import { XAI_MODELS } from "../src/providers/xai.models.ts";
it("derives model API, ID, and provider literals from grouped model data", () => {
@@ -7,3 +8,8 @@ it("derives model API, ID, and provider literals from grouped model data", () =>
expectTypeOf(XAI_MODELS["grok-4.5"].provider).toEqualTypeOf<"xai">();
expectTypeOf(XAI_MODELS["grok-4.3"].api).toEqualTypeOf<"openai-completions">();
});
it("routes GitHub Copilot Grok 4.5 through the Responses API", () => {
expectTypeOf(GITHUB_COPILOT_MODELS["grok-4.5"].api).toEqualTypeOf<"openai-responses">();
expect(GITHUB_COPILOT_MODELS["grok-4.5"].api).toBe("openai-responses");
});
+1
View File
@@ -84,6 +84,7 @@
### Fixed
- Fixed inherited GitHub Copilot Grok 4.5 requests to use the supported Responses API ([#7560](https://github.com/earendil-works/pi/issues/7560)).
- Fixed fullscreen shutdown leaking terminal capability-query replies into the parent shell prompt.
- Fixed bare exact `--model` IDs shared by multiple providers choosing the first catalog entry instead of the sole authenticated provider or a clear ambiguity error ([#7327](https://github.com/earendil-works/pi/issues/7327)).
- Fixed standalone x64 binaries requiring Haswell-era AVX2/BMI2 instructions by compiling release executables against Bun's baseline runtime ([#7149](https://github.com/earendil-works/pi/issues/7149)).