ข้ามไปยังเนื้อหา

xAI Text to Speech

ผสานการทำงาน

ID โมเดล xai/tts/v1
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.com/v1/run/xai/tts/v1?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Hello from Doitong. This is a short test sentence."
  }'

# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.com/v1/requests/REQUEST_ID?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY"

คำขอนี้: $0.001 1 เครดิต API เรียกใช้ในหน้านี้

รับคีย์ API

แปลงข้อความเป็นเสียงพูดด้วยเสียงในตัว การเลือกภาษา และแท็กเสียงแสดงอารมณ์แบบแทรกในข้อความ

xAI · เสียง

ผลลัพธ์แรกของคุณจะแสดงที่นี่

สร้างคำขอด้านล่างและเรียกใช้ด้วยคีย์ API ของคุณ เอาต์พุตจะถูกคัดลอกไปยังพื้นที่จัดเก็บของเรา และเก็บไว้ตลอดไปหรือฟรี 7 วัน

สร้างคำขอ

ตัวควบคุมสร้างจากสคีมาของโมเดล โค้ดและราคาจะอัปเดตเมื่อคุณเปลี่ยนค่า

•จำเป็น 50 / 15000

ข้อความสำหรับการสังเคราะห์เสียง โดยควบคุมการถ่ายทอดอารมณ์ผ่านแท็กแบบอินไลน์ ([laugh], [pause], [sigh]) หรือแท็กครอบ (<whisper>text</whisper>, <slow>text</slow>) อินพุตต้องมีความยาวไม่เกิน 15,000 อักขระ

ขั้นสูง voice · language · enable_safety_checker · output_format
ค่าเริ่มต้น eve

เสียงในระบบที่เลือกใช้สำหรับการสังเคราะห์เสียง

ค่าเริ่มต้น auto

การเลือกภาษาจากรหัส BCP-47 เหล่านี้: en, zh, fr, de, hi, id, it, ja, ko, pt-BR, pt-PT, ru, es-MX, es-ES, tr, vi, bn, ar-EG, ar-SA, ar-AE หากต้องการตรวจหาโดยอัตโนมัติ ให้ระบุ 'auto'

การกำหนดค่ารูปแบบเสียงที่สร้างขึ้น โดยค่าเริ่มต้นคือ MP3 ที่อัตราการสุ่มตัวอย่าง 24 kHz และบิตเรต 128 kbps

POST /run/xai/tts/v1?wait=20 ใบเสนอราคา → $0.001
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.com/v1/run/xai/tts/v1?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Hello from Doitong. This is a short test sentence."
  }'

# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.com/v1/requests/REQUEST_ID?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY"

เรียกใช้คำขอนี้

คีย์ของคุณจะอยู่ในเบราว์เซอร์นี้ โดยส่งไปยัง Doitong API เท่านั้น และจะบันทึกใน localStorage ก็ต่อเมื่อคุณเลือกจดจำ รับคีย์ API

เกี่ยวกับ xAI Text to Speech

แปลงข้อความความยาวสูงสุด 15,000 อักขระเป็นเสียงพูด เลือกจากเสียงในตัว 28 เสียง พร้อมรหัสภาษาหรือการตรวจจับอัตโนมัติ ข้อความสามารถมีแท็กอย่าง [laugh], [pause] และ [sigh] หรือแท็กครอบ เช่น <whisper> และ <slow> เพื่อการอ่านที่สื่ออารมณ์ `output_format` ใช้กำหนดไฟล์เสียง

พารามิเตอร์

