Error2 reports
Fix OpenrouterException
in LiteLLM
✅ Solution
OpenrouterException often arises from OpenRouter's strict validation of `image_generation` API usage, specifically when `imageUsage` fields like `pixels` or `token_charges` are expected to be integers but receive fractional values. To resolve this, ensure any values submitted for `imageUsage` in your code are explicitly converted to integers before sending the request to OpenRouter. Round or truncate the fractional values as appropriate for your application's needs.
Related Issues
Real GitHub issues where developers encountered this error:
Timeline
First reported:8h ago
Last reported:8h ago