Skip to main content

Installation

Usage

How It Works

MeshAILlamaHandler implements LlamaIndex’s callback interface, listening to LLM events. On each LLM completion, it:
  1. Extracts the model name from the LLM event payload
  2. Extracts input and output token counts from the event callback data
  3. Infers the provider from the model name
  4. Sends the usage event to MeshAI (buffered, non-blocking)
Works with any LlamaIndex-compatible LLM: OpenAI, Anthropic, Gemini, HuggingFace, and others.

Alternative: Proxy (Zero-Code)

If your LlamaIndex pipeline uses OpenAI or Anthropic, you can route through the proxy instead: