textstring필수적힌 그대로 읽을 말입니다. [laugh]나 <whisper>…</whisper> 같은 음성 태그를 넣을 수 있습니다. 1~15,000자이며, 공백·문장 부호·태그를 포함해 1,000자마다 과금됩니다.
- 기본값
- 지정되지 않음
- 제약 조건
- minLength:1maxLength:15000
Grok TTS는 xAI의 text-to-speech로, 최대 15,000자 대본을 20개 언어의 71가지 프리셋 목소리로 읽습니다. 웃음·속삭임 같은 음성 태그를 연기하고 속도는 0.7~1.5배입니다.
예시는 선택한 엔드포인트의 공개 파라미터 정의를 사용합니다. API 키와 예시 미디어를 바꾼 뒤 서버에서 요청하세요.
SDK 및 연동https://api.spicyapi.ai/api/v1/jobs/createTaskAPI 키는 서버 환경 변수 SPICY_API_KEY에 보관하세요. Bearer 인증을 사용하고 JSON 요청에는 Content-Type: application/json을 지정하세요.
Authorization: Bearer $SPICY_API_KEY# Generate the idempotency key once; reuse it when retrying after a lost response.
export SPICY_IDEMPOTENCY_KEY="${SPICY_IDEMPOTENCY_KEY:-$(uuidgen)}"
curl -X POST https://api.spicyapi.ai/api/v1/jobs/createTask \
-H "Authorization: Bearer $SPICY_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $SPICY_IDEMPOTENCY_KEY" \
-d '{
"model": "xai/grok-tts/text-to-speech",
"input": {
"text": "Welcome back. Your files finished rendering a minute ago and are ready to download.",
"bitrate": 128000,
"language": "auto",
"voice_id": "eve",
"sample_rate": 24000,
"output_format": "mp3"
}
}'
# Copy data.taskId from the response into TASK_ID, then poll the status.
TASK_ID="TASK_ID_FROM_RESPONSE"
curl "https://api.spicyapi.ai/api/v1/jobs/recordInfo?taskId=$TASK_ID" \
-H "Authorization: Bearer $SPICY_API_KEY"이 모델의 입력 스키마에서 뽑아낸 예시입니다. API도 모든 요청을 같은 스키마로 검증합니다.
이 필드들은 요청 본문의 input 객체 안에 넣습니다. 이름과 타입은 API와 동일합니다. 기본값이 적혀 있지 않은 필드는 임의로 가정하지 마세요.
textstring필수적힌 그대로 읽을 말입니다. [laugh]나 <whisper>…</whisper> 같은 음성 태그를 넣을 수 있습니다. 1~15,000자이며, 공백·문장 부호·태그를 포함해 1,000자마다 과금됩니다.
optimize_streaming_latencyinteger선택모델의 스트리밍 지연 단계입니다. 0(기본값)은 최고의 음질을 유지합니다. 1은 첫 오디오 조각을 작게 만들어 첫소리까지의 시간을 줄이며, 조각 경계에서 음질이 조금 떨어질 수 있습니다. 2는 첫 조각을 가장 작게 만들며 음질 저하가 더 두드러질 수 있습니다. 가격에는 영향을 주지 않습니다.
012text_normalizationboolean선택켜면 숫자, 약어, 기호 같은 문자 표기를 읽기 전에 말하는 형태로 바꿉니다. 기본값은 꺼짐입니다. 가격에는 영향을 주지 않습니다.
bitrateinteger선택MP3 비트레이트(bps)이며 32000~192000, 기본값은 128000입니다. output_format이 mp3일 때만 적용됩니다. 가격에는 영향을 주지 않습니다.
320006400096000128000192000sample_rateinteger선택샘플링 레이트(Hz)이며 8000, 16000, 22050, 24000(기본값), 44100, 48000 중에서 고릅니다. 전화 회선에는 mulaw나 alaw와 함께 8000을, 스튜디오 작업에는 44100이나 48000을 쓰세요. 가격에는 영향을 주지 않습니다.
80001600022050240004410048000output_formatstring선택오디오 인코딩입니다. mp3(기본값), wav, 또는 전화 시스템용 헤더 없는 스트림인 pcm·mulaw·alaw 중에서 고릅니다. 가격에는 영향을 주지 않습니다.
"mp3""wav""pcm""mulaw""alaw"speednumber선택말하기 속도이며 0.7(느리게)~1.5(빠르게), 기본값은 1.0입니다. 가격에는 영향을 주지 않습니다.
languagestring선택읽을 언어의 언어 코드, 또는 대본에서 자동 감지하는 auto(기본값)입니다. 짧거나 여러 언어가 섞인 대본이 다른 언어로 읽힐 때 설정하세요. 네덜란드어·폴란드어·스웨덴어·핀란드어·덴마크어·태국어 보이스에는 전용 코드가 없으므로 auto로 두세요. 가격에는 영향을 주지 않습니다.
"auto""en""zh""ar-EG""ar-SA""ar-AE""bn""fr""de""hi""id""it""ja""ko""pt-BR""pt-PT""ru""es-MX""es-ES""tr""vi"voice_idstring선택71가지 프리셋 보이스 중 하나이며 목록에 이름, 성별, 언어가 표시됩니다. Eve(기본값), Ara, Leo, Rex, Sal은 지원하는 모든 언어를 말하고 나머지는 한 언어에 맞춰져 있습니다. 가격에는 영향을 주지 않습니다.
"ara""eve""leo""rex""sal""jpi39icg""d18jlf6v""33g9t0jl""26w6ihxi""dr8gqysu""wy0m9l5w""om17cury""x7avnu1k""bcs7l2c3""hqxr4yub""h27ltdnz""89q2pnko""73xd5dum""0p0rt7o1""hbxkrnwm""69smp8rm""yis75yfp""ekhwx401""jupvcf34""0hhfxxqq""0ih5oi34""gwnexu6y""97zmdc6s""fc7de6afcf6c""7a9ee820b342""0895a5b8ce5c""f8cf5c2c78d4""96819d0bd28d""79f3a8b96d43""78a495fdbb39""e22152e06fd8""490ea3be50b1""1f046a033914""dfe7b9e7d217""c3a2c594479e""83c6f4fea98e""34fd4dce1ba3""d634b6da3d3b""670a0c3ac005""182a91893636""d0cb9ff07d95""b1a7441b97a1""bf9fe5b5f981""b5ae17439907""a0401c9101f8""23be42535a45""abfbdf26f115""6da5baee46d0""3d030bc92a87""a13662ba951c""58d27475085e""247783ebdd51""244e27b39200""97fabd54445f""37329fd8895a""2badb5f46b1e""1b12d5daee6b""908c4626660f""4ff93971bfdc""70013edeb8e8""35c8d7f60dc8""23468361b4ef""458705c07139""41321eb41295""40f31906b23d""3a7889066fa2"{
"type": "object",
"required": [
"text"
],
"x-pricing": {
"billingMode": "per_unit",
"variantFields": []
},
"properties": {
"text": {
"type": "string",
"x-ui": {
"rows": 6,
"order": 100,
"widget": "textarea",
"primary": true
},
"maxLength": 15000,
"minLength": 1,
"description": "The words to be spoken, with optional speech tags such as [laugh] or <whisper>…</whisper>. Billed per 1,000 characters, tags included."
},
"speed": {
"type": "number",
"x-ui": {
"step": 0.05,
"unit": "×",
"order": 70,
"widget": "slider"
},
"default": 1,
"maximum": 1.5,
"minimum": 0.7,
"description": "Speaking speed from 0.7 (slower) to 1.5 (faster)."
},
"bitrate": {
"enum": [
32000,
64000,
96000,
128000,
192000
],
"type": "integer",
"x-ui": {
"order": 40,
"widget": "select",
"advanced": true,
"enum_labels": {
"32000": "32 kbps",
"64000": "64 kbps",
"96000": "96 kbps",
"128000": "128 kbps",
"192000": "192 kbps"
}
},
"default": 128000,
"description": "MP3 bit rate in bits per second. Only applies to mp3."
},
"language": {
"enum": [
"auto",
"en",
"zh",
"ar-EG",
"ar-SA",
"ar-AE",
"bn",
"fr",
"de",
"hi",
"id",
"it",
"ja",
"ko",
"pt-BR",
"pt-PT",
"ru",
"es-MX",
"es-ES",
"tr",
"vi"
],
"type": "string",
"x-ui": {
"order": 80,
"widget": "select",
"enum_labels": {
"bn": "Bengali",
"de": "German",
"en": "English",
"fr": "French",
"hi": "Hindi",
"id": "Indonesian",
"it": "Italian",
"ja": "Japanese",
"ko": "Korean",
"ru": "Russian",
"tr": "Turkish",
"vi": "Vietnamese",
"zh": "Chinese (Mandarin)",
"auto": "Auto-detect",
"ar-AE": "Arabic (UAE)",
"ar-EG": "Arabic (Egypt)",
"ar-SA": "Arabic (Saudi Arabia)",
"es-ES": "Spanish (Spain)",
"es-MX": "Spanish (Mexico)",
"pt-BR": "Portuguese (Brazil)",
"pt-PT": "Portuguese (Portugal)"
}
},
"default": "auto",
"description": "Reading language, or auto to detect it from the text."
},
"voice_id": {
"enum": [
"ara",
"eve",
"leo",
"rex",
"sal",
"jpi39icg",
"d18jlf6v",
"33g9t0jl",
"26w6ihxi",
"dr8gqysu",
"wy0m9l5w",
"om17cury",
"x7avnu1k",
"bcs7l2c3",
"hqxr4yub",
"h27ltdnz",
"89q2pnko",
"73xd5dum",
"0p0rt7o1",
"hbxkrnwm",
"69smp8rm",
"yis75yfp",
"ekhwx401",
"jupvcf34",
"0hhfxxqq",
"0ih5oi34",
"gwnexu6y",
"97zmdc6s",
"fc7de6afcf6c",
"7a9ee820b342",
"0895a5b8ce5c",
"f8cf5c2c78d4",
"96819d0bd28d",
"79f3a8b96d43",
"78a495fdbb39",
"e22152e06fd8",
"490ea3be50b1",
"1f046a033914",
"dfe7b9e7d217",
"c3a2c594479e",
"83c6f4fea98e",
"34fd4dce1ba3",
"d634b6da3d3b",
"670a0c3ac005",
"182a91893636",
"d0cb9ff07d95",
"b1a7441b97a1",
"bf9fe5b5f981",
"b5ae17439907",
"a0401c9101f8",
"23be42535a45",
"abfbdf26f115",
"6da5baee46d0",
"3d030bc92a87",
"a13662ba951c",
"58d27475085e",
"247783ebdd51",
"244e27b39200",
"97fabd54445f",
"37329fd8895a",
"2badb5f46b1e",
"1b12d5daee6b",
"908c4626660f",
"4ff93971bfdc",
"70013edeb8e8",
"35c8d7f60dc8",
"23468361b4ef",
"458705c07139",
"41321eb41295",
"40f31906b23d",
"3a7889066fa2"
],
"type": "string",
"x-ui": {
"order": 90,
"widget": "select",
"primary": true,
"enum_labels": {
"ara": "Ara · female · multilingual",
"eve": "Eve · female · multilingual (default)",
"leo": "Leo · male · multilingual",
"rex": "Rex · male · multilingual",
"sal": "Sal · male · multilingual",
"0hhfxxqq": "Andres · male · Spanish",
"0ih5oi34": "Kasper · male · Danish",
"0p0rt7o1": "Remi · male · French",
"26w6ihxi": "Pavel · male · Russian",
"33g9t0jl": "Xia · female · Mandarin",
"69smp8rm": "Camille · female · French",
"73xd5dum": "Ananya · female · Hindi",
"89q2pnko": "Karan · male · Hindi",
"97zmdc6s": "Ida · female · Danish",
"bcs7l2c3": "Matteo · male · Italian",
"d18jlf6v": "Hao · female · Mandarin",
"dr8gqysu": "Andrei · male · Russian",
"ekhwx401": "Javier · male · Spanish",
"gwnexu6y": "Lars · male · Danish",
"h27ltdnz": "Alessandro · male · Italian",
"hbxkrnwm": "Hugo · male · French",
"hqxr4yub": "Luca · female · Italian",
"jpi39icg": "Jian · male · Mandarin",
"jupvcf34": "Diego · male · Spanish",
"om17cury": "Irina · female · Russian",
"wy0m9l5w": "Dmitri · male · Russian",
"x7avnu1k": "Enzo · male · Italian",
"yis75yfp": "Manuel · male · Spanish",
"0895a5b8ce5c": "Mai · female · Vietnamese",
"182a91893636": "Kaan · male · Turkish",
"1b12d5daee6b": "Aleksandra · female · Polish",
"1f046a033914": "Erik · male · Swedish",
"23468361b4ef": "Tariq · male · Arabic",
"23be42535a45": "Ji-yeon · female · Korean",
"244e27b39200": "Ruben · male · Dutch",
"247783ebdd51": "Noor · female · Dutch",
"2badb5f46b1e": "Jakub · male · Polish",
"34fd4dce1ba3": "Elina · female · Finnish",
"35c8d7f60dc8": "Layla · female · Arabic",
"37329fd8895a": "Mateusz · male · Polish",
"3a7889066fa2": "Lena · female · German",
"3d030bc92a87": "Rafael · male · Portuguese",
"40f31906b23d": "Niklas · male · German",
"41321eb41295": "Moritz · male · German",
"458705c07139": "Clara · female · German",
"490ea3be50b1": "Saga · female · Swedish",
"4ff93971bfdc": "Aroon · male · Thai",
"58d27475085e": "Femke · female · Dutch",
"670a0c3ac005": "Emre · male · Turkish",
"6da5baee46d0": "Beatriz · female · Portuguese",
"70013edeb8e8": "Khalid · male · Arabic",
"78a495fdbb39": "James · male · English",
"79f3a8b96d43": "Claire · female · English",
"7a9ee820b342": "Minh · male · Vietnamese",
"83c6f4fea98e": "Eero · male · Finnish",
"908c4626660f": "Krit · male · Thai",
"96819d0bd28d": "Daniel · male · English",
"97fabd54445f": "Katarzyna · female · Polish",
"a0401c9101f8": "Seo-yeon · female · Korean",
"a13662ba951c": "Thijs · male · Dutch",
"abfbdf26f115": "Mateus · male · Portuguese",
"b1a7441b97a1": "Ren · male · Japanese",
"b5ae17439907": "Min-jun · male · Korean",
"bf9fe5b5f981": "Jun-seo · male · Korean",
"c3a2c594479e": "Helmi · female · Finnish",
"d0cb9ff07d95": "Sakura · female · Japanese",
"d634b6da3d3b": "Aylin · female · Turkish",
"dfe7b9e7d217": "Valtteri · male · Finnish",
"e22152e06fd8": "Axel · male · Swedish",
"f8cf5c2c78d4": "Grace · female · English",
"fc7de6afcf6c": "Duc · male · Vietnamese"
}
},
"default": "eve",
"description": "Preset voice. Eve, Ara, Leo, Rex and Sal speak every supported language; the others are tuned for one language."
},
"sample_rate": {
"enum": [
8000,
16000,
22050,
24000,
44100,
48000
],
"type": "integer",
"x-ui": {
"order": 50,
"widget": "select",
"advanced": true,
"enum_labels": {
"8000": "8 kHz (telephony)",
"16000": "16 kHz",
"22050": "22.05 kHz",
"24000": "24 kHz",
"44100": "44.1 kHz",
"48000": "48 kHz"
}
},
"default": 24000,
"description": "Sample rate in Hz. 8000 for phone lines, 44100 or 48000 for studio work."
},
"output_format": {
"enum": [
"mp3",
"wav",
"pcm",
"mulaw",
"alaw"
],
"type": "string",
"x-ui": {
"order": 60,
"widget": "select",
"advanced": true,
"enum_labels": {
"mp3": "MP3",
"pcm": "PCM (raw, 16-bit)",
"wav": "WAV",
"alaw": "A-law (raw, telephony)",
"mulaw": "μ-law (raw, telephony)"
}
},
"default": "mp3",
"description": "Audio encoding. pcm, mulaw and alaw are raw streams without a file header, for phone systems."
},
"text_normalization": {
"type": "boolean",
"x-ui": {
"order": 30,
"widget": "switch",
"advanced": true
},
"default": false,
"description": "Rewrite numbers, abbreviations and symbols as spoken words before reading."
},
"optimize_streaming_latency": {
"enum": [
0,
1,
2
],
"type": "integer",
"x-ui": {
"order": 20,
"widget": "select",
"advanced": true,
"enum_labels": {
"0": "0 — best quality",
"1": "1 — lower latency",
"2": "2 — lowest latency"
}
},
"default": 0,
"description": "Streaming latency level: 0 best quality, 1 smaller first chunk, 2 smallest first chunk with more quality trade-off at chunk boundaries."
}
},
"additionalProperties": false
}HTTP 202는 접수되었다는 뜻이며 생성 완료가 아닙니다. 반환된 taskId를 저장하고 같은 작업을 조회하세요. 결과를 기다리는 동안 작업을 다시 생성하지 마세요.
HTTP/1.1 202 Accepted
Location: /api/v1/jobs/recordInfo?taskId=job_01k3m8x9q2z4v7n5p6r8s0t1w3
{
"code": 200,
"msg": "success",
"request_id": "req_example_create",
"data": {
"taskId": "job_01k3m8x9q2z4v7n5p6r8s0t1w3",
"state": "queued",
"estimatedCost": "0.750000"
}
}접수 응답에 이번 예상 비용이 포함되므로 앱의 작업 기록과 청구 화면에 같은 금액을 표시할 수 있습니다.
curl --get "https://api.spicyapi.ai/api/v1/jobs/recordInfo" \
--data-urlencode "taskId=$TASK_ID" \
-H "Authorization: Bearer $SPICY_API_KEY"약 2초 간격으로 시작해서 점점 간격을 넓히세요. 종료 상태가 나오면 멈추고, 연결이 끊겼더라도 원래 taskId를 그대로 조회하세요. 다시 생성할 때는 처음에 쓴 Idempotency-Key와 본문을 그대로 써야 합니다.
import { verifyWebhook } from "@spicyapi/sdk";
// express.raw keeps the bytes we signed; express.json never matches.
app.post("/hooks/spicy", express.raw({ type: "application/json" }), (req, res) => {
const { payload } = verifyWebhook({
rawBody: req.body,
timestamp: req.header("X-Webhook-Timestamp"),
signature: req.header("X-Webhook-Signature"),
payloadVersion: Number(req.header("X-Webhook-Payload-Version")),
secret: process.env.SPICY_WEBHOOK_SECRET,
});
res.status(200).end();
void handleFinishedTask(payload);
});작업을 만들 때 callBackUrl을 넘기면 완료된 레코드가 POST로 전달됩니다 — 폴링 루프가 아예 필요 없습니다. 모든 전달에는 X-Webhook-Timestamp, X-Webhook-Signature, X-Webhook-Payload-Version이 함께 옵니다. 서명은 taskId.timestamp.sha256(body)에 대한 base64 HMAC-SHA256이므로 반드시 원본 바이트로 검증해야 합니다. JSON을 파싱했다가 다시 직렬화하면 바이트가 달라져 검증이 실패합니다. 실패한 전달은 재시도되므로 같은 taskId가 두 번 올 수 있습니다. 핸들러를 멱등하게 만드세요. 먼저 2xx로 답하고 처리는 그다음에 — 응답이 느리면 전달 실패로 간주됩니다.
state가 succeeded일 때만 output을 사용하세요. 실패 시 errorCode, errorMessage, request_id로 원인을 확인하세요. 예시 비용과 상태는 실제 청구 내역이 아닙니다.
{
"code": 200,
"msg": "success",
"request_id": "req_example_record",
"data": {
"taskId": "job_01k3m8x9q2z4v7n5p6r8s0t1w3",
"model": "xai/grok-tts/text-to-speech",
"state": "succeeded",
"output": {
"assets": [
{
"key": "tasks/2026/08/28/job_01k3m8x9q2z4v7n5p6r8s0t1w3/3f7a1c9e5b2d48f0a6c1e3d5b7f9a1c3.mp3",
"mime": "audio/mpeg",
"url": "https://example.r2.cloudflarestorage.com/results/job_01k3m8x9q2z4v7n5p6r8s0t1w3/result.mp3?X-Amz-Signature=SIGNATURE_FROM_RESPONSE",
"expiresAt": "2026-08-28T12:20:08.000Z"
}
]
},
"cost": "0.750000",
"settled": true,
"createdAt": "2026-08-28T12:00:00Z",
"completedAt": "2026-08-28T12:00:30Z"
}
}사용 가능한 파일은 assets[].url에서 바로 열거나 다운로드할 수 있으며 API Authorization 헤더가 필요하지 않습니다. 서명 URL은 expiresAt에 만료됩니다. 보관 기간 내에 작업을 다시 조회하면 URL이 갱신됩니다. 처리 중이거나 사용할 수 없는 파일에는 URL이 없습니다. 서명 URL은 비공개로 보관하세요.
앱, 터미널, AI 어시스턴트 또는 시각적 워크플로에서 SpicyAPI를 사용하세요. 원하는 설정 가이드를 선택하세요.
위 코드를 직접 쓸 필요는 없습니다. MCP 서버를 한 번만 연결해 두면 MCP를 지원하는 에이전트(Claude Code, Codex, Cursor, Windsurf, VS Code, Gemini CLI, Cline, LibreChat)가 이 모델을 이름으로 호출합니다. 셸에서 명령 한 줄로 실행할 수도 있습니다.
xai/grok-tts/text-to-speech로 네온 아래 선 댄서의 인물 사진을 만들어서 ./out/에 저장해 줘.
에이전트가 공개 카탈로그에서 모델을 찾고, 로컬 파일을 대신 업로드한 뒤, 정확한 견적과 최대 청구액을 보여 주고 확인을 기다립니다. 승인하기 전에는 요금이 발생하지 않습니다.
claude mcp add spicyapi -e SPICY_API_KEY=$SPICY_API_KEY \
-- npx --yes --package=@spicyapi/mcp spicyapi-mcp
npx skills add spicyapi-ai/spicy-skill첫 줄은 도구를, 둘째 줄은 Skill을 넘겨줍니다. Skill은 그 도구를 다루는 규칙입니다 — 청구 전에 견적을 받고, 로컬 파일은 바이트를 붙여 넣는 대신 업로드하고, 완성된 산출물 URL을 추측하지 않고 읽습니다. 다른 클라이언트도 각자의 설정 파일로 같은 서버를 사용합니다. 개발자 페이지를 참고하세요.
npx @spicyapi/cli tasks create --model xai/grok-tts/text-to-speech \
--input-json '{"text":"Welcome back. Your files finished rendering a minute ago and are ready to download.","bitrate":128000,"language":"auto","voice_id":"eve","sample_rate":24000,"output_format":"mp3"}' \
--wait입력값은 위 예시와 마찬가지로 이 엔드포인트의 스키마에서 생성했습니다. --wait는 작업이 끝날 때까지 폴링해 결과를 출력하고, CI에서는 --yes로 확인 절차를 건너뜁니다. 먼저 SPICY_API_KEY를 설정하세요. API와 CLI, MCP 서버가 같은 키를 씁니다.
npx @spicyapi/cli tasks create --model xai/grok-tts/text-to-speech \
--input-json '{…}' --retention 1h --wait
npx @spicyapi/cli tasks get $TASK_ID # read back the retention that applied--retention은 보관 기간을 줄이기만 합니다 — 30m, 1h, 7d, 또는 0이면 작업이 종료 상태에 도달하는 즉시 삭제됩니다. 실제로 적용되는 값은 요청과 계정 설정, 플랫폼 상한 중 가장 짧은 값이므로 요청한 숫자가 그대로 반영됐다고 가정하지 말고 작업 레코드에서 다시 읽으세요. 계정이 허용하는 것보다 긴 값을 넘기면 아무 일도 일어나지 않습니다.
ComfyUI Manager나 아래 명령으로 SpicyAPI 노드를 설치한 뒤 캔버스에서 Grok TTS · Text to Speech를 검색하세요. 노드는 이 페이지와 같은 옵션을 제공하며, 실행하기 전에 가격을 보여 줍니다.
cd ComfyUI/custom_nodes
git clone https://github.com/spicyapi-ai/comfyui-spicyapi삽입된 패널은 이 페이지와 같은 스키마를 참조하므로 API 사양과 어긋나지 않습니다. 문서 검색 대상에 포함하려면 /api/embed/models/의 JSON을 받아 직접 렌더링하세요.
<iframe src="https://spicyapi.ai/embed/ko/models/grok-tts/api?model=xai%2Fgrok-tts%2Ftext-to-speech" width="100%" height="560" loading="lazy" title="요청 예시" style="border:1px solid rgba(0,0,0,.12)"></iframe>