Grok API
  1. Guides
Grok API
  • Getting started
    • Introduction
    • Models and Pricing
    • Billing
    • Consumption and Rate Limits
    • Usage Explorer
    • Free Credits
  • Guides
    • Asynchronous Requests
    • Image Understanding
    • Structured Outputs
    • Migration from Other Providers
    • Chat
      POST
    • Reasoning
      POST
    • Streaming Response
      POST
    • Deferred Chat Completions
      POST
    • Image Generations
      POST
    • Fingerprint
      POST
  1. Guides

Reasoning

POST
https://api.x.ai/v1/chat/completions
Grok 3 Mini is a lightweight, smaller thinking model. Unlike traditional models that generate answers immediately, Grok 3 Mini thinks before responding. It’s ideal for reasoning-heavy tasks that don’t demand extensive domain knowledge, and shines in math-specific and quantitative use cases, such as solving challenging puzzles or math problems.
Reasoning is only supported by grok-3-mini-beta and grok-3-mini-fast-beta.
The Grok 3 models grok-3-beta and grok-3-fast-beta do not support reasoning.

Key Features#

Think Before Responding: Thinks through problems step-by-step before delivering an answer.
Math & Quantitative Strength: Excels at numerical challenges and logic puzzles.
Reasoning Trace: The model's thoughts are available via the reasoning_content field in the response completion object (see example below).
You can access the model's raw thinking trace via the message.reasoning_content of the chat completion response.

Control how hard the model thinks#

The reasoning_effort parameter controls how much time the model spends thinking before responding. It must be set to one of these values:
low: Minimal thinking time, using fewer tokens for quick responses.
high: Maximum thinking time, leveraging more tokens for complex problems.
Choosing the right level depends on your task: use low for simple queries that should complete quickly, and high for harder problems where response latency is less important.

Usage Example#

Here’s a simple example using Grok 3 Mini to multiply 101 by 3. Notice that we can access both the reasoning content and final response.

Sample Output#

Let me calculate 101 multiplied by 3:
101 * 3 = 303.
I can double-check that: 100 * 3 is 300, and 1 * 3 is 3, so 300 + 3 = 303. Yes, that's correct.

Final Response:
The result of 101 multiplied by 3 is 303.

Number of completion tokens (input):
14

Number of reasoning tokens (input):
310

When to Use Reasoning#

Use grok-3-mini-beta or grok-3-mini-fast-beta: For tasks that can benefit from logical reasoning (such as meeting scheduling or math problems). Also great for tasks that don't require deep domain knowledge about a specific subject (eg basic customer support bot).
Use grok-3-beta or grok-3-fast-beta: For queries requiring deep domain expertise or world knowledge (eg healthcare, legal, finance).
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.x.ai/v1/chat/completions' \
--header 'Authorization: Bearer ' \
--header 'Content-Type: application/json' \
--data-raw '{
        "messages": [
            {
            "role": "system",
            "content": "You are a highly intelligent AI assistant."
            },
            {
            "role": "user",
            "content": "What is 101*3?"
            }
        ],
        "model": "grok-3-mini-latest",
        "stream": false,
        "temperature": 0.7,
        "reasoning_effort":"high"
    }'
Response Response Example
{}

Request

Header Params
Content-Type
string 
required
Example:
application/json
Authorization
string 
required
Example:
Bearer {{XAI_API_KEY}}
Body Params application/json
messages
array [object {2}] 
required
role
string 
required
content
string 
required
model
string 
required
stream
boolean 
required
temperature
number 
required
reasoning_effort
string 
required
Examples

Responses

🟢200Success
application/json
Body
object {0}
Modified at 2025-04-10 08:43:25
Previous
Chat
Next
Streaming Response
Built with