When attempting to use the Tool Use (Function Calling) feature via anthropic-proxy (with the backend model anthropic/claude-3.5-haiku routed through OpenRouter, where the error message indicates the actual provider is Amazon Bedrock), the API returns a 400 error. The error message states that the number of toolResult blocks in the request's messages exceeds the number of toolUse blocks from the model's previous turn.
Error Message:
⎿ Invalid tool parameters
⎿ API Error: 400 {"error":"{\"error\":{\"message\":\"Provider returned
error\",\"code\":400,\"metadata\":{\"raw\":\"{\\\"message\\\":\\\"The number of
toolResult blocks at messages.4.content exceeds the number of toolUse blocks of
previous turn.\\\"}\",\"provider_name\":\"Amazon
Bedrock\"}},\"user_id\":\"user_2m17fqmm2tL3UEVCpAlvfXvsXx5\"}"}