Grok

xAI: Grok 4.7Chat

x-ai/grok-4.7

Grok 4.7 accepts text and images and produces text within a 500,000-token context window. It supports function calling, structured outputs, and configurable reasoning with low, medium, high, and xhigh effort levels; high is the default. Its HaoAI model ID is `x-ai/grok-4.7`.

500K context window
33K max output tokens
Released: 2026-09-21
Protocols:SpaceXAI
Capabilities:VisionFunction CallingReasoningPrompt Caching

Capabilities

  • Text and visionGenerate text answers using text and image inputs.
  • Functions and structured outputsIntegrate tool calls and structured results into applications and agent workflows.
  • Configurable reasoningChoose low, medium, high, or xhigh reasoning effort; high is the default.
  • Long contextWork with long documents and multi-turn tasks in a 500,000-token context window.

Pricing

PriceRate 0.15x
HaoAI
Official
Input
$0.3/M
$2/M
Output
$0.9/M
$6/M
Cache read
$0.075/M
$0.5/M

Code Examples

from openai import OpenAI

client = OpenAI(
    base_url="https://api.hao.ai/x-ai/v1",
    api_key="YOUR_HAOAI_API_KEY",
)

response = client.chat.completions.create(
    model="x-ai/grok-4.7",
    messages=[
        {"role": "user", "content": "Hello!"}
    ],
)

print(response.choices[0].message.content)

Frequently asked questions

Input, cached input, and output tokens are priced separately. When the prompt reaches 200,000 tokens, all three token rates double for the whole request. Consult the model pricing table for current rates.