Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:BerriAI Litellm Callback Controls

From Leeroopedia
Revision as of 12:08, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/BerriAI_Litellm_Callback_Controls.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Attribute Value
Sources enterprise/litellm_enterprise/enterprise_callbacks/callback_controls.py
Domains Callbacks, Dynamic Controls, Enterprise
Last Updated 2026-02-15 16:00 GMT

Overview

EnterpriseCallbackControls provides enterprise functionality to dynamically disable specific logging callbacks on a per-request basis via HTTP headers or request body parameters.

Description

This class contains static methods that allow the LiteLLM proxy to dynamically skip specific callbacks during request processing. Callbacks can be disabled through two mechanisms:

  • HTTP Header -- The x-litellm-disable-callbacks header accepts a comma-separated list of callback names to disable for that request.
  • Request Body -- The litellm_disabled_callbacks field in standard_callback_dynamic_params provides a programmatic way to disable callbacks.

Key Methods:

  • is_callback_disabled_dynamically -- Checks if a given callback (string name, CustomLogger instance, or callable) is in the disabled list. Handles both string callbacks and class-based callbacks by resolving class types through the CustomLoggerRegistry.
  • get_disabled_callbacks -- Extracts the disabled callback list from either headers or request body.
  • _should_allow_dynamic_callback_disabling -- Verifies that the feature is enabled (litellm.allow_dynamic_callback_disabling) and the user has an enterprise/premium license.

This is an enterprise-only feature that requires both litellm.allow_dynamic_callback_disabling = True and a premium license.

Usage

This class is used internally by the LiteLLM logging pipeline to check whether each callback should be skipped before invoking it for a given request.

Code Reference

Source Location

enterprise/litellm_enterprise/enterprise_callbacks/callback_controls.py

Signature

class EnterpriseCallbackControls:
    @staticmethod
    def is_callback_disabled_dynamically(
        callback: litellm.CALLBACK_TYPES,
        litellm_params: dict,
        standard_callback_dynamic_params: StandardCallbackDynamicParams,
    ) -> bool: ...

    @staticmethod
    def get_disabled_callbacks(
        litellm_params: dict,
        standard_callback_dynamic_params: StandardCallbackDynamicParams,
    ) -> Optional[List[str]]: ...

    @staticmethod
    def _should_allow_dynamic_callback_disabling() -> bool: ...

Import

from litellm_enterprise.enterprise_callbacks.callback_controls import EnterpriseCallbackControls

I/O Contract

Inputs

Parameter Type Description
callback litellm.CALLBACK_TYPES The callback to check (string, CustomLogger instance, or callable).
litellm_params dict LiteLLM parameters containing proxy server request headers.
standard_callback_dynamic_params StandardCallbackDynamicParams Dynamic parameters including litellm_disabled_callbacks.

Outputs

Output Type Description
Disabled status bool True if the callback should be skipped for this request, False otherwise.
Disabled list Optional[List[str]] Lowercase list of disabled callback names, or None.

Usage Examples

# Disable specific callbacks via HTTP header
curl -X POST http://localhost:4000/v1/chat/completions \
  -H "Authorization: Bearer sk-..." \
  -H "x-litellm-disable-callbacks: langfuse,s3" \
  -d '{"model": "gpt-4", "messages": [{"role": "user", "content": "Hello"}]}'
# Disable via request body
import litellm

response = litellm.completion(
    model="gpt-4",
    messages=[{"role": "user", "content": "Hello"}],
    litellm_disabled_callbacks=["langfuse", "s3"],
)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment