diff --git a/src/api/providers/fetchers/__tests__/openrouter.spec.ts b/src/api/providers/fetchers/__tests__/openrouter.spec.ts index e1f8d64acd..5b620395c0 100644 --- a/src/api/providers/fetchers/__tests__/openrouter.spec.ts +++ b/src/api/providers/fetchers/__tests__/openrouter.spec.ts @@ -276,6 +276,29 @@ describe("OpenRouter API", () => { expect(result.contextWindow).toBe(128000) }) + it("sets horizon-beta model to 32k max tokens", () => { + const mockModel = { + name: "Horizon Beta", + description: "Test model", + context_length: 128000, + max_completion_tokens: 128000, + pricing: { + prompt: "0.000003", + completion: "0.000015", + }, + } + + const result = parseOpenRouterModel({ + id: "openrouter/horizon-beta", + model: mockModel, + modality: "text", + maxTokens: 128000, + }) + + expect(result.maxTokens).toBe(32768) + expect(result.contextWindow).toBe(128000) + }) + it("does not override max tokens for other models", () => { const mockModel = { name: "Other Model", diff --git a/src/api/providers/fetchers/openrouter.ts b/src/api/providers/fetchers/openrouter.ts index 34e2ec595f..bb3b97e7aa 100644 --- a/src/api/providers/fetchers/openrouter.ts +++ b/src/api/providers/fetchers/openrouter.ts @@ -237,5 +237,10 @@ export const parseOpenRouterModel = ({ modelInfo.maxTokens = 32768 } + // Set horizon-beta model to 32k max tokens + if (id === "openrouter/horizon-beta") { + modelInfo.maxTokens = 32768 + } + return modelInfo }