19 views
-/https://github.com/berriai/litellm/issues/26334
GitHub · issue

#26334 [Bug]: Vertex Anthropic: response_format + thinking returns 400 on vertex_ai/claude-opus-4-7

  • State: open
  • Author: @gabrielafsantos
  • Labels: bug, llm translation, SDK

### Check for existing issues

- [x] I have searched the existing issues and checked that my issue is not a duplicate.

### What happened?

When using LiteLLM with Vertex Anthropic model `vertex_ai/claude-opus-4-7`, both parameters work independently, but fail when combined: - `thinking={"type":"adaptive"}` works alone - `response_format=<PydanticModel>` works alone - Both together fail with HTTP 400

## Repro matrix - thinking only: ✅ - response_format only: ✅ - thinking + response_format: ❌ (400)

## Additional context This appears to be in request translation for Vertex Anthropic, where `response_format` may map to forced `tool_choice`.

### Steps to Reproduce

from pydantic import BaseModel from litellm import completion

class DummyReport(BaseModel): msg: str

resp = completion( model="vertex_ai/claude-opus-4-7", messages=[{"role": "user", "content": "Say hello in Portuguese"}], vertex_credentials=<valid_vertex_credentials>, vertex_location="global", thinking={"type": "adaptive"}, response_format=DummyReport, ) print(resp)

### Relevant log output

```shell ## Error message `invalid_request_error: Thinking may not be enabled when tool_choice forces …

GitHub resolver

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

Refresh page
vote history (2 events)
#0 of 0 · 31d18h32m21s ago — entered · #import:https:::github.com:berriai:litellm post #2517
The left issue requires changes to provider-specific request translation, careful interaction handling between advanced features, and validation across model/API compatibility paths. The right issue is a localized configuration-value correction with straightforward verification.
#0 of 0 · 31d18h3m8s ago — current · #import:https:::github.com:berriai:litellm post #3020
The right issue is harder because it involves resolving an interaction between provider-specific request translation, structured-output handling, and thinking configuration, while preserving compatibility across multiple valid parameter combinations. The left issue is narrower: correcting response serialization and content type for one endpoint mode, with comparatively localized code and testing.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search