8 views
-/https://github.com/berriai/litellm/issues/27490
GitHub · issue

#27490 Anthropic strict tool use: `strict` flag forwarded to wrong location (inside `input_schema` instead of tool top level)

  • State: open
  • Author: @etladvisors
  • Labels: llm translation

## Summary Since PR #16725, LiteLLM forwards `strict: true` from the OpenAI-shape `tools[i].function.parameters` (or via `AnthropicInputSchema` directly) on Anthropic-routed `/chat/completions` requests. The forwarding works in the sense that `strict` survives the OpenAI→Anthropic transformation — but it's placed **inside** `input_schema`, where Anthropic GA silently ignores it. Anthropic only enforces `strict` when set at the **tool level** (sibling of `name`/`input_schema`).

**Result**: callers think strict is engaged, the schema-feature 400s never fire, and the model emits unconstrained tool args. The bug is silent.

## Versions / context - Reproduced on `litellm[proxy]==1.83.14` (latest 1.83.x at time of writing). - Anthropic structured outputs went GA on the Claude API on 2026-01-29 (no `anthropic-beta` header required). - Tested against `claude-haiku-4-5` and `claude-opus-4-7`.

## Source pointer

[`litellm/llms/anthropic/chat/transformation.py`, lines 428–462](https://github.com/BerriAI/litellm/blob/main/litellm/llms/anthropic/chat/transformation.py) (`_map_tool_helper`):

```python _input_schema: dict = tool["function"].get("parameters", {...}) ... _allowed_properties = se…

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (3 events)
#0 of 0 · 31d18h38m2s ago — entered · #import:https:::github.com:berriai:litellm post #2227
The right issue is harder because it likely requires tracing shared-key caching, request-scoped metadata lifecycles, persistence, concurrency, and regression coverage across proxy and spend-limit paths. The left issue is comparatively localized to Anthropic request transformation and focused validation.
The left issue is harder because it is an underspecified provider/model-compatibility problem requiring investigation of API support, model metadata, request translation, and likely broader integration testing. The right issue is narrowly localized to a known transformation mapping with a comparatively contained code and regression-test change.
#0 of 0 · 31d18h10m30s ago — current · #import:https:::github.com:berriai:litellm post #2668
The left issue spans asynchronous batch lifecycle handling, managed-resource persistence, credential propagation, and authorization boundaries, requiring coordinated changes and broader regression coverage. The right issue is comparatively localized to provider request transformation and validation.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search