Repository navigation
Description
Preflight Checklist
- I have searched existing issues and this hasn't been reported yet
- This is a single bug report (please file separate reports for different bugs)
- I am using the latest version of Claude Code
What's Wrong?
When using ANTHROPIC_BASE_URL to route requests through a proxy, Claude Code fails to parse stop_reason from the message_delta streaming event. The stop_reason is logged as null even when the proxy correctly sends "stop_reason": "tool_use" in the message_delta event.
This causes tool_use responses to not trigger tool execution, making the conversation stop abruptly after the model attempts to use a tool.
Proxy chain:
Claude Code → LiteLLM (Anthropic format) → kiro-openai-gateway (OpenAI format) → Kiro
Evidence:
- Direct Anthropic API logs show
stop_reason: "tool_use"correctly (43 occurrences in one session) - Proxy logs show
stop_reason: nullwithtool_usecontent present - The proxy output is identical to Anthropic's documented streaming format
Proxy streaming output (correct format):
event: message_delta
data: {"type": "message_delta", "delta": {"stop_reason": "tool_use", "stop_sequence": null}, "usage": {"input_tokens": 608, "output_tokens": 46}}
What Should Happen?
Claude Code should parse stop_reason from the message_delta event when using ANTHROPIC_BASE_URL, the same way it does when connecting directly to the Anthropic API.
Steps to Reproduce
- Set up a proxy that returns Anthropic-compatible streaming format (e.g., LiteLLM with
anthropic_messagesendpoint) - Run Claude Code with
ANTHROPIC_BASE_URL=http://localhost:4000 claude - Send a prompt that triggers tool use (e.g., "search the web for X" with WebSearch tool enabled)
- Observe that the conversation stops after the model returns tool_use, without executing the tool
- Check conversation logs in
~/.claude/projects/-stop_reasonwill benull
Claude Model
Opus (via Kiro)
Is this a regression?
I don't know
Last Working Version
No response
Claude Code Version
2.1.1 (Claude Code)
Platform
Anthropic API (via ANTHROPIC_BASE_URL proxy)
Operating System
macOS
Terminal/Shell
zsh
Additional Information
Tested with:
- LiteLLM proxy converting OpenAI format to Anthropic format
- Custom mock server sending exact Anthropic streaming format
- Both produce the same result:
stop_reason: nullin logs
The proxy streaming format was verified to match Anthropic's documented format exactly, including stop_sequence: null in the delta.
Activity
bhaskoro-muthohar commentedon Jan 8, 2026
Additional observations from continued usage:
The issue affects multiple tool types and scenarios:
Case 1: Single tool_use (Grep)
grepcommand instead, which workedCase 2: Parallel tool_use (multiple Edit calls)
Pattern:
tool_usevsend_turnbhaskoro-muthohar commentedon Jan 10, 2026
Case 3: Parallel tool_use (multiple Bash calls)
ps aux,top,vm_stat,sysctlThis further confirms the issue is not tool-specific and affects parallel tool_use scenarios more frequently.
github-actions commentedon Feb 10, 2026
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
github-actions commentedon Feb 24, 2026
Closing for now — inactive for too long. Please open a new issue if this is still relevant.
github-actions commentedon Mar 4, 2026
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.