Python SDK
bash
pip install amlexiaPackage: amlexia (v1.0.2+) · Feature parity
Quick start
python
from amlexia import AmlexiaClient
client = AmlexiaClient.from_env()
client.track(
endpoint="GET /health",
method="GET",
status_code=200,
latency_ms=12,
environment="production",
)
client.shutdown()Client options
| Option | Default | Description |
|---|---|---|
sdk_key | required | Project SDK key |
ingest_url | https://ingest.amlexia.com | Ingest base URL |
flush_interval_seconds | 5.0 | Background flush |
max_batch_size | 50 | Events per request |
max_retries | 5 | Upload retries |
sample_rate | 1.0 | Sampling 0–1 |
diagnostic | False | Stderr diagnostics |
Methods
track(...)— queue eventflush()— send nowshutdown()— flush and stop timer
Auto cost
Send model_name, provider, and token fields; ingest applies the same estimation as Node. Or pass cost_usd explicitly.
python
from amlexia.cost import estimate_event_cost_usdHTTP wrapper
python
from amlexia.http_wrap import wrap_requests_sessionLLM helpers
python
from amlexia.openai_helper import track_openai_completion
from amlexia.anthropic_helper import track_anthropic_messageCLI
bash
amlexia healthFramework extras
bash
pip install "amlexia[fastapi]"
pip install "amlexia[flask]"| Module | Framework |
|---|---|
amlexia.fastapi_integration | FastAPI |
amlexia.flask_integration | Flask |
amlexia.django_integration | Django |
amlexia.tracing | Manual traces |
