Summary
When using Claude Code through LiteLLM with Agnes 2.0 Flash, normal conversations work correctly. However, operations involving file reading (and occasionally subagent tasks) consistently fail when the request is sent to the /v1/responses endpoint.
The upstream API returns:
400 Bad Request
Invalid JSON data:
Failed to deserialize the JSON body into the target type:
input: data did not match any variant of untagged enum ResponseInput
Forcing LiteLLM to use the Chat Completions API (use_chat_completions_api: true) completely resolves the issue.
Steps to reproduce
- Configure LiteLLM with Agnes 2.0 Flash:
- /Configure Claude Code to connect through LiteLLM.
- Use Claude Code to perform a file reading task (for example, "Read config.yaml" or open a local project file).
- Observe that LiteLLM forwards the request to:
POST /v1/responses
- The Agnes API returns the deserialization error shown above.
As a comparison, using the same Claude Code and LiteLLM configuration with GPT-5.6 works correctly.
Adding the following LiteLLM option also resolves the issue:
use_chat_completions_api: true
which causes LiteLLM to send requests to /v1/chat/completions instead.
Expected behavior
The /v1/responses endpoint should accept requests generated by Claude Code through LiteLLM and successfully process file reading and other complex context operations without returning a deserialization error.
Actual behavior
The API responds with:
400 Bad Request
Invalid JSON data:
Failed to deserialize the JSON body into the target type:
input: data did not match any variant of untagged enum ResponseInput
The issue occurs consistently during file reading operations.
Using Chat Completions instead of Responses avoids the problem.
Environment
Claude Code: v2.1.218
LiteLLM Proxy
Model: agnes-2.0-flash
API Base: https://apihub.agnes-ai.com/v1
Endpoint used when the issue occurs: /v1/responses
Summary
When using Claude Code through LiteLLM with Agnes 2.0 Flash, normal conversations work correctly. However, operations involving file reading (and occasionally subagent tasks) consistently fail when the request is sent to the /v1/responses endpoint.
The upstream API returns:
400 Bad Request
Invalid JSON data:
Failed to deserialize the JSON body into the target type:
input: data did not match any variant of untagged enum ResponseInput
Forcing LiteLLM to use the Chat Completions API (use_chat_completions_api: true) completely resolves the issue.
Steps to reproduce
litellm_params:
model: openai/agnes-2.0-flash
api_key: ...
api_base: https://apihub.agnes-ai.com/v1
POST /v1/responses
As a comparison, using the same Claude Code and LiteLLM configuration with GPT-5.6 works correctly.
Adding the following LiteLLM option also resolves the issue:
use_chat_completions_api: true
which causes LiteLLM to send requests to /v1/chat/completions instead.
Expected behavior
The /v1/responses endpoint should accept requests generated by Claude Code through LiteLLM and successfully process file reading and other complex context operations without returning a deserialization error.
Actual behavior
The API responds with:
400 Bad Request
Invalid JSON data:
Failed to deserialize the JSON body into the target type:
input: data did not match any variant of untagged enum ResponseInput
The issue occurs consistently during file reading operations.
Using Chat Completions instead of Responses avoids the problem.
Environment
Claude Code: v2.1.218
LiteLLM Proxy
Model: agnes-2.0-flash
API Base: https://apihub.agnes-ai.com/v1
Endpoint used when the issue occurs: /v1/responses