ชื่อประเภท ค่าเริ่มต้นค่าที่อนุญาต คำอธิบาย
textจำเป็น
ประเภทstring
≤ 15,000 อักขระ
ข้อความสำหรับการสังเคราะห์เสียง โดยควบคุมการถ่ายทอดอารมณ์ผ่านแท็กแบบอินไลน์ ([laugh], [pause], [sigh]) หรือแท็กครอบ (<whisper>text</whisper>, <slow>text</slow>) อินพุตต้องมีความยาวไม่เกิน 15,000 อักขระ
voiceไม่บังคับ
ประเภทenum
ค่าเริ่มต้นeve
carinazaganhelixorionlunairisaltairzenithperseusheliosluxkeplerrigelcosmocelesteursa
เพิ่มเติมอีก 12 ค่าsiriuslumencastornakshatlasauroralioraaraeveleorexsal
เสียงในระบบที่เลือกใช้สำหรับการสังเคราะห์เสียง
languageไม่บังคับ
ประเภทenum
ค่าเริ่มต้นauto
autoenar-EGar-SAar-AEbnzhfrdehiiditjakopt-BRpt-PT
เพิ่มเติมอีก 5 ค่าrues-MXes-EStrvi
การเลือกภาษาจากรหัส BCP-47 เหล่านี้: en, zh, fr, de, hi, id, it, ja, ko, pt-BR, pt-PT, ru, es-MX, es-ES, tr, vi, bn, ar-EG, ar-SA, ar-AE หากต้องการตรวจหาโดยอัตโนมัติ ให้ระบุ 'auto'
output_formatไม่บังคับ
ประเภทobject
การกำหนดค่ารูปแบบเสียงที่สร้างขึ้น โดยค่าเริ่มต้นคือ MP3 ที่อัตราการสุ่มตัวอย่าง 24 kHz และบิตเรต 128 kbps
output_format.codecไม่บังคับ
ประเภทenum
ค่าเริ่มต้นmp3
mp3wavpcmmulawalaw
ตัวแปลงสัญญาณสำหรับการเข้ารหัสเสียง ตัวเลือกที่ใช้ได้คือ mp3, wav, pcm, mulaw, alaw
output_format.sample_rateไม่บังคับ
ประเภทenum
ค่าเริ่มต้น24000
80001600022050240004410048000
ความถี่การสุ่มตัวอย่างเสียง มีหน่วยเป็น Hz
output_format.bit_rateไม่บังคับ
ประเภทenum
320006400096000128000192000
บิตเรตสำหรับเอาต์พุต MP3 ค่าเริ่มต้นคือ 128000 และมีหน่วยเป็น bps ไม่ใช้กับตัวแปลงสัญญาณอื่น
enable_safety_checkerไม่บังคับ
ประเภทboolean
ค่าเริ่มต้นtrue
สามารถผ่อนปรนการคัดกรองได้โดยตั้งค่าเป็น false หากผู้เรียกมีสิทธิ์
จำเป็น

เอาต์พุต

GET /requests/req_8k2m4q7x1z9c3v5b6n0p2r4t
{
  "id": "req_8k2m4q7x1z9c3v5b6n0p2r4t",
  "object": "request",
  "model": "xai/tts/v1",
  "status": "succeeded",
  "created_at": "2026-10-20T12:00:00Z",
  "started_at": "2026-10-20T12:00:02Z",
  "completed_at": "2026-10-20T12:00:09Z",
  "queue_position": null,
  "cost": {
    "credits": 1,
    "usd": "0.001",
    "charged": 1,
    "refunded": 0
  },
  "input": {
    "text": "Hello from Doitong. This is a short test sentence."
  },
  "output": {
    "audio": {
      "url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.mp3",
      "content_type": "audio/mpeg",
      "file_name": "0-output.mp3",
      "file_size": 1843200
    }
  },
  "outputs": [
    {
      "type": "audio",
      "url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.mp3",
      "content_type": "audio/mpeg",
      "file_size": 1843200,
      "duration": 12,
      "stored": true
    }
  ],
  "error": null,
  "metrics": {
    "inference_seconds": 6.8
  },
  "urls": {
    "self": "https://api.doitong.com/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t",
    "cancel": "https://api.doitong.com/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t/cancel"
  }
}
ไฟล์ของคุณ คุณเลือกเองทุก outputs[].url คือสำเนาบนพื้นที่จัดเก็บของเรา: เก็บไว้ตลอดไป (คิดค่าบริการต่อ GB-เดือน) หรือฟรี 7 วัน โดยกำหนดได้ในการตั้งค่าบัญชีหรือ ?storage=
รูปแบบเดียวกันในทุกโมเดลtype, url, content_type, width, height และ duration สำหรับภาพ วิดีโอ และเสียงเหมือนกันทั้งหมด ส่วน output คือออบเจ็กต์ผลลัพธ์ของโมเดลเอง
ฟิลด์ของเอาต์พุต
audio
object {url, content_type, file_name, file_size}ไฟล์เสียงที่สร้างขึ้น

สำหรับเอเจนต์ AI: หน้า Markdown นี้อยู่ที่ https://doitong.com/th/developers/models/xai/tts/v1.md. โมเดลและคู่มือทั้งหมด: https://doitong.com/developers/llms.txt