Skip to content

Commit 397e51c

Browse files
zoomote[bot]taltas
andauthored
feat(providers): clamp Gemini 4 Argon limits on Vercel AI Gateway to Google's values (#2073)
Co-authored-by: @taltas <6816042+taltas@users.noreply.github.com>
1 parent e6edad1 commit 397e51c

2 files changed

Lines changed: 40 additions & 0 deletions

File tree

‎src/api/providers/fetchers/__tests__/vercel-ai-gateway.spec.ts‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,33 @@ describe("Vercel AI Gateway Fetchers", () => {
196196
},
197197
}
198198

199+
it("applies Google's authoritative limits and thinking levels to google/gemini-4-argon", () => {
200+
// The gateway catalog reports context_window and max_tokens of 1,000,000;
201+
// Google's documented limits are a shared 1,048,576-token window and a
202+
// 65,536-token single-request output cap.
203+
const result = parseVercelAiGatewayModel({
204+
id: "google/gemini-4-argon",
205+
model: {
206+
...baseModel,
207+
id: "google/gemini-4-argon",
208+
name: "Gemini 4 Argon",
209+
owned_by: "google",
210+
context_window: 1_000_000,
211+
max_tokens: 1_000_000,
212+
tags: ["reasoning", "vision", "tool-use", "implicit-caching"],
213+
},
214+
})
215+
216+
expect(result).toMatchObject({
217+
contextWindow: 1_048_576,
218+
maxTokens: 65_536,
219+
supportsImages: true,
220+
supportsReasoningEffort: ["low", "medium", "high"],
221+
reasoningEffort: "medium",
222+
supportsTemperature: false,
223+
})
224+
})
225+
199226
it.each(["openai/gpt-6-astra", "openai/gpt-6-astra-fast"])(
200227
"applies required Astra request constraints to %s",
201228
(id) => {

‎src/api/providers/fetchers/vercel-ai-gateway.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,19 @@ export const parseVercelAiGatewayModel = ({ id, model }: { id: string; model: Ve
125125
description: model.description ?? model.name,
126126
}
127127

128+
if (id === "google/gemini-4-argon") {
129+
// The gateway catalog reports context_window and max_tokens of 1,000,000,
130+
// but Google's authoritative limits are a shared 1,048,576-token window
131+
// (input + thinking + output) and a 65,536-token single-request output cap
132+
// (longer decodes use continuation tokens).
133+
modelInfo.contextWindow = 1_048_576
134+
modelInfo.maxTokens = 65_536
135+
modelInfo.supportsReasoningEffort = ["low", "medium", "high"]
136+
modelInfo.reasoningEffort = "medium"
137+
// The Google backend ignores temperature/top_p/top_k on this model.
138+
modelInfo.supportsTemperature = false
139+
}
140+
128141
if (id === "openai/gpt-6-astra" || id === "openai/gpt-6-astra-fast") {
129142
modelInfo.supportsReasoningEffort = ["low", "medium", "high", "xhigh", "max"]
130143
modelInfo.requiredReasoningEffort = true

0 commit comments

Comments
 (0)