litellm/tests/test_litellm/llms/openai
devin-ai-integration[bot] 1edc4ba580
fix(logging): pass provider response headers to callbacks on every endpoint (#42824)
* fix(logging): pass provider response headers to callbacks on every endpoint

Custom callbacks only received kwargs["response_headers"] for chat
completions. Responses, image generation and edit, speech, and
transcription calls either never recorded the provider's headers or
recorded them in one place and not the other.

Every handler now records the provider's httpx headers on the response's
hidden params as "headers" (raw) and "additional_headers" (processed,
with LiteLLM's own entries winning on a clash), and the logging object
derives model_call_details["response_headers"] from those hidden params
before cost calculation on the non-stream and both streaming success
paths, keeping a handler-set value authoritative. Binary speech responses
expose their hidden params to the standard logging payload, and the sync
OpenAI transcription request always fetches the raw response.

* test(images): point the legacy image and speech fakes at the raw response surface

Image generation now goes through the SDK's raw response so the provider headers can be read, and the speech binary response now carries hidden params. The unit fakes in the image generation, xinference, proxy provider, image edit, Vertex speech, and otel suites still pinned the old call surface and the old "no hidden params" assertion, so they read an uncalled mock or a fake response without headers.

* test(images): drop the rewritten mock comments and the generated edit PNGs

* test(images): move the llm-span test's image fake to the raw response surface

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-09-24 13:01:12 -07:00
..
realtime test(realtime): drop legacy InvalidStatusCode tests and pin websockets imports (#42624) 2026-09-22 17:42:12 -07:00
responses Merge pull request #41561 from chopratejas/fix-responses-guardrail-custom-tool-output-writeback 2026-09-21 15:40:34 -07:00
transcriptions fix(logging): pass provider response headers to callbacks on every endpoint (#42824) 2026-09-24 13:01:12 -07:00
test_cost_calculation.py test: drop remaining tests that pin cost-map vendor facts 2026-09-15 21:34:00 +00:00
test_data_residency.py feat(openai): apply regional-processing cost uplift for EU/US data residency (#28626) 2026-05-25 20:36:14 -07:00
test_gpt5_transformation.py chore(cost-map): remove models past their deprecation date (#42435) 2026-09-22 21:19:26 +00:00
test_is_model_gpt_5_model.py fix(azure_ai): bridge Foundry function-tool requests only where the chat surface rejects them 2026-09-19 18:19:02 -07:00
test_o_series_transformation.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_openai.py fix(logging): pass provider response headers to callbacks on every endpoint (#42824) 2026-09-24 13:01:12 -07:00
test_openai_common_utils.py fix(http): address review on outbound HTTP/2 2026-09-15 18:25:26 +00:00
test_openai_empty_response.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
test_openai_file_content_streaming.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_openai_image_edit_transformation.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_openai_workload_identity.py fix(openai): mint workload identity tokens for PrivateLink and regional api.openai.com hosts 2026-09-03 14:38:47 -07:00
test_use_chat_completions_api_no_leak.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00