



const { OpenAI } = require('openai');
const api = new OpenAI({
baseURL: 'https://api.ai.cc/v1',
apiKey: '',
});
const main = async () => {
const result = await api.chat.completions.create({
model: 'x-ai/grok-4-07-09',
messages: [
{
role: 'system',
content: 'You are an AI assistant who knows everything.',
},
{
role: 'user',
content: 'Tell me, why is the sky blue?'
}
],
});
const message = result.choices[0].message.content;
console.log(`Assistant: ${message}`);
};
main();
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.ai.cc/v1",
api_key="",
)
response = client.chat.completions.create(
model="x-ai/grok-4-07-09",
messages=[
{
"role": "system",
"content": "You are an AI assistant who knows everything.",
},
{
"role": "user",
"content": "Tell me, why is the sky blue?"
},
],
)
message = response.choices[0].message.content
print(f"Assistant: {message}")
-
AI Playground

Test all API models in the sandbox environment before you integrate.
We provide more than 300 models to integrate into your app.


Product Detail
✨ Grok 4: Next-Generation AI for Advanced Reasoning & Automation
Grok 4 represents xAI's latest breakthrough in large language models, engineered for sophisticated high-level reasoning, advanced agentic behavior, and seamless real-world task automation. Building upon the robust architecture of Grok 3, Grok 4 significantly enhances its reasoning capabilities through 10 times more computational power dedicated to training. A pivotal new feature is the direct integration of tool use into its Reinforcement Learning from Human Feedback (RLHF) pipeline, setting a new standard for AI interaction.
🚀 Technical Specifications
Performance Benchmarks
- Context Window: 256,000 tokens
- Max Output: ~4,096 tokens
- Training Regime: 10× more RL compute than Grok 3
- Tool Use: Native, with strong multi-step support
Performance Metrics
- SOTA on ARC-AGI-2: 15.9%
- AIME 2025: 76.9% accuracy
-
Humanity’s Last Exam (HLE):
- With tools: 44.4% overall, 50.7% on text-only section
- Without tools: 25.4% (vs 21.6% Gemini 2.5 Pro)

Visual representation of Grok 4's key performance metrics.
Key Capabilities
- ✓ Multi-step reasoning across long contexts
- ✓ Native tool-use through real/synthetic environments
- ✓ Deterministic outputs (non-streamed)
- ✓ Planning with API execution
- ✓ Robust performance on AGI-style benchmarks
API Pricing (per 1M tokens)
Input:
- 0–128k tokens: $3.15
- 128k+ tokens: $6.30
- Cache: $0.75
Output:
- 0–128k tokens: $15.75
- 128k+ tokens: $31.50
💡 Optimal Use Cases for Grok 4
Grok 4's advanced capabilities make it ideal for a wide range of demanding applications:
- 🤖 Autonomous Agents: Powering sophisticated systems that execute tools and perform complex planning.
- 🔍 Advanced QA Systems: Enabling multi-document inference and precise answer generation leveraging its 256K context window.
- 📈 Research & Evaluation: Tackling long-horizon tasks requiring strong logical reasoning and data synthesis.
- 📊 Strategic Analysis: Facilitating business and research planning with the ability to process and structure complex inputs.
- 💻 Code Agents: Driving multi-step reasoning processes over various toolchains and development environments.
🔗 Code Samples
Integration with Grok 4 can be initiated through standard API calls. Below is a conceptual example for an API interaction, demonstrating how a typical chat completion might be structured.
// Example using a hypothetical client library for xAI Grok 4
import xai_client
client = xai_client.XAIClient(api_key="YOUR_API_KEY")
response = client.chat.completions.create(
model="x-ai/grok-4-07-09",
messages=[
{"role": "system", "content": "You are a helpful AI assistant."},
{"role": "user", "content": "Explain the concept of quantum entanglement simply."}
],
max_tokens=200,
temperature=0.7
)
print(response.choices[0].message.content)
(This code snippet is illustrative; actual implementation may vary based on API documentation.)
🆚 Grok 4: Comparison with Other Leading Models
-
vs. GPT-4o: While GPT-4o excels in multimodality and web browsing, Grok 4 demonstrates superior reasoning performance and tool integration for AGI-style tasks.
-
vs. Claude 4 Opus: Claude 4 is renowned for its language safety and alignment capabilities. However, Grok 4 significantly outperforms it on ARC-AGI-2 (15.9% vs 8.6%) and Humanity's Last Exam, particularly in tool-enabled scenarios.
-
vs. Gemini 2.5 Pro: Gemini 2.5 Pro is recognized for its speed and instruction-following prowess. Grok 4, conversely, surpasses it in zero-shot reasoning and planning, achieving 25.4% vs 21.6% on HLE without tools.
-
vs. Grok 3: Grok 4 represents a substantial upgrade over Grok 3. It benefits from 10 times more RL compute and natively integrates tool-use instruction, achieving 25.4% on Humanity's Last Exam without tools (compared to Grok 3’s ~14.7%) and delivering enhanced multi-step reasoning and factual recall.
⚠️ Limitations of Grok 4
- Text-only: Currently, Grok 4 does not support vision or audio inputs.
- Sequential Tool Use: Tool use is not compositional, meaning actions are executed sequentially rather than in parallel or complex nested patterns.
- Closed-weight model: The model weights are not publicly accessible.
- Streaming Determinism: Seed determinism may be unreliable when using streaming outputs.
- No Public Local/Offline Inference: Public inference is not available for local or offline deployment.
🔗 API Integration
Grok 4 is readily accessible via the AI/ML API. To get started and integrate Grok 4 into your applications, you can sign up here.
❓ Frequently Asked Questions (FAQ)
Q1: What is the primary improvement of Grok 4 over Grok 3?
A1: Grok 4 offers 10 times more RL compute during training and natively integrates tool use directly into its RLHF pipeline, leading to significantly enhanced reasoning and multi-step capabilities.
Q2: What are Grok 4's key strengths compared to models like GPT-4o or Claude 4 Opus?
A2: Grok 4 excels in advanced reasoning performance, particularly in AGI-style tasks, and boasts robust tool integration. It demonstrates superior performance on benchmarks like ARC-AGI-2 and Humanity’s Last Exam, especially with tool-enabled setups.
Q3: Does Grok 4 support multimodal inputs like vision or audio?
A3: As of the current Grok 4 version, it is a text-only model and does not support vision or audio inputs.
Q4: What is the maximum context window for Grok 4?
A4: Grok 4 features an extensive context window of 256,000 tokens, allowing it to process and understand very long inputs.
Learn how you can transformyour company with AICC APIs



Log in