Skip to content

fix(responses): map input_audio blocks in the chat-to-Responses bridge - #45224

Merged
mateo-berri merged 7 commits into
mainfrom
litellm_fix_responses_bridge_input_audio
Oct 8, 2026
Merged

mateo-berri merged 7 commits into
mainfrom
litellm_fix_responses_bridge_input_audio

Conversation

@mateo-berri

@mateo-berri mateo-berri commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • The chat-to-Responses bridge had no case for input_audio parts
  • The part went out as an input_text holding the dict's Python repr
  • The base64 was billed as text: 113,728 input tokens for a 64-character question
  • The model never got the audio and still answered 200

How it solves it:

  • Map input_audio to the Responses API input_audio part, payload as sent
  • Under drop_params, drop the part when the model has no audio input
  • Without drop_params, forward it and let the provider answer
  • Carry the part's prompt_cache_breakpoint the way the text and image parts do
  • When the part is dropped, move its prompt_cache_breakpoint to the preceding kept part, so an injected system marker that landed on a trailing audio block still reaches the wire

Intentional product change: a Responses deployment without drop_params now returns the provider's own 400 ("Audio input is not available." on OpenAI today) instead of a 200 that read the base64 as text and billed it, so a developer learns the clip was never heard instead of paying for it

User Flow

Before: a developer who sends a voice clip through chat completions to a Responses API deployment gets a 200 with a made-up answer and a huge token bill

  1. They send POST https://litellm-domain/v1/chat/completions to an openai/responses/gpt-5.4-mini deployment with one user message holding a text part and an input_audio part (base64 wav)
  2. 200 comes back, the answer is "unknown" because the model never heard the clip, and usage.prompt_tokens reads 113,728 for a 64-character question
  3. They set drop_params: true on the deployment and try again, and the same 200 with the same 113,728 tokens comes back

After: the same request carries the audio as audio, so the provider answers honestly and the base64 is never billed as text

  1. They send POST https://litellm-domain/v1/chat/completions to an openai/responses/gpt-5.4-mini deployment with one user message holding a text part and an input_audio part (base64 wav)
  2. 400 comes back carrying the provider's own error, "Audio input is not available." (OpenAI's Responses API takes no audio input today), and nothing is billed
  3. They set drop_params: true on the deployment and try again, the clip is dropped, 200 comes back answering only the text, and usage.prompt_tokens is in the dozens

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*, make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review (Greptile reviews automatically once the PR is opened; only comment @greptileai to re-request a review after pushing changes)

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

Screenshots / Proof of Fix

Last updated: 642ada1. QA and /live-pr-risk ran on fb9fdca, the last commit with a product diff

Run of 2026-10-07 against api.openai.com (real calls, real money; the big ones are gpt-5.4-mini and gpt-6.1-sol calls billed 113,728 and 113,740 input tokens). Each leg boots its own proxy from its own worktree and venv with --num_workers 2, Postgres-backed, on a random free port, with a small forwarding recorder in front of api.openai.com (WIRE_BASE below) so the "what reached OpenAI" line under each case can show the provider's side; the verdict rests on the HTTP responses alone. The before leg ran at the merge base b970e41 in a detached checkout, the after leg at fb9fdca, the last commit with a product diff (the tests commit on top changes no product code). The one end-user surface the bridge serves is /v1/chat/completions on a Responses-only deployment: /v1/responses never enters the bridge, and the Anthropic Messages shape has no audio block

Config (config.yaml), OPENAI_API_KEY from the environment, WIRE_BASE the recorder forwarding to https://api.openai.com/v1:

