Best Practices
Best practices, tips, and recommendations for using Lesan AI services effectively.
API Usage
- Use async mode for audio files longer than 5 minutes
- Implement proper error handling and retry logic
- Respect rate limits and implement exponential backoff
- Cache results when appropriate to reduce API calls
Audio Quality
- Use high-quality audio files for better transcription accuracy
- Ensure audio is in a supported format (MP3, WAV, etc.)
- Minimize background noise when possible
- For best results, use audio with clear speech
Security
- Never expose API keys in client-side code
- Store keys securely using environment variables
- Rotate API keys regularly
- Use different keys for development and production
- Monitor API key usage for suspicious activity
Performance
- Use batch processing for multiple files
- Implement proper polling intervals for async jobs
- Consider using webhooks for job completion notifications
- Optimize audio file sizes before uploading
Error Handling
- Always check response status codes
- Handle rate limit errors gracefully
- Implement retry logic with exponential backoff
- Log errors for debugging and monitoring
For more information, check out our other guides and the API Reference.