LlamaIndex callback handler for NeBeso AI cost tracking
Project description
llama-index-callbacks-nebeso
LlamaIndex callback handler for NeBeso — open source AI cost tracking.
Track every LLM call in your LlamaIndex app: tokens, cost, latency, and custom tags — all visible in your NeBeso dashboard in real time.
Installation
pip install llama-index-callbacks-nebeso
Quick start
from llama_index_callbacks_nebeso import NeBesoHandler
from llama_index.core import Settings
from llama_index.core.callbacks import CallbackManager
handler = NeBesoHandler(
api_key="nb_ak_...", # or set NEBESO_API_KEY env var
tags={"feature": "rag-search", "env": "production"},
)
Settings.callback_manager = CallbackManager([handler])
# Now build your index and query normally — all LLM calls are tracked.
Usage with RAG pipelines
from llama_index_callbacks_nebeso import NeBesoHandler
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader, Settings
from llama_index.core.callbacks import CallbackManager
handler = NeBesoHandler(api_key="nb_ak_...")
Settings.callback_manager = CallbackManager([handler])
documents = SimpleDirectoryReader("data").load_data()
index = VectorStoreIndex.from_documents(documents)
query_engine = index.as_query_engine()
response = query_engine.query("What are the main topics?")
# Token usage and cost are now visible in your NeBeso dashboard.
Supported providers
Works with any LlamaIndex-supported LLM: OpenAI, Anthropic, Google Gemini, Mistral, Meta Llama, Cohere, AWS Bedrock, and more. Cost is calculated automatically from a built-in pricing table covering 60+ models.
Environment variables
| Variable | Description |
|---|---|
NEBESO_API_KEY |
Your NeBeso API key (alternative to api_key= kwarg) |
NEBESO_ENDPOINT |
Override API endpoint (default: https://api.nebeso.com) |
Links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llama_index_callbacks_nebeso-0.1.0-py3-none-any.whl.
File metadata
- Download URL: llama_index_callbacks_nebeso-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94a008b293dfa400b90be7a390d45f4261d03339ac155242e038eb31ed741fa8
|
|
| MD5 |
d5b33574002a14948208d04e097666a9
|
|
| BLAKE2b-256 |
3a8db252b66d7577658a2b4f1458853e81f5aa7bc7bebb748277ebc005b5f931
|