Welcome to the developer documentation for the Nivara Python SDK.
- Audience: Python developers who want to record LLM/AI usage metrics.
- Package:
nivara - Default API base:
https://api.getnivara.com
Quick links
- Getting Started: getting-started.md
- Installation: installation.md
- Configuration: configuration.md
- API Reference: api.md
- Concepts: concepts.md
- Troubleshooting: troubleshooting.md
- FAQ: faq.md
- Examples (code): examples/
If you’re just here to install and send a metric:
python3 -m pip install nivara
export NIVARA_API_KEY=ak_live_..."""Synchronous record.
export NIVARA_API_KEY=ak_live_...
"""
from datetime import datetime, timezone
import nivara as nv
def main() -> int:
res = nv.record(
metric="llm.request",
ts=datetime.now(timezone.utc),
input_tokens=5,
output_tokens=1,
)
print(res)
return 0
if __name__ == "__main__":
raise SystemExit(main())