litellm/tests/unit/completion_extras
edvinsq e2546ef7f8
fix(responses)!: reject previous_response_id on chat completions and Messages (#53038)
* fix(responses)!: reject previous_response_id on chat completions and Messages

Chat completions and Messages requests that LiteLLM serves through the
Responses API accepted `previous_response_id` and forwarded it. The
caller still resends the system prompt on every turn, so LiteLLM read
the stored chain before each follow-up to avoid billing it twice, and
on Bedrock, which has no route to read a stored chain, the follow-up
was billed for the prompt twice and never cached

Both endpoints now answer 400 for the field and name `/v1/responses` as
the place to continue a stored response. The Messages token count
answers the same 400. The stored chain lookup is removed.
`/v1/responses` is unchanged

* fix(responses): keep the chat bridge rejection endpoint-neutral for bridged Messages calls

* fix(responses): refuse previous_response_id on every translated Messages token count

The Messages token count only refused the field when OpenAI served the count, so a Bedrock GPT model still answered 200 with a local estimate. The check now runs in the proxy count path for every Messages route the gateway translates

An empty string is refused too. It used to reach the provider, which answered its own 400

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-19 22:21:46 -08:00
..
litellm_responses_transformation fix(responses)!: reject previous_response_id on chat completions and Messages (#53038) 2026-11-19 22:21:46 -08:00
__init__.py test: add __init__.py to migrated tests/unit packages 2026-09-20 11:53:49 +00:00
test_litellm_responses_transformation_transformation.py test: migrate wave 1 phase 1 legacy tests to tests/unit 2026-09-20 09:17:57 +00:00
test_responses_bridge_provider_propagation.py fix(responses): honor request cache controls on chat completions bridged to the Responses API (#44676) 2026-10-05 17:52:44 -07:00