Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/api/providers/fetchers/__tests__/vercel-ai-gateway.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,33 @@ describe("Vercel AI Gateway Fetchers", () => {
},
}

it("applies Google's authoritative limits and thinking levels to google/gemini-4-argon", () => {
// The gateway catalog reports context_window and max_tokens of 1,000,000;
// Google's documented limits are a shared 1,048,576-token window and a
// 65,536-token single-request output cap.
const result = parseVercelAiGatewayModel({
id: "google/gemini-4-argon",
model: {
...baseModel,
id: "google/gemini-4-argon",
name: "Gemini 4 Argon",
owned_by: "google",
context_window: 1_000_000,
max_tokens: 1_000_000,
tags: ["reasoning", "vision", "tool-use", "implicit-caching"],
},
})

expect(result).toMatchObject({
contextWindow: 1_048_576,
maxTokens: 65_536,
supportsImages: true,
supportsReasoningEffort: ["low", "medium", "high"],
reasoningEffort: "medium",
supportsTemperature: false,
})
})

it.each(["openai/gpt-6-astra", "openai/gpt-6-astra-fast"])(
"applies required Astra request constraints to %s",
(id) => {
Expand Down
13 changes: 13 additions & 0 deletions src/api/providers/fetchers/vercel-ai-gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,19 @@ export const parseVercelAiGatewayModel = ({ id, model }: { id: string; model: Ve
description: model.description ?? model.name,
}

if (id === "google/gemini-4-argon") {
// The gateway catalog reports context_window and max_tokens of 1,000,000,
// but Google's authoritative limits are a shared 1,048,576-token window
// (input + thinking + output) and a 65,536-token single-request output cap
// (longer decodes use continuation tokens).
modelInfo.contextWindow = 1_048_576
modelInfo.maxTokens = 65_536
modelInfo.supportsReasoningEffort = ["low", "medium", "high"]
modelInfo.reasoningEffort = "medium"
// The Google backend ignores temperature/top_p/top_k on this model.
modelInfo.supportsTemperature = false
}

if (id === "openai/gpt-6-astra" || id === "openai/gpt-6-astra-fast") {
modelInfo.supportsReasoningEffort = ["low", "medium", "high", "xhigh", "max"]
modelInfo.requiredReasoningEffort = true
Expand Down
Loading