Typescript SDK
Integrate Alephant Analytics into your TypeScript & Node.js applications
The official Alephant Analytics TypeScript SDK provides access to the Alephant Analytics API from TypeScript and Node.js applications. It allows you to query telemetry, fetch daily usage series, and retrieve real-time summary statistics for FinOps dashboards.
Installation
Install the SDK via npm, yarn, or pnpm:
Initialization
Import and initialize the client. The default environment is development (https://analytics-dev.alephant.io). Use the production environment only after the production Analytics service has been deployed.
Example Usage
Smoke test
Use the public health endpoint to verify that the SDK can reach the Analytics dev service.
Live 24-hour panel
Retrieve a rolling live-24h dashboard panel. Authenticated SaaS analytics routes accept the Authorization and X-Workspace-Id headers as request fields.
Retrieving usage series
Fetch daily usage metrics over a specified date range.
Error Handling
The SDK throws structured errors for non-2xx API responses, allowing you to gracefully handle authentication, rate limits, or validation errors programmatically.