7 views
-/https://github.com/berriai/litellm/issues/27518
GitHub · issue

#27518 [Bug]: Proxy-level callbacks (`async_pre_call_hook`) are bypassed on Anthropic endpoint (`/v1/messages`)

  • State: open
  • Author: @Masterisk-F
  • Labels: bug, proxy, llm translation

### Check for existing issues

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

### What happened?

When making requests to the LiteLLM Proxy via the Anthropic-compatible endpoint (`/v1/messages`), custom proxy-level hooks defined in `CustomLogger` (such as `async_pre_call_hook`) are completely bypassed and not executed.

However, when hitting the standard OpenAI-compatible endpoints (e.g. `/chat/completions` or `/v1/chat/completions`), these exact same hooks are successfully triggered.

Any request routed through the proxy, regardless of whether it originates from the OpenAI `/v1/chat/completions` endpoint or the Anthropic `/v1/messages` endpoint, should reliably trigger the configured `async_pre_call_hook` callbacks.

### Steps to Reproduce

1. Create a custom callback script `custom_hook.py` that inherits from `CustomLogger` and implements `async_pre_call_hook`: ```python import sys from litellm.integrations.custom_logger import CustomLogger

class MyCustomHook(CustomLogger): async def async_pre_call_hook(self, user_api_key_dict, cache, data, call_type, **kwargs): print(">>> async_pre_call_hook EXECUTED!", file=sys.stderr) …

GitHub resolver

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

Refresh page
vote history (4 events)
#0 of 0 · 31d19h10m17s ago — entered · #import:https:::github.com:berriai:litellm post #1708
The left issue spans request-routing and callback lifecycle behavior across multiple API paths, requiring cross-cutting code changes and regression coverage. The right issue is more narrowly contained to database migration configuration and Prisma runtime compatibility, despite possible deployment-specific investigation.
The left issue spans several MCP subsystems and likely requires coordinated changes across registry resolution, persisted configuration fallback, UI/API behavior, and diagnostics, with broader compatibility testing. The right issue appears more localized to one request-routing or callback-invocation path, with a narrower fix and focused regression coverage.
The right-hand issue is harder because it requires tracing and reconciling multiple proxy request paths, callback lifecycle behavior, async execution, and regression coverage across endpoint types. The left-hand issue is comparatively localized to request normalization for one provider path with focused transformation tests.
#0 of 0 · 31d18h52m1s ago — current · #import:https:::github.com:berriai:litellm post #2005
#27518 requires tracing and repairing callback lifecycle integration across the Anthropic proxy route, while preserving behavior across endpoint variants and adding broader regression coverage. #34926 is comparatively localized to request-parameter filtering/forwarding in one native API path.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search