9 views
-/https://github.com/berriai/litellm/issues/34624
GitHub ยท issue

#34624 [Bug]: guardrail_information not persisted for anthropic_messages route (/v1/messages) on successful requests โ€” UI Logs tab blank

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

### What happened?

On a self-hosted proxy (`v1.87.0`), a **custom `pre_call` guardrail** (a `CustomGuardrail` subclass that masks credentials/PII in the request and writes the masked body back into `data`) runs and masks correctly on **both** endpoints:

- OpenAI `/v1/chat/completions` (`call_type: acompletion`) - native Anthropic `/v1/messages` (`call_type: anthropic_messages`)

However, the **guardrail bookkeeping is only persisted for the OpenAI route**. On the native `anthropic_messages` route, `guardrail_information` is `NULL` on **successful** requests, so the Admin UI โ†’ session โ†’ **Logs** tab shows no guardrail information for those requests, even though the guardrail demonstrably executed (the input was masked upstream).

This makes guardrail execution effectively **invisible to auditing** for the native `/v1/messages` route.

### Evidence

Comparing two `LiteLLM_SpendLogs` rows for the same guardrail config, one per route (both rows carry the **same set of metadata keys** โ€” the difference is in the value):

| field | `/v1/messages` (`anthropic_messages`) | `/v1/chat/completions` (`acompletion`) | |---|---|---| | `metadata.guardrail_information` | **`NULL`** | populated (aโ€ฆ

GitHub resolver

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

Refresh page
vote history (1 events)
#0 of 0 ยท 31d17h57m23s ago โ€” entered ยท #import:https:::github.com:berriai:litellm post #3235
The right issue is harder because it affects authorization semantics, permission resolution across related entities, precedence and merging rules, and security-sensitive regression coverage. The left issue is more localized to ensuring consistent metadata persistence across an existing request path, with narrower implementation and testing scope.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search