litellm/tests/unit/proxy/anthropic_endpoints
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
..
__init__.py test(proxy): move utils, agent_endpoints and endpoint tests into tests/unit/proxy (#44006) 2026-10-01 11:06:42 -07:00
test_answered_status.py fix(anthropic): answer an upstream Anthropic 529 as 529 overloaded_error on /v1/messages (#46063) 2026-11-03 17:37:09 -08:00
test_claude_code_marketplace.py fix(tests): repair the unit tests failing on main's full run (#52769) 2026-11-18 22:41:59 -08:00
test_claude_code_skill_access.py feat(auth): read projects, tags, access groups and object permissions through rust repositories (#52178) 2026-11-18 22:32:06 +00:00
test_endpoints.py fix(responses)!: reject previous_response_id on chat completions and Messages (#53038) 2026-11-19 22:21:46 -08:00
test_gateway_endpoints.py feat(auth): decide key and JWT authentication in a Rust core (#51374) 2026-11-17 14:07:47 +09:00
test_skill_upload_archive.py test(skills): drop the archive rejection test whose zip-byte ids differ across xdist workers (#50118) 2026-11-04 22:12:55 +00:00
test_skills_endpoints.py test(proxy): move utils, agent_endpoints and endpoint tests into tests/unit/proxy (#44006) 2026-10-01 11:06:42 -07:00
test_streaming_model_restamp.py fix(streaming): keep merged think tags balanced and split SSE lines only on CR/LF (#48755) 2026-10-28 17:00:29 -07:00