Grok

Grok 4

xAIToken-based
Alias:grok-4
Create API Key

Compare grok-4 API pricing, supported endpoints, capabilities and access options on Modelsell.

text
Starting price
Input / Output · 1M
Context
—
Maximum input window
Modalities
→

Pricing by Supplier

xAI
-40%
xAI 官方
Input$3.3$1.98/ 1M
Output$16.5$9.9/ 1M
Cache Read$0.825$0.495/ 1M

Capabilities / Supported modalities

StreamingSystem promptFunction callingToolsJSON modeStructured outputPrompt caching
Input
Output

Provider & data privacy

Provider
xAIDocs
Tokenizer
Grok tokenizer (BPE)
License
Proprietary (commercial)Proprietary
Data retention4 daysNot used for upstream training by default

Performance

Benchmarks

Scores on standardized evaluations. Higher percentages are better — and rank percentile shows

Metrics sourced fromArtificial Analysis 2026-09-30·Grok 4

This model is not included in the current benchmark snapshot.

Missing models or measurements are not zero scores.

Benchmark charts preserve the source model selection and reasoning settings. Missing models or measurements are not zero scores, and benchmark cost or speed is not this site’s service commitment.

About Grok 4

为复杂问题整理证据与方案

Grok 4 可以处理多步推理、数学问题和代码分析,也适合把分散的文字材料整理成有依据的判断。例如比较两种系统架构的取舍,检查实验方案是否遗漏变量,或从需求、接口说明与故障记录中找出彼此冲突的条件。提问时给出目标、约束和可接受的结果,让模型围绕具体问题展开分析。

对于结论尚不确定的任务,可以要求它分别列出支持证据、反例和仍待确认的假设。需要比较方案时,先定义评价维度,如改动范围、维护成本或失败后的恢复方式,再让它说明每项判断对应哪段材料。这样更容易发现结论是来自证据,还是依赖了额外假设。

如何结合工具完成研究?

Grok 4 具备工具使用能力。接入并启用相应工具后,可以通过检索补充信息,或利用代码执行验证计算。工具需要由当前应用提供并允许使用;单纯发送文字请求,不代表已经搜索网页、查询 X 或运行程序。审阅结果时,检查实际检索到的页面、时间和执行输出。

怎样让代码与计算结果更容易核验?

提供最小可复现输入,并要求给出验证步骤。计算任务保留单位和中间公式,工程问题保留关键代码、环境与日志。把执行后的错误反馈给模型,再继续调整,比一次要求完整解决所有问题更容易控制质量。

Grok 4 属于较早一代模型。xAI 官方已将其基础版本 grok-4-0709 纳入退役重定向;复现历史结果或比较模型时,应同时确认当前渠道实际返回的模型,避免把请求名称当作固定版本保证。

Use cases and prompting

例如准备重构缓存模块,可以输入:

“下面是现有缓存逻辑、两次故障记录和新需求。请先指出相互冲突的条件,再比较本地缓存与 Redis 两种方案。按一致性、故障恢复和改动范围列出依据,最后给出最小验证实验。没有证据支持的结论请列为假设。材料:{代码与日志}。”

先确认问题和评价标准,再让它细化选定方案。需要实时资料时,在应用中启用检索工具并限定日期范围;需要验证性能时,实际运行基准测试,将测量结果回传,继续修正分析。

API access

API documentation

Code samples

RequestPOST/v1/chat/completions
Example request
Parameters
ParameterTypeDefault / rangeDescription
temperature
number
=10 ~ 2
Sampling temperature; lower is more deterministic
top_p
number
=10 ~ 1
Nucleus sampling probability mass
max_tokens
integer>= 1Maximum number of tokens in the response
frequency_penalty
number
=0-2 ~ 2
Penalises repetition of frequent tokens
presence_penalty
number
=0-2 ~ 2
Encourages introducing new topics
stop
array—Up to 4 strings that stop generation
seed
integer—Deterministic sampling seed (best-effort)
n
integer
=1>= 1
Number of completions to generate
stream
boolean
=false
Stream tokens via Server-Sent Events
response_format
object—Force JSON object or schema-conforming output
tools
array—Tool / function declarations the model may call
tool_choice
string
autononerequired
Tool-choice policy or specific tool name
logprobs
boolean
=false
Return per-token log probabilities
top_logprobs
integer0 ~ 20Number of top log probabilities returned per token
logit_bias
object—Per-token logit bias map
user
string—End-user identifier for abuse monitoring

Replace <YOUR_API_KEY> with the API key from your token settings.

Authentication

All requests must include Authorization: Bearer <TOKEN> header. Anthropic-formatted endpoints accept the x-api-key header instead.

Generate tokens from the Tokens page; you can scope them to specific models, groups, IPs, and rate-limits.

Supported parameters

Generation parameters
ParameterTypeDefault / rangeDescription
temperature
number
=10 ~ 2
Sampling temperature; lower is more deterministic
top_p
number
=10 ~ 1
Nucleus sampling probability mass
max_tokens
integer>= 1Maximum number of tokens in the response
frequency_penalty
number
=0-2 ~ 2
Penalises repetition of frequent tokens
presence_penalty
number
=0-2 ~ 2
Encourages introducing new topics
stop
array—Up to 4 strings that stop generation
seed
integer—Deterministic sampling seed (best-effort)
n
integer
=1>= 1
Number of completions to generate
stream
boolean
=false
Stream tokens via Server-Sent Events
response_format
object—Force JSON object or schema-conforming output
tools
array—Tool / function declarations the model may call
tool_choice
string
autononerequired
Tool-choice policy or specific tool name
logprobs
boolean
=false
Return per-token log probabilities
top_logprobs
integer0 ~ 20Number of top log probabilities returned per token
logit_bias
object—Per-token logit bias map
user
string—End-user identifier for abuse monitoring

Rate limits

SupplierRPMTPMRPD
xAIUnlimitedUnlimitedUnlimited

No restriction

Frequently asked questions about grok-4

What is grok-4?

Compare grok-4 API pricing, supported endpoints, capabilities and access options on Modelsell.

How do I call grok-4?

Create an API key with access to grok-4, then use the exact model ID and a supported endpoint from the API access section. Request fields depend on the selected endpoint.

How is grok-4 priced?

Pricing depends on the selected provider group and the model billing unit. The current input, output, request, or media prices are shown on this page before sign-up.

How should I evaluate grok-4 for my project?

Start with the use cases and prompting guidance on this page, then evaluate the model with representative inputs from your project.