xAI: Grok 4
x-ai/grok-4
Grok 4 is xAI's latest reasoning model with a 256k context window. It supports parallel tool calling, structured outputs, and both image and text inputs. Note that reasoning is not exposed, reasoning cannot be disabled, and the reasoning effort cannot be specified. Pricing increases once the total tokens in a given request is greater than 128k tokens. See more details on the [xAI docs](https://docs.x.ai/docs/models/grok-4-0709)
Byx-aiInput typeOutput type
Recent activity on Grok 4
Tokens processed per day
Thoughput
(tokens/s)
ProvidersMin (tokens/s)Max (tokens/s)Avg (tokens/s)
OpenAIChatCompletionAdapter0.210.620.27
First Token Latency
(ms)
ProvidersMin (ms)Max (ms)Avg (ms)
OpenAIChatCompletionAdapter148319531725.57
Providers for Grok 4
ZenMux Provider to the best providers that are able to handle your prompt size and parameters, with fallbacks to maximize uptime.
Latency
1.71
s
Throughput
0.26
tps
Uptime
100.00
%
Recent uptime
Oct 10,2025 - 3 PM100.00%
Price
Tiered pricing
0 <= Input < 128k
Input
$ 3
/ M tokens
Output
$ 15
/ M tokens
Cache read
$ 0.75
/ M tokens
Cache write 5m
-
Cache write 1h
-
Cache write
-
Web search
$ 0.025
/ request
Model limitation
Context
256.00K
Max output
256.00K
Supported Parameters
max_completion_tokens
temperature
top_p
frequency_penalty
-
presence_penalty
seed
logit_bias
-
logprobs
top_logprobs
-
response_format
stop
-
tools
tool_choice
parallel_tool_calls
Model Protocol Compatibility
openai
anthropic
-
Data policy
Prompt training
false
Prompt Logging
Zero retention
Moderation
Responsibility of developer
Sample code and API for Grok 4
ZenMux normalizes requests and responses across providers for you.
OpenAI-PythonPythonTypeScriptOpenAI-TypeScriptcURL
python
from openai import OpenAI

client = OpenAI(
  base_url="https://zenmux.ai/api/v1",
  api_key="<ZenMux_API_KEY>",
)

completion = client.chat.completions.create(
  model="x-ai/grok-4",
  messages=[
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "What is in this image?"
        }
      ]
    }
  ]
)
print(completion.choices[0].message.content)