Features
TypeScript Support
Complete type definitions with IDE auto-completion.
Dual Module Support
Works with both ESM and CommonJS.
Error Handling
Custom error classes with detailed error codes.
Request Cancellation
Configurable timeouts and AbortController support.
Installation
Quick Start
- TypeScript
- JavaScript (ESM)
- JavaScript (CommonJS)
Configuration
API Reference
Start TTS Generation
Creates a new text-to-speech task and returns a generation ID.Poll TTS Status
Check the status of a TTS generation job.Generate TTS (Convenience Method)
Start generation and automatically poll until complete:Get Available Voices
Retrieve the list of available voices for a specific model.Error Handling
The SDK provides a customAudixaError class for comprehensive error handling:
Error Codes
| Code | HTTP Status | Description |
|---|---|---|
INVALID_PARAMS | 400 | Invalid request parameters |
INVALID_API_KEY | 401 | Invalid or missing API key |
INSUFFICIENT_CREDITS | 402 | Not enough credits in account |
FORBIDDEN | 403 | Access denied to resource |
NOT_FOUND | 404 | Resource not found |
TIMEOUT | - | Request timed out |
NETWORK_ERROR | - | Network connectivity issue |
Request Cancellation
All methods support cancellation viaAbortController: