Grok 4
xai/grok-4Chat- Function calling
- Web search
Grok 4 (xai/grok-4) is a chat model from xAI with a 256,000-token context window and 256,000 max output tokens, priced at $1.25/1M input and $2.50/1M output tokens. Available via the haimaker.ai OpenAI-compatible API.
API usage
from openai import OpenAI
client = OpenAI(
base_url="https://api.haimaker.ai/v1",
api_key="YOUR_API_KEY",
)
response = client.chat.completions.create(
model="xai/grok-4",
messages=[
{"role": "user", "content": "Hello, how are you?"}
],
)
print(response.choices[0].message.content)Replace YOUR_API_KEY with a key from your haimaker account. Get an API key or read the developer docs.
Overview
xAI's Grok, a large language model with real-time knowledge, reasoning, and function calling capabilities.
Specifications
| Mode | Chat |
|---|---|
| Supports | Function calling, Web search |
| Not supported | Vision, Reasoning, URL context |
Frequently asked questions
What is the context window of Grok 4?
Grok 4 (xai/grok-4) has a 256,000-token context window and supports up to 256,000 output tokens per request.
How much does Grok 4 cost?
Grok 4 is priced at $1.25 per 1M input tokens and $2.50 per 1M output tokens when accessed via the haimaker.ai OpenAI-compatible API.
What features does Grok 4 support?
Grok 4 supports function calling, web search.
How do I use Grok 4 via API?
Send requests to https://api.haimaker.ai/v1/chat/completions with model "xai/grok-4" using any OpenAI-compatible SDK. Authentication uses a Bearer API key from https://app.haimaker.ai.
Related chat models
- Grok 4.7xAI$2.00 in $6.00 out
- Grok 4.20 Reasoning Gv2xAI$1.25 in $2.50 out
- Grok 4.20 Non Reasoning Gv2xAI$1.25 in $2.50 out
- Grok 4.20 Experimental Beta Reasoning LatestxAI$1.25 in $2.50 out
- Grok 4.20 Experimental Beta Non Reasoning LatestxAI$1.25 in $2.50 out
- Grok 4.20 Experimental Beta LatestxAI$1.25 in $2.50 out
Compare Grok 4
Run Grok 4 through one API
OpenAI-compatible. Switch models by changing one string.