Agno's OpenRouter, Perplexity and Requesty models no longer cut long answers off at 1024 tokens when you leave max_tokens unset. The default is now None, so Agno leaves the field out of the request and the model's own output limit applies, so answers can run longer and cost more. Before, each class sent max_tokens: 1024 by default. To keep that cap, set it yourself, since a limit you set still goes out unchanged:
from agno.models.openrouter import OpenRouter
model = OpenRouter(id="anthropic/claude-sonnet-4", max_tokens=1024)We captured the request body with an httpx MockTransport standing in for each provider's API:
Before: OpenRouter() request max_tokens: 1024
Now: OpenRouter() request max_tokens: <absent>Perplexity and Requesty gave the same result, and OpenRouter(max_tokens=4096) sent 4096 on both releases.
OpenRouterResponses also dropped the cost that OpenRouter's Responses API returns in usage, so metrics.cost stayed None on every run. Agno now copies it into the message metrics, and the run metrics carry it too. A mocked Responses payload with "cost": 3.6e-06 showed:
Before: run metrics cost: None
Now: run metrics cost: 3.6e-06See the cookbook, and learn more about OpenRouter and metrics in the documentation.
Frequently asked questions
OpenRouter, Perplexity and Requesty each declared max_tokens: int = 1024, so a request with no limit of your own still asked for at most 1024 generated tokens. The default is now None, which drops the field from the request body.
Yes. OpenRouter(max_tokens=4096) sends max_tokens: 4096 on both releases. Only the unset case changed.
On the assistant message as message.metrics.cost and on the run as run_output.metrics.cost. With the mocked usage payload, the run printed run metrics cost: 3.6e-06 | message metrics cost: [3.6e-06], where earlier releases printed None for both.
The fix lives in the OpenAIResponses metrics code that OpenRouterResponses inherits, so any Responses model whose usage payload carries a cost field reports it. A payload without one leaves cost as None.




