-
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?
fix(openrouter): correct reserved tokens for google/gemini-2.5-pro-preview #3896
Conversation
…eview to 66k and add test coverage
@@ -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/") |
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 for 66000
) to improve maintainability.
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 comment
The 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 comment
The 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 comment
The 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
@mrubens its an issue with flash thinking also , i will test some more models tomorrow to see if its just gemini issue or entire openrouter model list |
Possible fix for #3817
Important
Sets
maxTokens
to 66000 forgoogle/gemini-2.5-pro-preview
ingetOpenRouterModels
and adds a test for it.maxTokens
to 66000 forgoogle/gemini-2.5-pro-preview
ingetOpenRouterModels
inopenrouter.ts
.openrouter.test.ts
to verifymaxTokens
is set to 66000 forgoogle/gemini-2.5-pro-preview
.This description was created by
for cbf0fe3. You can customize this summary. It will automatically update as commits are pushed.