model_list:
  - model_name: text-resp
    litellm_params:
      model: openai/responses/gpt-5.4-mini
      api_key: os.environ/OPENAI_API_KEY
      api_base: os.environ/WIRE_BASE
  - model_name: text-resp-drop
    litellm_params:
      model: openai/responses/gpt-5.4-mini
      api_key: os.environ/OPENAI_API_KEY
      api_base: os.environ/WIRE_BASE
      drop_params: true
  - model_name: audio-resp-drop
    litellm_params:
      model: openai/responses/gpt-audio-mini
      api_key: os.environ/OPENAI_API_KEY
      api_base: os.environ/WIRE_BASE
      drop_params: true
  - model_name: marker-resp-drop
    litellm_params:
      model: openai/responses/gpt-6.1-sol
      api_key: os.environ/OPENAI_API_KEY
      api_base: os.environ/WIRE_BASE
      drop_params: true
  - model_name: audio-chat
    litellm_params:
      model: openai/gpt-audio-mini
      api_key: os.environ/OPENAI_API_KEY
      api_base: os.environ/WIRE_BASE
general_settings:
  master_key: sk-slp703-local

Request body, the same for every case except model. speech.wav is a 127,244-byte TTS clip saying "The secret word is pineapple." (169,660 base64 chars):

{"model": "<model>", "messages": [{"role": "user", "content": [
  {"type": "text", "text": "What is the secret word spoken in the audio? Answer in one word."},
  {"type": "input_audio", "input_audio": {"data": "<base64 of speech.wav>", "format": "wav"}}]}]}

The call, with req_<model>.json holding that body:

curl -sS -o resp.json -w "HTTP %{http_code}\n" http://127.0.0.1:$PORT/v1/chat/completions \
  -H "Authorization: Bearer sk-slp703-local" -H "Content-Type: application/json" \
  --data-binary @req_<model>.json
python3 -c 'import json; j=json.load(open("resp.json")); print(json.dumps(j.get("error") or {"content": j["choices"][0]["message"]["content"], "usage": j["usage"]}, indent=1))'

Before (b970e41)

Case A: text + input_audio to openai/responses/gpt-5.4-mini, no drop_params

  1. curl ... http://127.0.0.1:20685/v1/chat/completions --data-binary @req_text-resp.json
  2. Output: the model never heard the clip and the base64 was billed as text
