Grok 4.7 · configuration
公开 xAI API 的模型名是 grok-4.7;文档列出的推理档位为 Low、medium、high(默认)或 xhigh,输入价 $2.00 / 1M tokens,输出价 $6.00 / 1M tokens。Grok 4.7 Fast 被写成同一模型的更快部署,按标准 token 价格的两倍计费,并且只出现在 Cursor 与 Grok Build。
调用 Grok 4.7 时固定 {{MODEL_ID}}、{{REASONING_EFFORT}} 和 {{API_BASE}}。任务是 {{TASK}},只使用 {{TOOL_ALLOWLIST}},并用 {{ACCEPTANCE}} 验收。
运行前替换每个变量,并把实际取值写进验收记录。运行前仍需替换: {{MODEL_ID}}, {{REASONING_EFFORT}}, {{API_BASE}}, {{TASK}}, {{TOOL_ALLOWLIST}}, {{ACCEPTANCE}}
调用 Grok 4.7 时固定 {{MODEL_ID}}、{{REASONING_EFFORT}} 和 {{API_BASE}}。任务是 {{TASK}},只使用 {{TOOL_ALLOWLIST}},并用 {{ACCEPTANCE}} 验收。
公开 xAI API 的模型名是 grok-4.7;文档列出的推理档位为 Low、medium、high(默认)或 xhigh,输入价 $2.00 / 1M tokens,输出价 $6.00 / 1M tokens。Grok 4.7 Fast 被写成同一模型的更快部署,按标准 token 价格的两倍计费,并且只出现在 Cursor 与 Grok Build。
适合的任务:页面把 Grok 4.7 定位为 coding、agentic tasks 与 knowledge work。官方示例是找出并修复一段 median 函数里的 bug,再解释原因。模态为文本与图像输入、文本输出;列出的工具是 function calling、web search、X search、code execution。
不适合的任务:本页把 Grok 4.7 Fast 限定在 Cursor 与 Grok Build,并写明它不在公开 xAI API 上提供,也不包含在 Grok Build 的免费额度里。本页的模态说明只覆盖文本与图像输入、文本输出,没有给出图像生成、视频或语音的 grok-4.7 请求。本页没有 grok-4.6 的模型名或参数。
适用的模型版本:grok-4.7。Grok 4.7 Fast 在本页被描述为同一模型、更快基础设施,本页没有给出单独的 Fast 模型 ID。本页没有出现 grok-4.6。
适用的客户端、Agent 或 API:xAI API 的 Responses API 与 Chat Completions;美国区域端点 https://us.api.x.ai/v1;Grok Build(coding agent 的默认模型);Cursor(all plans);模型网关 OpenRouter、Vercel、Cloudflare。示例客户端是 xAI Python SDK、Vercel AI SDK 的 xai.responses('grok-4.7')、OpenAI SDK(baseURL 为 https://api.x.ai/v1)以及 curl。
推荐的推理档位和参数:一览表的 Reasoning 原文是 Low, medium, high (default), or xhigh。文末 Learn more 写的是 controlling reasoning_effort, including "xhigh"。默认档是 high。本页的四段请求示例都没有 reasoning_effort 字段。多轮对话方面,Responses API 建议设置 prompt_cache_key,Chat Completions 使用请求头 x-grok-conv-id。
本页公开的是接入配置和四段调用示例,没有另外给出可复用的完整提示词模板。示例里的用户输入是同一句:
Find and fix the bug, then explain it: function median(a){a.sort();return a[a.length/2]}Python(xAI SDK):
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("Find and fix the bug, then explain it: function median(a){a.sort();return a[a.length/2]}"))
response = chat.sample()
print(response.content)JavaScript(Vercel AI SDK):
import { xai } from '@ai-sdk/xai';
import { generateText } from 'ai';
const { text } = await generateText({
model: xai.responses('grok-4.7'),
prompt:
'Find and fix the bug, then explain it: function median(a){a.sort();return a[a.length/2]}',
});
console.log(text);JavaScript(OpenAI SDK):
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: process.env.XAI_API_KEY,
baseURL: 'https://api.x.ai/v1',
});
const response = await client.responses.create({
model: 'grok-4.7',
input: [
{
role: 'user',
content:
'Find and fix the bug, then explain it: function median(a){a.sort();return a[a.length/2]}',
},
],
});
console.log(response.output_text);Bash:
curl https://api.x.ai/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $XAI_API_KEY" \
-d '{
"model": "grok-4.7",
"input": "Find and fix the bug, then explain it: function median(a){a.sort();return a[a.length/2]}"
}'页面还点名了两个缓存相关字段,但没有给出带这些字段的完整请求体:Responses API 的 prompt_cache_key,以及 Chat Completions 上的请求头 x-grok-conv-id。Responses API 对 grok-4.7 的 POST /v1/responses 会返回 reasoning.encrypted_content,即使 include 没有列出它;下一轮要把 reasoning items 原样放回 input。本页没有展示这些 item 的字段结构。
本页没有发布逐步工作流。页面明确写出的配置动作是:
已有 API key 时,把模型名设为 grok-4.7。
新账号按页面指向的 Quickstart 创建账号并发出第一次请求。
多轮对话在 Responses API 设置 prompt_cache_key;Chat Completions 使用 x-grok-conv-id,让同一对话的请求落到同一台服务器。
使用 Responses API 做多轮时,把返回的 reasoning items 原样放进下一次请求的 input。
长 Agent 循环另外参考页面指向的 context compaction;工具密集任务参考 function calling。这两处本页只有链接,没有参数示例。
采集页面:https://docs.x.ai/developers/grok-4-7。同页 “View as Markdown” 指向 https://docs.x.ai/developers/grok-4-7.md,正文与页面内四段代码一致。页脚:Last updated: September 21, 2026。页面没有署名作者,也没有单独的首次发布日期。
At a glance 表:
| Property | Value |
|---|---|
| Model name | grok-4.7 |
| Context window | 500,000 tokens |
| Knowledge cutoff | May 2026 |
| Modalities | Text and image input; text output |
| Output limit | No text output limit |
| Input price | $2.00 / 1M tokens |
| Output price | $6.00 / 1M tokens |
| Reasoning | Low, medium, high (default), or xhigh |
| APIs | Responses API, Chat Completions |
| Tools | Function calling, web search, X search, code execution |
页面写明团队的 rate limits 与 live pricing 在 model detail page 和 Pricing 页,本页没有展开。
版本区分,均来自本页原文:
grok-4.7:四段示例和一览表使用的模型名。输入 $2.00 / 1M tokens,输出 $6.00 / 1M tokens。
Grok 4.7 Fast:原文为 “the same model served on faster infrastructure, billed at twice the standard token rates”。只在 Cursor 和 Grok Build 提供,不包含在 Grok Build 的免费额度中,也不在公开 xAI API 上提供。本页没有印出 Fast 的模型 ID,也没有印出两倍后的美元单价;具体费率指向 Pricing 页的锚点。
grok-4.6:本页全文未出现该模型名或对应参数。
其他本页写明的价格与端点:
美国区域端点 https://us.api.x.ai/v1,推理留在美国,token usage 加价 10%。本页没有把加价后的单价写成美元数字。
未设置 prompt_cache_key / x-grok-conv-id 时,原文说请求经常落到 cache-cold server,并按完整输入价计费。本页没有给出缓存命中折扣的数字。
Grok Build 把该模型作为 coding agent 的默认模型。Cursor 写的是 available on all plans。网关列出 OpenRouter、Vercel、Cloudflare。
本页没有样本量、基准分数、工具开关示例或独立测试结果。Knowledge cutoff “May 2026” 是模型属性,不是测评结论。
证据只覆盖 https://docs.x.ai/developers/grok-4-7 这一页。Pricing、model detail、Reasoning 参数说明、context compaction 与 function calling 都是外链,本笔记不把那些页面的内容当作已采集证据。
reasoning_effort 这个名字和 "xhigh" 只出现在 Learn more 的链接说明里;档位列表出现在一览表。本页没有展示设置该参数的请求字段,因此上面的可复制请求保持页面原样。
Grok 4.7 Fast 的 “两倍” 是相对标准 token 价格的倍率。本页没有 Fast 模型 ID,也没有 Fast 价目表。
10% 区域加价同样只给出比例。把 $2.00 或 $6.00 乘成新单价,不是本页印出的数字。
本页的配置对应 grok-4.7。Grok 4.7 Fast 的可用范围是 Cursor 与 Grok Build。grok-4.6 不在本页范围内。
示例请求没有工具参数、图像输入、prompt_cache_key 或 reasoning item。不能从这四段代码推断这些字段的完整写法。
作者未注明。日期只有页脚的 Last updated: September 21, 2026。
2026-09-22 用 Tabbit 打开 https://docs.x.ai/developers/grok-4-7。页面标题为 “Grok 4.7 | SpaceXAI Docs”,主标题为 “Grok 4.7”。代码区有 Python、JavaScript、JavaScript (OpenAI)、Bash 四个标签,四段 pre 均在页面 DOM 中。同页 Markdown 地址 https://docs.x.ai/developers/grok-4-7.md 返回 200,content-type 为 text/markdown,正文与可见页面一致。页脚原文为 “Last updated: September 21, 2026”。采集时页面可直接阅读,没有登录墙或验证码。
xAI 开发者文档(docs.x.ai;页面标题为 SpaceXAI Docs) · 原文日期: 未公开 · 编辑日期: 2026-09-22
阅读原始来源Grok 4.7
请在上方所列环境中运行本指南。下载不会自动传入模板,也不代表账户已开放该模型。