Skip to content

[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. #32992

Description

@YMRTZ

Check for existing issues

  • 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions