The Sunbird AI API uses standard HTTP status codes to indicate the success or failure of requests.
Common Status Codes
Timeouts
Some AI models, particularly large ones like Sunflower or Whisper, may take time to process requests. Server-side timeouts (e.g., 408, 504) can occur if the request takes too long.
For large operations (like long audio files), consider using the asynchronous workflows or signed URL upload methods where available to avoid timeouts.
Several legacy endpoints (e.g. /tasks/stt, /tasks/tts, /tasks/sunflower_inference) still work but are deprecated. When you call one, the API returns Deprecation and Sunset response headers indicating that the route will be removed in a future release.
Inspect these headers in your client and migrate to the unified endpoints — /tasks/audio/transcriptions, /tasks/audio/speech, and /tasks/chat/completions — before the sunset date.
Python Example
Here is a robust way to handle errors in Python: