开始使用 SpaceXAI

覆盖代码、文本、语音、图像和视频的智能、快速且高性价比模型。

curl https://api.x.ai/v1/responses \
  -H "Authorization: Bearer $XAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "grok-4.7",
    "input": "Fix this function and explain the bug: function median(a){a.sort();return a[a.length/2]}"
  }'

模型

Grok 4.7

面向代码及多种其他任务的旗舰模型:支持代理式工具调用、极低幻觉率与可配置推理。

上下文窗口
500k tokens
输入
$2.00 / 1M tokens
输出
$6.00 / 1M tokens

Voice API

实时对话、语音转文本和文本转语音。

Agent
$0.08 / min
TTS
$15.00 / 1M chars
STT (Batch)
$0.10 / hour
STT (Streaming)
$0.20 / hour

立即开始

在下方试用代码、文本、语音、图像和视频模型

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.7")
chat.append(user("Fix this function and explain the bug: function median(a){a.sort();return a[a.length/2]}"))

print(chat.sample().content)

Responses API

通过 API 使用 Grok Build,在自己的工具中重构、调试和构建。


  • 代理式编程
  • IDE 与工具集成
  • 抢先体验
  • $2.00 / 1M input tokens
  • $6.00 / 1M output tokens