-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix(openrouter): correct reserved tokens for google/gemini-2.5-pro-preview #3896
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,7 +106,11 @@ export async function getOpenRouterModels(options?: ApiHandlerOptions): Promise< | |
id, | ||
model, | ||
modality: architecture?.modality, | ||
maxTokens: id.startsWith("anthropic/") ? top_provider?.max_completion_tokens : 0, | ||
maxTokens: id.startsWith("anthropic/") | ||
? top_provider?.max_completion_tokens | ||
: id === "google/gemini-2.5-pro-preview" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does openrouter just not include this number? Is that a bug? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let me check it thoroughly There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. after doing some debugging ive hit a wall, the model file we fetch from openrouter does have it as 66k but without this i see 209k and hardcoding is showing 66k correctly. am still trying to figure it out why its happening with gemini or its an issue for all models in openrouter |
||
? 66000 | ||
: 0, | ||
supportedParameters: supported_parameters, | ||
}) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The nested ternary for
maxTokens
reduces clarity. Consider extracting the condition (and using a named constant for66000
) to improve maintainability.