Home/Models/xAI/Grok 4
X

Grok 4

Input:$2.4/M
Output:$12/M
Context:256K
Max Output:256K
Grok 4 is an artificial intelligence model provided by XAI. Currently supports text modality, with vision, image generation, and other features coming soon. Possesses extremely powerful technical parameters and ecosystem capabilities: Context Window: Supports context processing of up to 256,000 tokens, leading mainstream models.
New
Commercial Use
Playground
Overview
Features
Pricing
API
Versions

Features

  • Generative Chatbot: Grok 4 continues xAI’s lineage of chat-based LLMs (Grok‑1 through Grok‑3), now integrated deep across Musk’s X platform, standalone web app, and mobile application.
  • Multimodality: In addition to text, Grok 4 introduces early support for vision inputs—paving the way for image understanding and generation. Primarily text, with upcoming support for vision and image generation
  • Expressive Voice Assistant: The “Eve” persona, introduced earlier, now benefits from its refined speech synthesis, offering singing and expressive dialogue.

Technical Architecture and Model Versions

  • Architecture: Grok 4 builds on a transformer-based backbone with significant architectural refinements geared toward logical consistency and context retention over extended dialogues.
  • Training Regimen: Trained on a bespoke corpus scraped from publicly available X posts, open web sources, and licensed datasets. xAI emphasizes data refinement to filter “garbage data” and mitigate bias.

Benchmark Performance

xAI highlights that Grok 4 outperforms most AI systems on key academic and coding benchmarks:

  • AIME: 98.8 (Advanced Intelligence Math Exam)
  • GPQA: 88 (Graduate-level Prompted QA)
  • SWE‑Bench: 75 (Software Engineering tasks)
  • Humanity Last Exam (HLE): 45% overall with advanced reasoning.
    In live demos, Elon Musk claimed Grok 4 is “smarter than almost all graduate students,” underscoring its leadership in multi-disciplinary performance .

Grok 4

How to access Grok 4 API

Step 1: Sign Up for API Key

Log in to cometapi.com. If you are not our user yet, please register first. Sign into your CometAPI console. Get the access credential API key of the interface. Click “Add Token” at the API token in the personal center, get the token key: sk-xxxxx and submit.

img

Step 2: Send Requests to Grok 4 API

Select the “\grok-4\” endpoint to send the API request and set the request body. The request method and request body are obtained from our website API doc. Our website also provides Apifox test for your convenience. Replace <YOUR_API_KEY> with your actual CometAPI key from your account. base url is Chat format(https://api.cometapi.com/v1/chat/completions).

Insert your question or request into the content field—this is what the model will respond to . Process the API response to get the generated answer.

Step 3: Retrieve and Verify Results

Process the API response to get the generated answer. After processing, the API responds with the task status and output data.

Features for Grok 4

Explore the key features of Grok 4, designed to enhance performance and usability. Discover how these capabilities can benefit your projects and improve user experience.

Pricing for Grok 4

Explore competitive pricing for Grok 4, designed to fit various budgets and usage needs. Our flexible plans ensure you only pay for what you use, making it easy to scale as your requirements grow. Discover how Grok 4 can enhance your projects while keeping costs manageable.
Comet Price (USD / M Tokens)Official Price (USD / M Tokens)Discount
Input:$2.4/M
Output:$12/M
Input:$3/M
Output:$15/M
-20%

Sample code and API for Grok 4

The Grok 4 API is a developer-friendly, OpenAI-compatible interface that enables access to xAI's latest large language model for advanced text generation, reasoning, and coding tasks via secure RESTful endpoints.
Python
JavaScript
Curl
from openai import OpenAI
import os

# Get your CometAPI key from https://api.cometapi.com/console/token, and paste it here
COMETAPI_KEY = os.environ.get("COMETAPI_KEY") or "<YOUR_COMETAPI_KEY>"
BASE_URL = "https://api.cometapi.com/v1"

client = OpenAI(base_url=BASE_URL, api_key=COMETAPI_KEY)

completion = client.chat.completions.create(
    model="grok-4-0709",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Hello!"},
    ],
)

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

Versions of Grok 4

The reason Grok 4 has multiple snapshots may include potential factors such as variations in output after updates requiring older snapshots for consistency, providing developers a transition period for adaptation and migration, and different snapshots corresponding to global or regional endpoints to optimize user experience. For detailed differences between versions, please refer to the official documentation.
version
grok-4
grok-4-1-fast-non-reasoning
grok-4-1-fast-reasoning
grok-4-fast-non-reasoning
grok-4.20-beta-0309-non-reasoning
grok-4.20-beta-0309-reasoning
grok-4.20-multi-agent-beta-0309
grok-4-0709
grok-4-fast-reasoning

More Models