Voice API
实时对话、speech-to-text 和 text-to-speech。
- Agent
- Starting at $0.05 / min
- TTS
- $15.00 / 1M chars
- STT (Batch)
- $0.10 / hour
- STT (Streaming)
- $0.20 / hour
覆盖代码、文本、语音、图像和视频的智能、快速且高性价比模型。
curl https://api.x.ai/v1/responses \
-H "Authorization: Bearer $XAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-4.5",
"input": "Fix this function and explain the bug: function median(a){a.sort();return a[a.length/2]}"
}'面向代码及其他各种任务的旗舰模型:支持 Agent 工具调用、极低幻觉与可配置推理。
实时对话、speech-to-text 和 text-to-speech。
通过图像和视频生成,将创意变为现实。
在下方试用代码、文本、语音、图像和视频模型
import os
from xai_sdk import Client
from xai_sdk.chat import user
client = Client(api_key=os.getenv("XAI_API_KEY"))
chat = client.chat.create(model="grok-4.5")
chat.append(user("Fix this function and explain the bug: function median(a){a.sort();return a[a.length/2]}"))
print(chat.sample().content)通过 API 使用 Grok Build,在你自己的工具中重构、调试和构建。