litellm/tests/unit/llms/openrouter/chat
Hoya 8ef451a187
fix: raise on failed OpenRouter non-streaming completions (#50880)
* fix: propagate OpenRouter errors and preserve failure usage

* test: cover OpenRouter errors and failure accounting

* fix: bill a recovered OpenRouter failure on the success log and parse the body once

A retry or fallback that recovers from an OpenRouter finish_reason error now
carries the failed attempt's usage and cost into the success log, so the key
pays for both calls. The response body is parsed once and handed to the error
check, and the failure-log test no longer waits on a 10-second deadline

* fix: carry a failed attempt's usage before each SDK retry

* test: cover OpenRouter's documented failure body without usage

Pins the recovered-failure test's start time to a fixed date and adds a regression test for the documented non-streaming error body, which carries no usage

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-14 03:02:00 +00:00
..
__init__.py test: add package initializers to migrated unit test directories 2026-09-20 11:52:07 +00:00
test_openrouter_chat_transformation.py fix: raise on failed OpenRouter non-streaming completions (#50880) 2026-11-14 03:02:00 +00:00