Metadata-Version: 2.4
Name: alephantai
Version: 0.1.0
Summary: Python SDK for Alephant Gateway sessions, analytics, and framework integrations.
Author: Alephant AI
License: MIT
License-File: LICENSE
Keywords: alephant,cost,gateway,langchain,llamaindex,llm
Requires-Python: >=3.10
Requires-Dist: httpx<1,>=0.24
Requires-Dist: openai<3,>=1.0
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: ruff>=0.6; extra == 'dev'
Requires-Dist: twine>=5; extra == 'dev'
Provides-Extra: langchain
Requires-Dist: langchain-core<2,>=1; extra == 'langchain'
Requires-Dist: langchain-openai<2,>=1.2; extra == 'langchain'
Provides-Extra: llamaindex
Requires-Dist: llama-index-core<0.15,>=0.14; extra == 'llamaindex'
Requires-Dist: llama-index-embeddings-openai<0.7,>=0.6; extra == 'llamaindex'
Requires-Dist: llama-index-llms-openai<0.8,>=0.7; extra == 'llamaindex'
Description-Content-Type: text/markdown

# Alephant Python SDK

Alephant Python SDK helps you call Alephant Gateway, generate session headers,
query Virtual Key usage and cost analytics, and integrate with LangChain or
LlamaIndex.

## Installation

```bash
pip install alephantai
pip install "alephantai[langchain]"
pip install "alephantai[llamaindex]"
```

## Gateway Chat

The production Gateway host is `https://ai.alephant.io/v1`.

```python
from alephantai import AlephantGatewayContext, create_openai_client

ctx = AlephantGatewayContext(session_name="quickstart")
client = create_openai_client(api_key="vk-...", context=ctx)

response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Hello"}],
)
```

By default, the SDK only generates `Alephant-Session-Id`. Behavior headers such
as cache controls, forced routing, and prompt template identifiers must be
configured explicitly. Version 1 guarantees session-level request and cost
attribution only; full journey steps, policy events, and grading require a
future step/span contract.

## Analytics

The Cockpit analytics client defaults to `https://alephant.io/api/v1`.

```python
from alephantai import AlephantAnalyticsClient

analytics = AlephantAnalyticsClient(api_key="vk-...")
print(analytics.usage_summary(period="7d"))
```

`usage_summary().total_tokens.input` maps to prompt/input tokens and
`total_tokens.output` maps to completion/output tokens. `daily_costs()` reports
daily total tokens. `cost_by_model()` is scoped to the VK's bound agent/member
when present, and `recent_requests()` returns live rows; `degraded=true` means
the backend, Collector, or requested scope could not provide live data.
