litellm/tests/unit/proxy/proxy_server
rhea-tk 65c8ce23f5
fix(proxy): send finish_reason null on every in-progress streamed chat chunk (#53876)
* fix(proxy): send finish_reason null on every streamed chat chunk

The proxy's chat completions stream left the finish_reason key out of every
in-progress chunk, while OpenAI and Mistral send "finish_reason": null until the
last one. The mistralai SDK marks the field required-nullable, so its clients
failed on the first chunk. Both the fast and the slow chunk serializer now write
the key on every choice, and every other None field stays omitted as before

* fix(proxy): send NaN and Infinity in streamed chat chunks as null

Chunks with a null finish_reason go through to_json, which wrote bare NaN and -Infinity where model_dump_json wrote null, so strict JSON parsers rejected a chunk carrying a -inf logprob. Both the to_json path and its json.dumps fallback now write null.

* test(integration): expect finish_reason null on in-progress chat chunks

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-26 08:08:44 +00:00
..
.coverage_baseline
__init__.py
_coverage_check.py
_pin_check.py
conftest.py fix(router): make the constructor stub work for mypy and guard it in CI (#50354) 2026-11-22 21:25:00 +00:00
test_background_health.py feat(proxy): skip blocked deployments in background health checks (#52761) 2026-11-24 07:53:23 -08:00
test_exception_handlers.py feat(proxy): let operators omit x-litellm-* response headers (#52949) 2026-11-19 15:27:34 -08:00
test_harness_smoke.py
test_lifecycle.py fix(proxy/auth): return 401 for a non-master key when no database is configured (#52349) 2026-11-17 14:19:09 -08:00
test_openapi_customization.py feat(proxy)!: make Scalar the default API reference and remove ReDoc (#53063) 2026-11-23 10:49:54 -08:00
test_proxy_config.py fix(openrouter): report the context window and output cap from OpenRouter's catalog (#54046) 2026-11-24 04:37:30 -08:00
test_routes_anthropic_beta.py
test_routes_assistants.py fix(proxy): keep the mapped status on assistants and threads route errors (#44994) 2026-10-09 16:55:15 -07:00
test_routes_audio.py fix(proxy): return text, srt and vtt transcriptions as plain text (#53255) 2026-11-23 10:17:30 -08:00
test_routes_chat_completions.py fix(azure): drop the traceback from stream-cut errors sent to clients and alerts (#51760) 2026-11-14 08:00:58 +00:00
test_routes_completions.py fix(azure): drop the traceback from stream-cut errors sent to clients and alerts (#51760) 2026-11-14 08:00:58 +00:00
test_routes_config.py feat(proxy): require customer headers by gateway, team, or key (#53045) 2026-11-21 20:20:26 +00:00
test_routes_embeddings.py refactor(proxy): expose public names for private proxy helpers (#45170) 2026-10-07 18:59:27 -07:00
test_routes_invitation.py refactor(proxy): expose public names for private proxy helpers (#45170) 2026-10-07 18:59:27 -07:00
test_routes_login_sso.py feat(proxy): delete the old username and password login page (#53205) 2026-11-20 22:41:08 +00:00
test_routes_misc.py refactor(router): move router callers onto the entry points and invert the proxy imports (#48847) 2026-10-29 17:26:33 +00:00
test_routes_model_cost_map.py refactor(model-cost): move the cost map inputs, fetch and register_model overlay into Rust (#50501) 2026-11-10 02:37:35 +00:00
test_routes_model_info.py fix(openrouter): report the context window and output cap from OpenRouter's catalog (#54046) 2026-11-24 04:37:30 -08:00
test_routes_model_metrics.py
test_routes_models.py refactor(proxy)!: remove the TypeSafe pass-through route in favor of the unified decision endpoints (#52165) 2026-11-24 16:05:44 -08:00
test_routes_moderations.py fix(proxy): log each endpoint's own call type on failed audio, moderation, image, and rerank spend rows (#49684) 2026-11-02 23:57:11 +00:00
test_routes_onboarding.py
test_routes_queue.py fix(proxy): run baggage tag mappings and budget checks on /queue/chat/completions (#51753) 2026-11-14 08:54:54 -05:00
test_routes_threads.py fix(proxy): keep the mapped status on assistants and threads route errors (#44994) 2026-10-09 16:55:15 -07:00
test_routes_utils.py refactor(rust_bridge): route every Rust-to-Python call through host modules (#50822) 2026-11-11 01:57:54 +00:00
test_spend_counters.py fix(proxy): write a cold spend counter's cached spend once (#52806) 2026-11-24 13:00:34 -08:00
test_spend_counters_ledger.py test(proxy): give the spend counter ledger test's auth cache double the team fields read (#53958) 2026-11-23 23:37:56 +00:00
test_streaming_helpers.py fix(proxy): send finish_reason null on every in-progress streamed chat chunk (#53876) 2026-11-26 08:08:44 +00:00
test_team_model_name_translation.py fix(proxy)!: price expanded wildcard /model/info rows as the model their calls route to (#49128) 2026-11-08 19:08:22 +00:00