Metadata-Version: 2.4
Name: llama-index-callbacks-nebeso
Version: 0.1.0
Summary: LlamaIndex callback handler for NeBeso AI cost tracking
Project-URL: Homepage, https://nebeso.com
Project-URL: Documentation, https://nebeso.com/docs/llamaindex
Project-URL: Repository, https://github.com/badBoyDevop/nebeso-platform
Project-URL: Bug Tracker, https://github.com/badBoyDevop/nebeso-platform/issues
Author-email: NeBeso <hello@nebeso.com>
License: Apache-2.0
Keywords: ai,anthropic,callbacks,cost,llama-index,llamaindex,llm,observability,openai,tokens,tracking
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.9
Requires-Dist: llama-index-core>=0.10
Requires-Dist: nebeso>=0.1.0
Description-Content-Type: text/markdown

# llama-index-callbacks-nebeso

LlamaIndex callback handler for [NeBeso](https://nebeso.com) — 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

```bash
pip install llama-index-callbacks-nebeso
```

## Quick start

```python
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

```python
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

- [Full docs](https://nebeso.com/docs/llamaindex)
- [LangChain integration](https://nebeso.com/docs/langchain)
- [NeBeso dashboard](https://nebeso.com)
- [GitHub](https://github.com/badBoyDevop/nebeso-platform)
