xAI Text-to-Speech
Audio model · Available upstream
Expressive text-to-speech with over two dozen voices, speech tags, and multilingual support
Generation is available through the published Meldport configurations below. Review the exact quote before submitting.
- Model ID
xai-tts- Released
- Mar 16, 2026
- Billing unit
- Characters
Meldport generation prices
xAI Text-to-Speech
bac25196-04de-443f-8b1a-993b507a9c2ctext to audio
Final quote depends on text length. Check the exact quote before generating.
Variable billing detailsAPI request and parameters
Use audio:generate on your API key. This configuration runs text to audio and returns audio/mpeg.
This configuration does not require an uploaded image. Choose a different configuration ID to change the workflow or output settings. Send only options listed below.
{
"voice": {
"enum": [
"carina",
"zagan",
"helix",
"orion",
"luna",
"iris",
"altair",
"zenith",
"perseus",
"helios",
"lux",
"kepler",
"rigel",
"cosmo",
"celeste",
"ursa",
"sirius",
"lumen",
"castor",
"naksh",
"atlas",
"una",
"ara",
"eve",
"leo",
"rex",
"sal"
],
"type": "string",
"required": true,
"maxLength": 100
},
"language": {
"enum": [
"en",
"ar-EG",
"ar-SA",
"ar-AE",
"bn",
"zh",
"fr",
"de",
"hi",
"id",
"it",
"ja",
"ko",
"pt-BR",
"pt-PT",
"ru",
"es-MX",
"es-ES",
"tr",
"vi"
],
"type": "string",
"required": false,
"maxLength": 10
}
}Replace the prompt and set a unique MELDPORT_IDEMPOTENCY_KEY for this operation. The example quotes the request and then creates one paid job. Read the billing rules before accepting variable charges.
const api = "https://api.meldport.com";
const key = process.env.MELDPORT_API_KEY;
const idempotencyKey = process.env.MELDPORT_IDEMPOTENCY_KEY;
if (!key || !idempotencyKey) throw new Error("Set your API key and a unique operation ID first.");
async function post(path, body) {
const response = await fetch(api + path, {method: "POST",
headers: {Authorization: `Bearer ${key}`, "Content-Type": "application/json"},
body: JSON.stringify(body)});
const result = await response.json();
if (!response.ok) throw new Error(JSON.stringify(result.error));
return result;
}
const request = {
"configuration_id": "bac25196-04de-443f-8b1a-993b507a9c2c",
"prompt": "Replace with your prompt or speech script.",
"options": {
"voice": "carina"
},
"input_asset_ids": []
};
const {data: quote} = await post("/v1/media/quotes", request);
console.log("Quote:", quote);
const result = await post("/v1/media/jobs", {
...request, idempotency_key: idempotencyKey,
accepted_customer_price_microusd: quote.customer_price_microusd,
accepted_maximum_reservation_microusd: quote.maximum_reservation_microusd,
...(quote.billing_policy_version === "actual-cost-v1"
? {billing_policy_version: "actual-cost-v1"} : {}),
});
console.log(result.job);
// Poll GET /v1/media/jobs/<job.id> with the same API key.
// Keep this operation ID for retries. A new ID requests another generation.Poll the returned job ID. Download only after state is succeeded and billing_state is settled. Polling and download example.
About this model
xAI Text-to-Speech converts text into natural-sounding spoken audio with a single API call. It offers more than two dozen expressive voices, inline speech tags for fine-grained control over pauses, laughter, whispers, and emphasis, and supports over 20 auto-detected languages.