API Doc
Audio Cleaner (Text To Speech) API - Complete Integration Guide
The Text To Speech (TTS) API converts text into audio files. It supports multiple languages, voices, emotions, and speed settings, and is suitable for dubbing, narration, podcast production, and customer service voice scenarios.
Overview
Key Features
- Rich voice parameter customization: configure voice_id, emotion, speed, and language for personalized speech styles.
- Diverse voice and language options: integrated multi-language, multi-voice library with continuous updates for different use cases.
- Fast response: TTS tasks are processed quickly, often generating high-quality audio in seconds for batch or real-time scenarios.
- Powerful AI speech modeling: advanced AI models restore text emotion and intonation for natural, human-like voice output.
Authentication
All API requests require an api-key. Include your API key in the request header:
API Host: https://audiocleaner.ai/
api-key: YOUR_API_KEY
Credit Billing Rules
| Text Length | Credit Deduction Rule |
|---|
| <= 100 characters | 1 credit |
| 101 ~ 200 characters | 2 credits |
| 201 ~ 300 characters | 3 credits |
| ... | ... |
- Rule: 1 credit is charged for every 100 characters, and any remainder under 100 still counts as 1 credit.
- Example: 215 characters consumes 3 credits.
- Example: 60 characters consumes 1 credit.
1. Create TTS Task
Endpoint
POST /audio/api/v1/api-keys/tts/task/create
Request Headers
| Header | Type | Required | Description |
|---|
| Content-Type | string | ✅ | application/json |
| api-key | string | ✅ | YOUR_API_KEY |
Request Parameters (Body · JSON)
| Parameter | Type | Required | Description |
|---|
| voice_id | number | Yes | Voice ID (can be retrieved from the voice list API) |
| emotion | number | Yes | Emotion parameter (depends on voice support) |
| speed | number | Yes | Speech speed multiplier (e.g., 1 is default) |
| language | string | Yes | Language, e.g. en |
| text | string | Yes | Text content to synthesize |
Supported Languages
| Language | Key |
|---|
| All | all |
| Simplified Chinese | zh |
| English | en |
| Arabic | ar |
| Russian | ru |
| Spanish | es |
| French | fr |
| Portuguese | pt |
| German | de |
| Korean | ko |
| Japanese | ja |
| Cantonese Chinese | zh_yue |
Supported Speed Multipliers
| Speed | Value |
|---|
| Slow | 0.5 |
| Standard | 1 |
| Fast | 2 |
Supported Emotion Parameters
| Emotion | Key | ID |
|---|
| Auto | auto | 0 |
| Happy | happy | 1 |
| Angry | angry | 2 |
| Sad | sad | 3 |
| Afraid | afraid | 4 |
| Disgusted | disgusted | 5 |
| Melancholic | melancholic | 6 |
| Surprised | surprised | 7 |
| Calm | calm | 8 |
- Note: language and speed options can be extended according to actual TTS capabilities.
Parameter Example (JSON)
{
"voice_id": 2072,
"emotion": 0,
"speed": 1,
"language": "en",
"text": "Faced with growing backlash, US President Donald Trump appears to have removed a controversial Truth Social post depicting himself as a Jesus-like figure.\n\nThe AI-generated image, which showed Trump appearing to heal a sick man in a hospital bed, sparked fierce backlash from both sides of the US political spectrum, including from some of Trump's most ardent supporters."
}
Response Format (Unified)
{
"code": 100000,
"data": {
"job_id": "33b6251d7ba94edea8361c318736e746"
},
"message": "Request Success"
}
Response Code (code) Description
| code | Meaning | Message Example |
|---|
| 100000 | Success | Request Success |
| 100100 | Insufficient credit balance | Insufficient credit balance |
| 101002 | Invalid API key | Invalid API key |
| 101003 | API rate limit triggered | API key rate limit exceeded |
| 101004 | Concurrency limit triggered | API key concurrent request limit exceeded |
| 101005 | API key disabled | Your account is suspended. Status cannot be modified. Please contact the administrator |
| 101006 | API key not enabled | API key not enabled |
Example
curl --location --request POST 'https://audiocleaner.ai/audio/api/v1/api-keys/tts/task/create' \
--header 'Content-Type: application/json' \
--header 'api-key: YOUR_API_KEY' \
--data-raw '{
"voice_id": 2072,
"emotion": 0,
"speed": 1,
"language": "en",
"text": "Hello from Audio Cleaner TTS API."
}'
2. Query TTS Task Status
Interface Description
- Use this API to query task status. Request headers must include api-key.
- The backend validates API key legality, including but not limited to key existence, rate limit, concurrency limit, credit sufficiency, and task existence.
- The API returns different task states and explicit error codes for failure cases.
Endpoint
POST /audio/api/v1/api-keys/tts/task/get
Request Headers
| Header | Type | Required | Description |
|---|
| Content-Type | string | ✅ | application/json |
| api-key | string | ✅ | YOUR_API_KEY |
Request Parameters (Body · JSON)
| Parameter | Type | Required | Description |
|---|
| global_id | string | Yes | Task ID returned when creating the task |
Response Format (Success Example)
{
"code": 100000,
"data": {
"status": "waiting/success/failed",
"output": ""
},
"message": "Request Success"
}
Response Field Description
| Field | Type | Description |
|---|
| code | number | Response code indicating request result |
| data | object | Response payload |
| message | string | Human-readable result message |
| data.status | string | Task status: waiting (queued/processing), success, failed |
| data.output | string | Result file URL when successful; may be empty if pending/failed |
Response Code (code) Description
| code | Meaning | Message Example |
|---|
| 100000 | Success | Request Success |
| 100100 | Insufficient credit balance | Insufficient credit balance |
| 101002 | Invalid API key | Invalid API key |
| 101003 | API rate limit triggered | API key rate limit exceeded |
| 101004 | Concurrency limit triggered | API key concurrent request limit exceeded |
| 101008 | Task not found | Task not found |
Example
curl --location --request POST 'https://audiocleaner.ai/audio/api/v1/api-keys/tts/task/get' \
--header 'Content-Type: application/json' \
--header 'api-key: YOUR_API_KEY' \
--data-raw '{
"global_id": "59063d399a3749f290a2d9fb4e75ddc3"
}'
3. Download TTS Voice Library (Voice List)
Interface Description
- Returns only voice information visible/available to the current account.
- Returns JSON with all fields needed by business usage (such as image/audio URLs and base attributes).
- Includes key field descriptions such as gender and age.
- After login, click the Developer menu, open Playground, and choose AI Voice Generator.
Response Format (Example)
{
"code": 100000,
"data": {
"total": 159,
"records": [
{
"id": 2072,
"gender": 2,
"language": "en",
"age": 2,
"emotion": [
"chat",
"customerservice",
"narration-professional",
"newscast-casual",
"newscast-formal",
"cheerful",
"empathetic",
"angry",
"sad",
"excited",
"friendly",
"terrified",
"shouting",
"unfriendly",
"whispering",
"hopeful"
],
"name": "madison",
"display_name": "Madison"
}
]
},
"message": "Request Success"
}
Field Description (Key)
| Field | Type | Description |
|---|
| data.total | number | Total voices visible to the current account |
| data.records | array | Voice list |
| records.id | number | Unique voice ID (used to create TTS tasks) |
| records.gender | number | Gender enum value (based on platform enum definitions) |
| records.language | string | Language key, e.g. en |
| records.age | number | Age enum value (based on platform enum definitions) |
| records.emotion | string[] | Supported emotion list for the current voice |
| records.name | string | Internal system name |
| records.display_name | string | Display name for frontend |
Recommended Usage Flow
- Call the voice list API to fetch voice_id and available parameters.
- Call the create-task API, submit text, and get job_id.
- Poll the task status API until status = success.
- Read output and download/play the generated audio.
FAQ
If a task fails, will credits or fees still be deducted?
Third-party service platforms usually charge only when task status is success and output is available. Please refer to actual billing logic for final rules.
Why do I get "Task not found" when querying task status?
Common reasons include non-existing or expired job_id, or mismatch between job_id and current API key/account. Ensure request parameters and authentication are correct and consistent.
What should I do if task status stays in waiting for a long time?
Queue delays may occur for popular voices or high-volume tasks. Increase polling attempts or polling intervals appropriately. If there is still no progress for a long time, contact platform technical support.