Python SDK
The official Alephant Analytics Python SDK provides access to the Alephant Analytics API from Python scripts or data science notebooks. It supports both synchronous and asynchronous execution.
Installation
Install the SDK via pip:
Initialization
You can initialize either a synchronous or asynchronous client depending on your architecture.
Synchronous Client
Asynchronous Client
Ideal for FastAPI, async web frameworks, or highly concurrent applications:
Example Usage
Smoke test
Use the public health endpoint to verify that the SDK can reach the Analytics dev service.
Live 24-Hour Panel Overview
Retrieve a rolling live-24h dashboard style panel of top models and keys.
Retrieving usage series
Fetch daily usage metrics over a specified date range.
Error Handling
Any request that results in a 4xx or 5xx status code will raise an exception corresponding to the type of error (ApiError, RateLimitError, etc.). Catch these natively in Python to perform fallback logic or exponential backoffs.