模型市场
xAI

Grok Chat Fast

语言模型128K 上下文工具调用
输入$0.20每 1M tokens
输出$0.80每 1M tokens
官方价待确认 / 待确认输入 / 输出 · OpenRouter 公开目录价
1 个渠道

模型介绍

Grok 网页版快速对话,支持函数工具调用

请求参数

对话 · POST /v1/chat/completions

参数取值默认说明
model必填模型 ID—即本页模型 ID
messages消息数组—对话消息,role 为 system、user、assistant 或 tool
n整数,固定为 1—只能为 1
streamtrue / false—以 SSE 流式返回
stream_options对象—仅支持 include_usage
tools函数工具数组—函数工具,type 为 function
tool_choice对象—auto、none、required 或指定函数
parallel_tool_callstrue / false—是否允许并行调用工具
response_format对象—只支持 {"type":"text"}
frequency_penalty不生效数字,-2 到 2—接受;Web 模型不使用
max_completion_tokens不生效整数,1 到 32768—接受;Web 模型由上游决定输出长度
max_tokens不生效整数,1 到 32768—接受;Web 模型由上游决定输出长度
metadata不生效对象—接受;不影响结果
presence_penalty不生效数字,-2 到 2—接受;Web 模型不使用
seed不生效整数,-9007199254740991 到 9007199254740991—接受;Web 模型不使用
store不生效true / false—接受;不影响结果
temperature不生效数字,0 到 2—接受;Web 模型不使用
top_p不生效数字,0 到 1—接受;Web 模型不使用
user不生效字符串,1–256 字符—接受;不影响结果

消息内容支持:text。

列表之外的参数会返回 HTTP 400,并在错误信息里写明字段名和支持的参数。标注“不生效”的参数可以传,但 Web 模型不会使用。

快速调用

quickstart.py
from openai import OpenAI

client = OpenAI(api_key="$TPOOL_API_KEY", base_url="https://tpool.dev/v1")

reply = client.chat.completions.create(
    model="x-ai/grok-chat-fast",
    messages=[{"role": "user", "content": "Hello"}],
)
print(reply.choices[0].message.content)