Conversation
…dary max_tokens=0 and n=0 are meaningless — zero tokens to generate, zero choices to return — and most upstream providers reject them with a confusing 400 that leaks through to the client. Pydantic now fails closed with a clear validation error before the request reaches the routing layer. Also clamps temperature to [-2.0, 2.0] to match the OpenAI / Anthropic accepted range and reject accidental outliers (e.g. a slider widget that lets the user drag past 2.0). Tests cover the zero, negative, positive, and None cases for each guarded field.
There was a problem hiding this comment.
🐳 OrcaCode Review
✅ No findings — nothing to flag in this PR. Great work!
OrcaCode Review — Route Smarter. Ship Safer. Spend Less.
Engine-reported: 358 calls · 22.2M tokens · 98% cached
❤️ Share · Install OrcaCode Review
Free on GitHub — the review runs on your own OrcaRouter key. If it helped, a shout-out goes a long way.
Share: X · Reddit · LinkedIn
Follow: X · Discord · LinkedIn · OrcaRouter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Orca-Code-Review — push 1
✅ no blocking findings
What
max_tokens=0andn=0currently pass validation and reach the upstream provider, which rejects them with a confusing 400. Same fortemperaturevalues outside the [-2.0, 2.0] range.Pydantic now fails closed with a clear validation error before the request reaches the routing layer.
Changes
max_tokens:Field(ge=1)— zero or negative token budgets are meaninglessn:Field(ge=1)— zero choices to return is not a valid requesttemperature:Field(ge=-2.0, le=2.0)— matches the accepted rangeAll fields remain optional (
Nonestill means use the provider default).Tests
12 new tests covering zero, negative, positive, and
Nonecases for each guarded field.