API / set-reasoning-effort

API

Set reasoning effort on grok-4.6

Set reasoning effort on grok-4.6

Pass reasoning.effort (Responses) or reasoning_effort (xAI SDK) on grok-4.6 and grok-4.5. Default is "high". Reasoning cannot be turned off on these models. Levels: low, medium, high, and on grok-4.6 also xhigh.

Effort levels

Setting Best for
low Latency-sensitive agents and simple tool calls
medium Complex analysis and long-context work
high (default) Hard math, multi-step logic, competition-style tasks
xhigh Maximum depth when answer quality beats latency (grok-4.6+)

On grok-4.5, "xhigh" is treated as "high". On grok-4.20-multi-agent, the same field controls agent count instead of reasoning depth.

Responses API

curl https://api.x.ai/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $XAI_API_KEY" \
  -m 3600 \
  -d '{
    "model": "grok-4.6",
    "reasoning": {"effort": "high"},
    "input": [
      {"role": "system", "content": "You are a highly intelligent AI assistant."},
      {"role": "user", "content": "Find all prime numbers p such that p^2 + 2 is also prime. Prove your answer."}
    ]
  }'
import os
import httpx
from openai import OpenAI

client = OpenAI(
    base_url="https://api.x.ai/v1",
    api_key=os.getenv("XAI_API_KEY"),
    timeout=httpx.Timeout(3600.0),
)

response = client.responses.create(
    model="grok-4.6",
    reasoning={"effort": "high"},
    input=[
        {"role": "system", "content": "You are a highly intelligent AI assistant."},
        {"role": "user", "content": "Find all prime numbers p such that p^2 + 2 is also prime. Prove your answer."},
    ],
)

message = next(item for item in response.output if item.type == "message")
text = next(c.text for c in message.content if c.type == "output_text")
print(text)

xAI SDK

import os
from xai_sdk import Client
from xai_sdk.chat import system, user

client = Client(api_key=os.getenv("XAI_API_KEY"), timeout=3600)

chat = client.chat.create(
    model="grok-4.6",
    reasoning_effort="high",
    messages=[system("You are a highly intelligent AI assistant.")],
)
chat.append(user("Find all prime numbers p such that p^2 + 2 is also prime. Prove your answer."))
print(chat.sample().content)

Encrypted reasoning and summaries

Pass include: ["reasoning.encrypted_content"] on Responses to get encrypted thinking you can send back for context. On grok-4.6, streamed reasoning_content / reasoning summary deltas show a summarized trace while the final answer streams.

Pitfalls

  • presencePenalty, frequencyPenalty, and stop error on reasoning models. Drop them.
  • Raise client timeouts. Deep reasoning can run long; docs examples use 3600 seconds.
  • Reasoning tokens still bill as usage. Pick low when latency and cost matter more than depth.
  • Console API credits are separate from SuperGrok's weekly pool on grok.com.