inference-providers

Grok 4.7

by xai · family grok

Facts

Release date2026-09-21
Retired date—
Knowledge cutoff—
Context (max)500,000
Max output450,000
Modalitiestext, image → text
Aliasesgrok-4.7
Open weightsno
DescriptionxAI's flagship (Sep 21, 2026), succeeding Grok 4.6: 500K context with up to 450K output, strong at long-running software engineering with self-verification. $1.60/$4.80 per Mtok on OpenRouter (xAI list $2/$6 up to 200K, $4/$12 above); reasoning_effort control per the 4.5+ line.

Unknown values are shown as —.

Offerings

ProviderWire IDVariantEndpointProtocolStatusPrice (USD / Mtok)Reasoning
NEAR AI Cloudx-ai/grok-4.7chatopenai-chatga2.00 / 6.00effort · default on · returns reasoning_content
OpenCode Gogrok-4.7go-chat-completionsopenai-chatga—effort · default on · returns reasoning_content · round-trips reasoning_content
OpenCode Zengrok-4.7responsesopenai-responsesga2.00 / 6.00effort · default on · returns reasoning_summary · round-trips encrypted_content
OpenRouterx-ai/grok-4.7chat-completionsopenai-chatga1.60 / 4.80effort · default on · returns reasoning_content · round-trips reasoning_content

Reasoning controls

NEAR AI Cloud· x-ai/grok-4.7· chat effort

reasoning_effort low●mediumhighxhigh

effort · default on · returns reasoning_content

OpenCode Go· grok-4.7· go-chat-completions effort

reasoning.effort low●mediumhighxhigh

effort · default on · returns reasoning_content · round-trips reasoning_content

OpenCode Zen· grok-4.7· responses effort

reasoning.effort low●mediumhighxhigh

effort · default on · returns reasoning_summary · round-trips encrypted_content

Incompatible with: temperature, top_p

OpenRouter· x-ai/grok-4.7· chat-completions effort

reasoning.effort low●mediumhighxhigh

effort · default on · returns reasoning_content · round-trips reasoning_content

Example requests

NEAR AI Cloud · openai-chat · x-ai/grok-4.7

curl 'https://cloud-api.near.ai/v1/chat/completions' \
  -H 'Authorization: Bearer <YOUR_API_KEY>' \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "x-ai/grok-4.7",
  "messages": [
    {
      "role": "user",
      "content": "Tell me about the weather."
    }
  ],
  "reasoning_effort": "low"
}'
Python (requests)
import requests

resp = requests.post(
    "https://cloud-api.near.ai/v1/chat/completions",
    headers={
      "Authorization": "Bearer <YOUR_API_KEY>",
      "Content-Type": "application/json"
    },
    json={
      "model": "x-ai/grok-4.7",
      "messages": [
        {
          "role": "user",
          "content": "Tell me about the weather."
        }
      ],
      "reasoning_effort": "low"
    },
)
print(resp.json())
TypeScript (fetch)
const resp = await fetch("https://cloud-api.near.ai/v1/chat/completions", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <YOUR_API_KEY>",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "model": "x-ai/grok-4.7",
    "messages": [
      {
        "role": "user",
        "content": "Tell me about the weather."
      }
    ],
    "reasoning_effort": "low"
  }),
})
console.log(await resp.json())

OpenCode Go · openai-chat · grok-4.7

curl 'https://opencode.ai/zen/go/v1/chat/completions' \
  -H 'Authorization: Bearer <YOUR_API_KEY>' \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "grok-4.7",
  "messages": [
    {
      "role": "user",
      "content": "Tell me about the weather."
    }
  ],
  "reasoning": {
    "effort": "low"
  }
}'
Python (requests)
import requests

resp = requests.post(
    "https://opencode.ai/zen/go/v1/chat/completions",
    headers={
      "Authorization": "Bearer <YOUR_API_KEY>",
      "Content-Type": "application/json"
    },
    json={
      "model": "grok-4.7",
      "messages": [
        {
          "role": "user",
          "content": "Tell me about the weather."
        }
      ],
      "reasoning": {
        "effort": "low"
      }
    },
)
print(resp.json())
TypeScript (fetch)
const resp = await fetch("https://opencode.ai/zen/go/v1/chat/completions", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <YOUR_API_KEY>",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "model": "grok-4.7",
    "messages": [
      {
        "role": "user",
        "content": "Tell me about the weather."
      }
    ],
    "reasoning": {
      "effort": "low"
    }
  }),
})
console.log(await resp.json())
  • ⚠ Responses include reasoning_content artifacts — pass them back unmodified on subsequent turns (dropping them triggers 400s or quality loss).

OpenCode Zen · openai-responses · grok-4.7

curl 'https://opencode.ai/zen/v1/responses' \
  -H 'Authorization: Bearer <YOUR_API_KEY>' \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "grok-4.7",
  "input": "Tell me about the weather.",
  "reasoning": {
    "effort": "low"
  }
}'
Python (requests)
import requests

resp = requests.post(
    "https://opencode.ai/zen/v1/responses",
    headers={
      "Authorization": "Bearer <YOUR_API_KEY>",
      "Content-Type": "application/json"
    },
    json={
      "model": "grok-4.7",
      "input": "Tell me about the weather.",
      "reasoning": {
        "effort": "low"
      }
    },
)
print(resp.json())
TypeScript (fetch)
const resp = await fetch("https://opencode.ai/zen/v1/responses", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <YOUR_API_KEY>",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "model": "grok-4.7",
    "input": "Tell me about the weather.",
    "reasoning": {
      "effort": "low"
    }
  }),
})
console.log(await resp.json())
  • ⚠ Responses include encrypted_content artifacts — pass them back unmodified on subsequent turns (dropping them triggers 400s or quality loss).
  • Reported incompatible with thinking controls: temperature, top_p.

OpenRouter · openai-chat · x-ai/grok-4.7

curl 'https://openrouter.ai/api/v1/chat/completions' \
  -H 'Authorization: Bearer <YOUR_API_KEY>' \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "x-ai/grok-4.7",
  "messages": [
    {
      "role": "user",
      "content": "Tell me about the weather."
    }
  ],
  "reasoning": {
    "effort": "low"
  }
}'
Python (requests)
import requests

resp = requests.post(
    "https://openrouter.ai/api/v1/chat/completions",
    headers={
      "Authorization": "Bearer <YOUR_API_KEY>",
      "Content-Type": "application/json"
    },
    json={
      "model": "x-ai/grok-4.7",
      "messages": [
        {
          "role": "user",
          "content": "Tell me about the weather."
        }
      ],
      "reasoning": {
        "effort": "low"
      }
    },
)
print(resp.json())
TypeScript (fetch)
const resp = await fetch("https://openrouter.ai/api/v1/chat/completions", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <YOUR_API_KEY>",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "model": "x-ai/grok-4.7",
    "messages": [
      {
        "role": "user",
        "content": "Tell me about the weather."
      }
    ],
    "reasoning": {
      "effort": "low"
    }
  }),
})
console.log(await resp.json())
  • ⚠ Responses include reasoning_content artifacts — pass them back unmodified on subsequent turns (dropping them triggers 400s or quality loss).