HTTP 200
{
 "content": "unknown",
 "usage": {
  "completion_tokens": 11,
  "prompt_tokens": 113728,
  "total_tokens": 113739,
  "completion_tokens_details": {
   "reasoning_tokens": 0
  },
  "prompt_tokens_details": {
   "cached_tokens": 0,
   "cache_write_tokens": 0,
   "cache_creation_tokens": 0
  }
 }
}
  1. What reached OpenAI (recorder): POST /v1/responses, model gpt-5.4-mini, content parts input_text (64 chars) and input_text (169,729 chars starting {'type': 'input_audio', 'input_audio': {'data': 'UklGRv), upstream 200 with input_tokens: 113728

Case B: same deployment with drop_params: true

  1. curl ... http://127.0.0.1:20685/v1/chat/completions --data-binary @req_text-resp-drop.json
  2. Output: the same 113,728 tokens as case A, drop_params changes nothing
HTTP 200
{
 "content": "hello",
 "usage": {
  "completion_tokens": 11,
  "prompt_tokens": 113728,
  "total_tokens": 113739,
  "completion_tokens_details": {
   "reasoning_tokens": 0
  },
  "prompt_tokens_details": {
   "cached_tokens": 113408,
   "cache_write_tokens": 0,
   "cache_creation_tokens": 0
  }
 }
}
  1. What reached OpenAI (recorder): the same two input_text parts as case A, upstream 200, input_tokens: 113728 (113,408 of them a prompt-cache hit on case A's prefix)

Case C: control, openai/gpt-audio-mini on plain chat completions

  1. curl ... http://127.0.0.1:20685/v1/chat/completions --data-binary @req_audio-chat.json
  2. Output: the chat path delivers the clip and bills it as 26 audio tokens
HTTP 200
{
 "content": "I'm sorry, but I can't identify speakers or words from audio. Let me know if there's anything else I can help with.",
 "usage": {
  "completion_tokens": 25,
  "prompt_tokens": 52,
  "total_tokens": 77,
  "completion_tokens_details": {
   "accepted_prediction_tokens": 0,
   "audio_tokens": 0,
   "reasoning_tokens": 0,
   "rejected_prediction_tokens": 0,
   "text_tokens": 25
  },
  "prompt_tokens_details": {
   "audio_tokens": 26,
   "cached_tokens": 0,
   "text_tokens": 26,
   "image_tokens": 0
  }
 }
}
  1. What reached OpenAI (recorder): POST /v1/chat/completions, model gpt-audio-mini, the text and input_audio parts intact, upstream 200 with audio_tokens: 26

After (fb9fdca)

Case A: text + input_audio to openai/responses/gpt-5.4-mini, no drop_params

  1. curl ... http://127.0.0.1:34502/v1/chat/completions --data-binary @req_text-resp.json
  2. Output: the clip is forwarded as audio and OpenAI's own answer comes back, nothing billed
HTTP 400
{
 "message": "litellm.BadRequestError: OpenAIException - {\n  \"error\": {\n    \"message\": \"Audio input is not available.\",\n    \"type\": \"invalid_request_error\",\n    \"param\": \"input\",\n    \"code\": null\n  }\n}\n\nLiteLLM: model group 'text-resp' failed with the error above. No fallback was attempted.",
 "type": "invalid_request_error",
 "param": null,
 "code": "400"
}
  1. What reached OpenAI: POST /v1/responses, model gpt-5.4-mini, parts input_text(64), input_audio(wav, 169,660 chars), upstream 400

Case B: same deployment with drop_params: true

  1. curl ... http://127.0.0.1:34502/v1/chat/completions --data-binary @req_text-resp-drop.json
  2. Output: the clip is dropped and only the text is answered and billed
HTTP 200
{
 "content": "I can\u2019t access the audio here.",
 "usage": {
  "completion_tokens": 18,
  "prompt_tokens": 21,
  "total_tokens": 39,
  "completion_tokens_details": {
   "reasoning_tokens": 0
  },
  "prompt_tokens_details": {
   "cached_tokens": 0,
   "cache_write_tokens": 0,
   "cache_creation_tokens": 0
  }
 }
}
  1. What reached OpenAI: POST /v1/responses, model gpt-5.4-mini, parts input_text(64), upstream 200

Case C: control, openai/gpt-audio-mini on plain chat completions

  1. curl ... http://127.0.0.1:34502/v1/chat/completions --data-binary @req_audio-chat.json
  2. Output: unchanged from before
HTTP 200
{
 "content": "I'm sorry, but I can't listen to audio. Could you provide more details or describe the context? Then I might be able to help.",
 "usage": {
  "completion_tokens": 28,
  "prompt_tokens": 52,
  "total_tokens": 80,
  "completion_tokens_details": {
   "accepted_prediction_tokens": 0,
   "audio_tokens": 0,
   "reasoning_tokens": 0,
   "rejected_prediction_tokens": 0,
   "text_tokens": 28
  },
  "prompt_tokens_details": {
   "audio_tokens": 26,
   "cached_tokens": 0,
   "text_tokens": 26,
   "image_tokens": 0
  }
 }
}
  1. What reached OpenAI: POST /v1/chat/completions, model gpt-audio-mini, chat parts intact, upstream 200

Supporting cells, before b970e41 vs after fb9fdca

Same proxies and recorders as the three cases above. Request shapes are the Case A body with the named change

Cell Request Before After Wire after
D audio-resp-drop, same 400 not supported with the Responses API 400 Audio input is not available. input_text(64), input_audio(wav, 169,660 chars)
E text-resp-drop, stream: true 200, 113,728 tokens (113,408 cached, 3 chunks) 200, 21 tokens (13 chunks) input_text(64)
F text-resp, stream: true 200, 113,728 tokens (113,408 cached, 3 chunks) 400 Audio input is not available. input_text(64), input_audio(wav, 169,660 chars)
G text-resp, input_audio: "not-a-dict" 200, 38 tokens 400 Audio input is not available. input_text(64), input_audio('not-a-dict')
H text-resp-drop, input_audio: 7 200, 35 tokens 200, 21 tokens input_text(64)
I text-resp-drop, audio inside a tool message 200, 113,795 tokens 200, 88 tokens input_text(73), input_text(64)
J marker-resp-drop, audio part carrying prompt_cache_breakpoint 200, 113,740 tokens (113,737 cached) 200, 21 tokens input_text(64) +marker
K text-resp-drop, audio-only user message 200, 113,713 tokens 200, 2 tokens user content []

Audit, deterministic cells on the scripted upstream

Three rigs on one box (real Postgres, Redis, a two-worker proxy each, a scripted OpenAI Responses upstream, no .env): base b970e41, head fb9fdca, controls fb9fdca. Run through tests/integration/run.py providers <node ids>, seeds 4106601 / 0, one worker like CircleCI. The head selection ran twice with the same collected and passed set. Files: tests/integration/providers/test_responses_bridge_input_audio_wire.py (audio), the chaos file's two new litellm_settings.drop_params cells (chaos), and the three audio cells of the sibling marker file (marker)

Lane Sha Cells Result
base b970e41 40 2 green, 38 red
head run 1 fb9fdca 40 40 green
head run 2 fb9fdca 40 40 green
controls fb9fdca 23 23 green
base rerun b970e41 2 2 red
head rerun 1 642ada1 2 2 green
head rerun 2 642ada1 2 2 green

The two base greens are the rows the fix leaves alone on purpose: the Anthropic SDK through /v1/messages (the adapter has no audio block, so the bridge never sees one) and native /v1/responses (no bridge). Every red on base asserts the stringified input_text repr where the head forwards or drops the part

Cell base head run 1 head run 2 Last ran at
audio test_audio_part_is_dropped_under_drop_params red green green fb9fdca
audio test_audio_part_is_forwarded_as_input_audio_without_drop_params red green green fb9fdca
audio test_openai_sdk_stream_shapes_the_audio_part_by_mode[on] red green green fb9fdca
audio test_openai_sdk_stream_shapes_the_audio_part_by_mode[off] red green green fb9fdca
audio test_async_openai_sdk_shapes_the_audio_part_by_mode[on] red green green fb9fdca
audio test_async_openai_sdk_shapes_the_audio_part_by_mode[off] red green green fb9fdca
audio test_audio_capable_model_keeps_the_audio_part_under_drop_params red green green fb9fdca
audio test_base_model_in_litellm_params_keeps_the_audio_part_under_drop_params red green green fb9fdca
audio test_base_model_in_model_info_keeps_the_audio_part_under_drop_params red green green fb9fdca
audio test_tool_output_audio_part_follows_the_mode[on] red green green fb9fdca
audio test_tool_output_audio_part_follows_the_mode[off] red green green fb9fdca
audio test_injected_system_marker_lands_on_a_trailing_audio_part_without_drop_params red green green fb9fdca
audio test_assistant_audio_part_follows_the_mode[on] red green green fb9fdca
audio test_assistant_audio_part_follows_the_mode[off] red green green fb9fdca
audio test_anthropic_sdk_request_carries_no_audio_part_into_the_bridge green green green fb9fdca
audio test_native_responses_audio_part_never_enters_the_bridge green green green fb9fdca
audio test_hostile_audio_value_is_forwarded_verbatim_without_drop_params[int] red green green fb9fdca
audio test_hostile_audio_value_is_forwarded_verbatim_without_drop_params[list] red green green fb9fdca
audio test_hostile_audio_value_is_forwarded_verbatim_without_drop_params[empty-string] red green green fb9fdca
audio test_hostile_audio_value_is_forwarded_verbatim_without_drop_params[5kb-string] red green green fb9fdca
audio test_hostile_audio_value_is_dropped_under_drop_params[int] red green green fb9fdca
audio test_hostile_audio_value_is_dropped_under_drop_params[list] red green green fb9fdca
audio test_hostile_audio_value_is_dropped_under_drop_params[empty-string] red green green fb9fdca
audio test_hostile_audio_value_is_dropped_under_drop_params[5kb-string] red green green fb9fdca
audio test_audio_part_without_a_payload_follows_the_mode[on] red green green fb9fdca
audio test_audio_part_without_a_payload_follows_the_mode[off] red green green fb9fdca
audio test_two_identical_audio_parts_follow_the_mode[on] red green green fb9fdca
audio test_two_identical_audio_parts_follow_the_mode[off] red green green fb9fdca
audio test_audio_only_message_is_forwarded_with_empty_content_under_drop_params red green green fb9fdca
audio test_leading_audio_marker_has_no_preceding_part_to_carry_to red green green fb9fdca
audio test_each_dropped_audio_marker_moves_to_its_own_preceding_text red green green fb9fdca
audio test_text_marker_wins_over_the_dropped_audio_marker red green green fb9fdca
audio test_null_drop_params_forwards_the_audio_part red green green fb9fdca
audio test_mixed_audio_burst_shapes_every_upstream_request_by_its_mode red green green 642ada1
audio test_dropped_upstream_connections_fail_only_their_own_calls red green green 642ada1
chaos test_global_drop_params_drops_the_audio_part_and_carries_its_marker[deployment-unset] red green green fb9fdca
chaos test_global_drop_params_drops_the_audio_part_and_carries_its_marker[deployment-false] red green green fb9fdca
marker test_input_audio_block_is_forwarded_with_its_marker_without_drop_params red green green fb9fdca
marker test_input_audio_block_is_dropped_under_drop_params_and_its_marker_moves_to_the_text red green green fb9fdca
marker test_injected_system_marker_survives_a_trailing_audio_block red green green fb9fdca

Controls, once on the head: test_openai_sdk_sends_a_valid_marker_through_the_bridge, test_valid_marker_is_carried_on_every_block_kind x8, test_tool_output_marker x4, test_injected_marker_on_a_string_system_message, test_anthropic_sdk_marker_on_user_text x4, test_native_responses_request_never_enters_the_bridge, chaos test_global_drop_params_drops_a_malformed_marker x2 and test_mixed_burst_carries_every_marker_once, and tests/integration/messages_endpoint/responses_bridge/test_anthropic_messages_openai_bridge_wire.py::test_midturn_system_correction_is_forwarded_to_openai_responses, all green

The tests-only commit 642ada1 made the dropped-connection cell retry-agnostic (every upstream attempt of a doomed call is checked for the dropped audio shape, instead of requiring one attempt per call), so the two cells it changed reran on both legs at that tip with the same seeds: base 0 of 2, head 2 of 2 in both runs. Every other row keeps its fb9fdca result, since the product code is unchanged

Live cells A to K above are the same audit's third-party rows: real api.openai.com through the recorder, one run per leg

Type

🐛 Bug Fix

Caveats (if any)

Medium

  • OpenAI's Responses API rejects audio input today, so forwarding the part answers 400 where main answered 200
    • "Audio input is not available." on gpt-5.4-mini, gpt-audio-1.5, and gpt-audio-mini, checked 2026-10-07
    • On openai/responses/gpt-audio-mini main's stringified request got model_not_found ("not supported with the Responses API"); the real audio part gets "Audio input is not available." (cell D)
    • The plain chat path (openai/gpt-audio-mini) is untouched and still bills the clip as 26 audio tokens
  • The drop_params gate is the supports_audio_input cost-map flag of the model or the deployment's base_model
    • An audio-capable model (gpt-audio-mini) keeps the part, so OpenAI still answers 400 for it today
    • A model missing from the cost map counts as no audio input and loses the part
      • Undated aliases such as gpt-4o-audio-preview have no entry today, so they lose it too
    • Alternative considered: always drop under drop_params; rejected since a capable provider would lose real audio

Low

  • A message whose only part was audio keeps an empty content list under drop_params (OpenAI accepts it)
  • The input_audio dict is forwarded as sent, format included; the provider validates it, not the bridge
  • fix(responses): keep cache breakpoints on blocks the bridge stringifies #40032 landed first and edits the same conversion function, so main is merged into this branch
    • The input_audio part's prompt_cache_breakpoint goes through its wire helper, so a malformed marker drops under drop_params like on text and image parts
    • Its "unknown block keeps the marker" test used input_audio as the unmappable example; it now uses a video_url part, since input_audio is mapped
    • When drop_params drops the audio part, its marker moves to the nearest preceding kept part that has none of its own (the cache_control_injection_points hook marks the last block of a message, audio included, so without this the injected system marker vanished while prompt_cache_options stayed explicit); a marker on a leading or audio-only part has no such neighbour and is dropped with the part
      • Alternative considered: let the marker drop with the part; rejected since the injected caching policy would silently fail on every audio-carrying request
    • Its CircleCI-only wire tests in tests/integration/providers/test_responses_bridge_prompt_cache_breakpoint_wire.py pinned the stringified audio shape, and CircleCI never runs on a PR, so they are updated here: video_url is the stringified kind, and two audio tests cover the forwarded part and the drop_params carry-over. Through the integration harness on this tip the file passes 67 of 67; the pre-update file on this tip fails 4 (test_injected_system_marker_survives_a_trailing_audio_block, test_malformed_marker_is_dropped_on_every_block_kind[input_audio], test_valid_marker_is_carried_on_every_block_kind[input_audio-on] and [input_audio-off]); the updated file on main's code fails 3 (the two audio tests and test_injected_system_marker_survives_a_trailing_audio_block)
  • Callers of convert_chat_completion_messages_to_responses_api outside the bridge now receive a structured input_audio part where they got an input_text repr: the Noma guardrail's Responses translation, the /v1/responses guardrail translation handler (whose reverse converter already maps input_audio back to input_audio), and the complexity router's native classifier payload (every caller enumerated across litellm/, enterprise/, and tests/; none in enterprise/). Traced, not driven live; special-casing audio there would bring the repr back
  • Not tested live: other Responses-path providers (bedrock_mantle use_openai_responses_path, Azure) now receive a real input_audio part and answer on their own

Live dependency check

Breaking:

  • A Responses deployment without drop_params now answers 400 to a chat request carrying input_audio where main answered 200 and billed the base64 as text: cells A, D, F (streaming, before any chunk) and G (input_audio a string). Intentional: it is the fix's stated behavior in the TLDR, the drop_params convention the requester asked for, and the convention a chat deployment already follows for an unsupported param

Backward incompatible:

  • convert_chat_completion_messages_to_responses_api emits {"type": "input_audio", "input_audio": {...}} for an input_audio part; its three callers outside the bridge (named under Low) receive that instead of an input_text repr
  • drop_params: true on a Responses deployment now removes a content part, where before it only removed request params
  • A dropped audio part's prompt_cache_breakpoint moves to the preceding kept part (cell J: before, the marker rode the stringified clip; after, it rides the 64-character text)

Regression risk, untested dependents:

  • Noma guardrail Responses translation: no Noma credentials on hand, so what the vendor receives for an audio part is traced only
  • Complexity router native classifier payload: reachable only with encrypted_task configured, traced only
  • Azure and bedrock_mantle Responses paths: the part is forwarded and the provider answers on its own, not driven

Dependency graph:

  • Bridge transform_request and the converter: verified live (cells A to K), unit tests, and the audit's 40 deterministic cells on both legs
  • Audio drop and marker carry under drop_params: verified live (cells B, E, H, I, J, K), unit tests, and the audit's drop, carry, global drop_params and burst cells
  • tests/integration wire tests: the audit round at fb9fdca (base red, head green twice, controls green), plus the two cells 642ada1 changed rerun there (base red, head green twice)
  • /v1/responses guardrail translation handler, two call sites: traced, untested live
  • Noma guardrail: traced, untested
  • Complexity router classifier: traced, untested
  • Admin UI and schema.d.ts: no field changed, no dependent

Not verified:

  • Noma guardrail (no credentials)
  • Complexity router classifier path (encrypted_task config)
  • Azure Responses deployments
  • bedrock_mantle use_openai_responses_path deployments

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

  • fb9fdca passes /audit (the two cells 642ada1 changed reran there)

  • fb9fdca passes /live-pr-risk

@codecov

codecov Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.30769% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...litellm_responses_transformation/transformation.py 92.30% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

@greptile-apps

greptile-apps Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Adds audio block handling to the chat-to-Responses bridge.

The PR appears safe to merge; the retry-related test failure is fixed

What we checked:

  • Every retry is checked: The test accounts for every recorded request and checks the content of every attempt, including retries

Summary

The PR maps chat input_audio parts to structured Responses parts. With drop_params, it removes unsupported audio and carries its cache marker to the preceding kept part

  • The latest commit fixes the dropped-connection test without changing product code. It allows failed calls to retry and checks every attempt
  • mateo-berri explicitly accepts provider errors replacing successful responses that treated audio as text
  • No new actionable issues were found

Reviews (7) · Last reviewed commit: "test(responses): check every upstream at..." · Reviewed by Greptile

@codspeed

codspeed Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing litellm_fix_responses_bridge_input_audio (642ada1) with main (03ba79d)

Open in CodSpeed

#40032 landed first and added the wire helper that drops a malformed
prompt_cache_breakpoint under drop_params, so the input_audio branch now
carries its marker through that helper like the text and image branches,
with a regression test for the malformed case. Main's unknown-block marker
test used input_audio as its unmappable example and now uses a video_url
part. The audio test fixture registers its fake models through monkeypatch
on the price map, so nothing leaks into the provider model sets, and the
new tests carry the Final and fixture annotations the repo asks for
@mateo-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

1 similar comment
@mateo-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

…preceding part

Dropping an input_audio part under drop_params lost the prompt_cache_breakpoint
riding on it, so an injected system marker landing on a trailing audio block left
prompt_cache_options explicit with no breakpoint on the wire. The marker now moves
to the nearest preceding kept part when that part has none.

Update the CircleCI-only Responses bridge wire tests that pinned input_audio to
its stringified input_text shape: video_url becomes the stringified kind so the
marker-on-stringified-block coverage survives, and dedicated audio tests assert
the forwarded part and the drop_params carry-over.
@mateo-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

@veria-ai

veria-ai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

PR overview

All previously flagged issues have been addressed. No open security concerns remain on this pull request.

Security review

No open security issues remain on this pull request.

Fixed/addressed: 1 · PR risk: 0/10

Replace the per-block slice that re-read the rest of the content list for
every retained part with a single reverse scan, and skip the copy for a
message that carries no audio part. Type the unit test helper's messages
as a sequence of mappings instead of bare lists.
@mateo-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

…the bridge

Cover the chat-to-Responses bridge's input_audio handling on the real proxy: the part is forwarded
as input_audio without drop_params and dropped under drop_params unless the model or its base_model
supports audio input, across httpx, the OpenAI SDK (sync stream and async), the Anthropic SDK, native
/v1/responses, tool and assistant messages, hostile input_audio values, duplicate parts, an audio-only
message, marker carry-over, a null drop_params, a global litellm_settings.drop_params, a mixed burst,
and a burst with dropped upstream connections
@mateo-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

The dropped-connection cell required exactly one upstream POST per call,
which tied it to the retry policy instead of the fix. It now groups the
recorded POSTs by marker, requires one attempt per answered call, and
checks that every attempt of a doomed call carries the dropped audio shape.
@mateo-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

@mateo-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 642ada1. Configure here.

@mateo-berri
mateo-berri enabled auto-merge (squash) October 8, 2026 04:10
@mateo-berri
mateo-berri merged commit 42d2158 into main Oct 8, 2026
106 of 107 checks passed
@mateo-berri
mateo-berri deleted the litellm_fix_responses_bridge_input_audio branch October 8, 2026 05:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants