Skip to content

tool_calls array missing from OpenAI chat completions response #35

@advenimus

Description

@advenimus

Bug Description

When using the /claude/v1/chat/completions endpoint with tools, the response correctly sets finish_reason: "tool_calls" but the actual tool_calls array is missing from the message object.

Steps to Reproduce

  1. Send a request to /claude/v1/chat/completions with tools defined
  2. Ask Claude to use the tool (e.g., "Get my gmail messages")
  3. Observe the response

Expected Behavior

{
  "choices": [{
    "finish_reason": "tool_calls",
    "message": {
      "role": "assistant",
      "content": null,
      "tool_calls": [{
        "id": "toolu_xxx",
        "type": "function",
        "function": {
          "name": "get_gmail",
          "arguments": "{}"
        }
      }]
    }
  }]
}

Actual Behavior

{
  "choices": [{
    "finish_reason": "tool_calls",
    "message": {
      "role": "assistant",
      "content": ""
    }
  }]
}

The tool_calls array is completely missing.

Root Cause

In ccproxy/llms/formatters/anthropic_to_openai/responses.py, the convert__anthropic_message_to_openai_chat__response function handles text and thinking blocks but does not handle tool_use blocks from Anthropic's response.

Impact

This breaks integration with OpenAI-compatible clients that rely on the tool_calls array, including:

  • n8n AI Agent workflows - The agent sees tools are available but tool calls are never executed
  • Any other automation platform using OpenAI-compatible function calling

Environment

  • CCProxy-API version: v0.2.0
  • Endpoint: /claude/v1/chat/completions

Fix

I've submitted a PR with the fix: #34

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions