9 views
-/https://github.com/berriai/litellm/issues/30469
GitHub Ā· issue

#30469 Proxy: Anthropic /v1/messages endpoint bypasses CustomLogger.async_pre_call_hook — data['model'] overrides ignored

  • State: open
  • Author: @KnkyMush
  • Labels: llm translation, claude code

## Summary

LiteLLM proxy's Anthropic-compatible `/v1/messages` endpoint does **not** trigger the `async_pre_call_hook` of registered `CustomLogger` callbacks. The same callback registered the same way **does** trigger correctly when calling `/v1/chat/completions` (OpenAI endpoint).

This makes it impossible to use callbacks to modify the `model` parameter for requests using the Anthropic protocol — for example, content-based model routing in a multi-model proxy setup.

## Reproduce

### 1. Minimal callback (`router_callback.py`)

```python import logging from litellm.integrations.custom_logger import CustomLogger

logger = logging.getLogger("repro")

class RouterCallback(CustomLogger): async def async_pre_call_hook(self, user_api_key_dict, cache, data, call_type): logger.warning("pre_call_hook fired: model=%s call_type=%s", data.get("model"), call_type) if data.get("model") == "qwen3.5-35b": data["model"] = "devstral-small-2" logger.warning("model swapped -> %s", data["model"]) return data

router_instance = RouterCallback() ```

### 2. LiteLLM config (`litellm_config.yaml`)

```yaml model_list: - model_n…

GitHub resolver

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

Refresh page
vote history (1 events)
#0 of 0 Ā· 31d17h59m51s ago — entered Ā· #import:https:::github.com:berriai:litellm post #2960
The left issue requires tracing and repairing request lifecycle integration across proxy and translation layers, preserving callback mutations, and adding regression coverage. The right issue is a narrowly scoped catalog-data correction with limited behavioral risk.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search