diff --git a/packages/ai/CHANGELOG.md b/packages/ai/CHANGELOG.md index 090736729..705358967 100644 --- a/packages/ai/CHANGELOG.md +++ b/packages/ai/CHANGELOG.md @@ -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)). diff --git a/packages/ai/scripts/generate-models.ts b/packages/ai/scripts/generate-models.ts index 5f2ea81f7..b881c6c3e 100644 --- a/packages/ai/scripts/generate-models.ts +++ b/packages/ai/scripts/generate-models.ts @@ -1862,10 +1862,13 @@ async function loadModelsDevData(): Promise[]> { // 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" diff --git a/packages/ai/test/model-catalog-types.test.ts b/packages/ai/test/model-catalog-types.test.ts index b3c47658e..0facda3db 100644 --- a/packages/ai/test/model-catalog-types.test.ts +++ b/packages/ai/test/model-catalog-types.test.ts @@ -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"); +}); diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index b20d8ae21..6382adf7b 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -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)).