开始使用 SpaceXAI

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

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]}"
  }'

模型

Grok 4.5

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

Context
500k tokens
Input
$2.00 / 1M tokens
Output
$6.00 / 1M tokens
Reasoning
可配置

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

立即开始

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

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)

Responses API

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


  • Agentic coding
  • IDE 与工具集成
  • Early access
  • $2.00 / 1M input tokens
  • $6.00 / 1M output tokens