Grok 4 is xAI's latest and most intelligent reasoning model, featuring a 256k token context window, parallel tool calling, structured outputs, and support for both image and text inputs.
Context Window
256k tokens
Max Output
30k tokens
Pricing (Input / Output)
$5 / $15 per 1M
Architecture
Hybrid (specialized modules)
Modality
Text, Image
Knowledge Cutoff
November 2024
curl -X POST https://api.neuralhub.xyz/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer NEURALHUB_API_KEY" \
-d '{
"model": "x-ai/grok-4",
"messages": [
{ "role": "system", "content": "You are a helpful assistant." },
{ "role": "user", "content": "" }
],
"temperature": 0.7,
"max_tokens": 500,
"top_p": 0.9
}'The API returns an OpenAI-compatible response. Example:
{
"id": "chatcmpl-<uuid>",
"object": "chat.completion",
"created": 1764852086,
"model": "x-ai/grok-4",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The answer to life, the universe, and everything is famously 42..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 26,
"completion_tokens": 169,
"total_tokens": 195
}
}