8 views
-/https://github.com/berriai/litellm/issues/32992
GitHub · issue

#32992 [Bug]: Routing deepseek-v4-pro through LiteLLM through Codex gives "An assistant message with 'tool_calls' must be followed by tool messages responding to each 'tool_call_id'" 400 error.

  • State: open
  • Author: @YMRTZ
  • Labels: bug, llm translation

### Check for existing issues

- [x] I have searched the existing issues and checked that my issue is not a duplicate.

### What happened?

I am attempting to configure Codex to use LiteLLM as a proxy to DeepSeek due to Codex no longer supporting the chat/completions API. However, when running LiteLLM as a proxy, I obtain the following error:

### Steps to Reproduce

1. Export DeepSeek API key 2. Run LiteLLM: ```litellm --model deepseek/deepseek-v4-pro``` 3. Run Codex and input a command

### Relevant log output

``` {"error":{"message":"litellm.BadRequestError: DeepseekException - {\"error\":{\"message\":\"An assistant message with 'tool_calls' must be followed by tool messages responding to each 'tool_call_id'. (insufficient tool messages following tool_calls message)\",\"type\": \"invalid_request_error\",\"param\":null,\"code\":\"invalid_request_error\"}}","type":null,"param":null,"code":"400"}} ```

### What part of LiteLLM is this about?

_No response_

### What LiteLLM version are you on ?

1.92.0

### Twitter / LinkedIn details

_No response_

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (2 events)
#0 of 0 · 31d17h59m39s ago — entered · #import:https:::github.com:berriai:litellm post #2872
The right issue is harder because it spans provider metadata discovery, refresh and registration lifecycles, persistence, override precedence, endpoint compatibility, and token-limit derivation. The left issue is more localized to request/response tool-call translation and validation, though reproducing provider-specific behavior still carries moderate risk.
#0 of 0 · 31d17h47m46s ago — current · #import:https:::github.com:berriai:litellm post #3081
The right issue is harder because it likely requires tracing provider-specific tool-call translation, conversation-state handling, and compatibility with an external client/API contract. The left issue is a localized Helm template change with a relatively contained validation surface.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search