OpenAI Compatible
Cantonese.AI's API is compatible with OpenAI's libraries, making it easy to integrate our specialized Cantonese language models into your existing applications.
To start using Cantonese.AI with OpenAI's client libraries, pass in your Cantonese.AI API key to the api_key option, and change the base_url to https://stt-api.cantonese.ai/v1/ for Speech-to-Text.
Cantonese is the default, so leave language out for Cantonese speech. Note that language="zh" returns written Chinese rather than spoken Cantonese; the other values are the same as the lang parameter of Speech-to-Text.
Example Request
Here are examples of how to transcribe audio files using different programming languages.
curl -X POST "https://stt-api.cantonese.ai/v1/audio/transcriptions" \
-H "Authorization: Bearer XXXXXXX" \
-F "[email protected]"Status Codes
The API returns standard HTTP status codes to indicate the success or failure of requests.
| Status Code | Description |
|---|---|
| 200 | Success - Audio transcribed successfully |
| 400 | Bad Request - missing or invalid parameters, unsupported or unreadable audio, a file over 500 MB, or quota/plan limits reached. The body is JSON with the reason. |
| 401 | Unauthorized - Invalid or missing API key |
| 429 | Too Many Requests - Rate limit exceeded |
| 500 | Internal Server Error - Server encountered an unexpected condition |
| 503 | Service Unavailable - Server is temporarily unable to handle the request |