litellm/tests/unit/realtime_api
devin-ai-integration[bot] 3f01341f0a
fix(health)!: openai realtime health check reports healthy with a missing or invalid api key (#41233)
* fix(health): report openai realtime deployments with a missing or invalid api key as unhealthy

* fix(health): time out a silent openai realtime handshake and keep the first-event parsing in the openai handler

* fix(health): treat invalid_model as healthy, read the first event only on OpenAI hosts, map rate limits to 429

* fix(health): respect the global api_base, report a missing key as 401, keep invalid_model healthy only for known models

Drop the separate first-event timeout so model_info.health_check_timeout governs the wait, and keep the shared stream error table unchanged by raising AuthenticationError for invalid_api_key in the realtime check

* fix(health): keep invalid_model healthy unless the cost map lists the model outside realtime, and load realtime types lazily

* fix(health): read the cost map's listed endpoints, not its mode, since registering a realtime deployment overwrites the mode

* fix(health): read a realtime gateway's first event and keep Live deployments listing /v1/live healthy

Behind a custom api_base the OpenAI realtime health check now waits up to
3 seconds for the first event, so a gateway that passes on OpenAI's
invalid_api_key error reports unhealthy while a silent gateway stays
healthy. /v1/live counts as a realtime endpoint for the invalid_model rule.

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-10-29 00:40:02 -07:00
..
__init__.py test: add __init__.py to new tests/unit packages 2026-09-20 12:36:13 +00:00
test_main.py fix(health)!: openai realtime health check reports healthy with a missing or invalid api key (#41233) 2026-10-29 00:40:02 -07:00