Generate speech
August 18, 2025 (January 21, 2026)
Table of contents
This endpoint generates high-quality speech from text using Murekaβs advanced text-to-speech technology. You can use either predefined voices or custom cloned voices created via POST /speech/voice. For multi-speaker conversations, use the conversation parameter with different voice IDs. Speech generation typically takes 20-90 seconds depending on text length.
Unlike music generation endpoints, this endpoint has no rate limits or concurrent generation restrictions, allowing unlimited parallel speech generations per account.
https://api.useapi.net/v1/mureka/speech
Request Headers
Authorization: Bearer {API token}
Content-Type: application/json
# Content-Type: multipart/form-data
API tokenis required, see Setup useapi.net for details.
Request Body
-
accountis optional when only one account configured. However, if you have multiple accounts configured, this parameter becomes required. -
titleis optional string.
Maximum length is 500 characters. -
textis required string when not usingconversation. Must be used together withvoice_id.
Maximum text length is 5000 characters. -
voice_idis required number when not usingconversation. Must be used together withtext. Get available voice IDs from GET /speech/voices.
To create a cloned voice, first use POST /speech/voice to upload an audio sample and clone the voice. -
conversationis optional JSON string. Alternative totextandvoice_id. Must be a JSON string array of objects withvoice_id(number) andtext(string) fields. Cannot be used together withtextandvoice_id. Total text length across all conversation items cannot exceed 5000 characters.Example
conversationJSON:[ {"voice_id": 12345, "text": "Hello, welcome to our service!"}, {"voice_id": 67890, "text": "Thank you for choosing us today."}, {"voice_id": 12345, "text": "Is there anything I can help you with?"} ] -
asyncis optional, enables fire-and-forget mode (default:false). Whentrue, returns immediately with201 Createdand job metadata. Poll GET /jobs/jobidfor completion status. Useful for avoiding long request timeouts since speech generation takes 20-90 seconds. -
replyUrlis optional, webhook URL for job status callbacks. Receives POST requests with job status updates (created,completed,failed). The JSON payload shape matches GET /jobs/jobidresponse. -
replyRefis optional, custom reference string passed back in webhook callbacks. Useful for tracking jobs on your end.
Responses
-
{ "jobid": "j0121061456745673364t-u777-a12345678901234-bot:mureka", "title": "Sample Speech Title", "preview": "This is a preview of the generated speech content that demonstrates the text-to-speech capabilities.", "cover": "https://static-cos.mureka.ai/cos-prod/res/cover/β¦.png", "mp3_url": "https://static-cos.mureka.ai/cos-prod/tts-v2/β¦.mp3", "id": 12345678901234, "duration_milliseconds": 15000, "audio_quality": 2, "state": 3 } -
Job created in async mode (
async: true). Speech generation is processing in the background.Use GET /jobs/
jobidto poll for completion status.{ "jobid": "j0121061456745673364t-u777-a12345678901234-bot:mureka", "verb": "speech", "jobType": "tts", "status": "created", "created": "2026-01-20T12:34:56.789Z", "request": { "account": "12345678901234", "text": "Hello, this is a sample text for speech generation.", "voice_id": 67890, "async": true, "replyUrl": "https://your-domain.com/webhook", "replyRef": "my-custom-ref-123" } } -
{ "error": "<Error message>", "code": 400 } -
{ "error": "Unauthorized", "code": 401 } -
596 Account Error
Returned when the account has an error state preventing API calls.
{ "error": "Session refresh failed 2026-01-19T14:31:15.000Z, manual update required", "code": "REFRESH_FAILED" }Possible error codes:
ACCOUNT_ERROR- Account has a blocking errorREFRESH_FAILED- Automatic token refresh failedREFRESH_IN_PROGRESS- Token refresh already in progress, retry shortlySESSION_EXPIRED- Session expired and no auto-refresh availableCOOKIE_EXPIRED- Google cookie has expired
To resolve, update your account configuration via POST /accounts.
Model
-
Speech generation completed. Returns full audio data with MP3 URL.
{ jobid: string // Job identifier (for later lookup) title: string preview: string cover: string mp3_url: string id: number duration_milliseconds: number audio_quality: number state: number } -
Job created and processing in background. Structure matches GET /jobs/
jobidresponse.{ jobid: string // Job identifier verb: 'speech' // Job verb jobType: 'tts' // Job type status: 'created' // Job status created: string // ISO 8601 timestamp request: { account?: string title?: string text?: string voice_id?: number conversation?: string async: true replyUrl?: string replyRef?: string } } -
Error response structure (applies to both sync and async modes).
{ jobid?: string // Present for job-related errors error: string // Error summary message code?: number // HTTP status code or error code rawData?: string // Raw error data (if available) }
Examples
-
curl "https://api.useapi.net/v1/mureka/speech" \ -H "Accept: application/json" \ -H "Authorization: Bearer β¦" \ -H "Content-Type: application/json" \ -d '{ "text": "Hello, this is a sample text for speech generation.", "voice_id": 67890 }' -
const token = "API token"; const apiUrl = "https://api.useapi.net/v1/mureka/speech"; const response = await fetch(apiUrl, { method: "POST", headers: { "Authorization": `Bearer ${token}`, "Content-Type": "application/json", }, body: JSON.stringify({ text: "Hello, this is a sample text for speech generation.", voice_id: 67890 }), }); const result = await response.json(); console.log("response", {response, result}); -
import requests token = "API token" apiUrl = "https://api.useapi.net/v1/mureka/speech" headers = { "Content-Type": "application/json", "Authorization" : f"Bearer {token}" } data = { "text": "Hello, this is a sample text for speech generation.", "voice_id": 67890 } response = requests.post(apiUrl, headers=headers, json=data) print(response, response.json())