Related Models
Discover similar models you might be interested in
About XAI: Grok 4
Grok 4 is xAI's latest reasoning model with a 256k context window. It supports parallel tool calling, structured outputs, and both image and text inputs. Note that reasoning is not...
Technical Specifications
- Model ID
- x-ai-grok-4
- Category
- LLM Models
- Task
- Text Generation
- Price
- $9.000000 per million tokens
- Added
- February 20, 2026
Key Features
- Chat completion and multi-turn conversation API
- Streaming response with token-by-token output
- Function calling and tool use support
- System prompts and role-based messaging
- JSON mode and structured output
Quick Start
Integrate XAI: Grok 4 into your application with a single API call. Get your API key from the pricing page to get started.
import requestsimport jsonurl = "https://modelslab.com/api/v7/llm/chat/completions"headers = {"Content-Type": "application/json"}data = {"model_id": "x-ai-grok-4","messages": [{"role": "user","content": "Hello!"}],"max_tokens": 1000,"key": "YOUR_API_KEY"}try:response = requests.post(url, headers=headers, json=data)response.raise_for_status() # Raises an HTTPError for bad responses (4XX or 5XX)result = response.json()print("API Response:")print(json.dumps(result, indent=2))except requests.exceptions.HTTPError as http_err:print(f"HTTP error occurred: {http_err} - {response.text}")except Exception as err:print(f"Other error occurred: {err}")
View the full API documentation for SDKs, code examples in Python, JavaScript, and more.
Pricing
XAI: Grok 4 API costs $9.000000 per million tokens. Pay only for what you use with no minimum commitments. View pricing plans
Use Cases
- AI chatbots and virtual assistants
- Code generation and developer tools
- Content writing and copywriting automation
- Data analysis, summarization, and extraction
XAI: Grok 4 FAQ
Grok 4 is xAI's latest reasoning model with a 256k context window. It supports parallel tool calling, structured outputs, and both image and text inputs. Note that reasoning is not...
You can integrate XAI: Grok 4 into your application with a single API call. Sign up on ModelsLab to get your API key, then use the model ID "x-ai-grok-4" in your API requests. We provide SDKs for Python, JavaScript, and cURL examples in the API documentation.
XAI: Grok 4 costs $9.000000 per million tokens. ModelsLab uses pay-per-use pricing with no minimum commitments. A free tier is available to get started.
The model ID for XAI: Grok 4 is "x-ai-grok-4". Use this ID in your API requests to specify this model.
Yes, ModelsLab offers a free tier that lets you try XAI: Grok 4 and other AI models. Sign up to get free API credits and start building immediately.