Introduction

Welcome to the Grok 3 API documentation. Our API provides access to state-of-the-art language models for various natural language processing tasks. This documentation will help you integrate Grok 3 into your applications.

Base URL

https://grok3api.com/api

Authentication

All API requests require authentication using an API key. You can obtain your API key from the dashboard. Include your API key in the request headers using either:

Bearer Token

Authorization: Bearer YOUR_API_KEY

API Key Header

x-api-key: YOUR_API_KEY

Chat Completions

POST /chat/completions

Generate chat completions using the Grok 3 model.

Request Body

{
    "model": "grok-3",
    "messages": [
        {
            "role": "user",
            "content": "What is artificial intelligence?"
        }
    ],
    "temperature": 0.7
}

Parameters

  • model (required): Either "grok-3" or "grok-3-pro"
  • messages (required): Array of message objects with role and content
  • temperature (optional): Value between 0 and 1, default is 0.7

Response

{
    "id": "chatcmpl-123...",
    "object": "chat.completion",
    "created": 1740330947,
    "model": "grok-3",
    "choices": [{
        "index": 0,
        "message": {
            "role": "assistant",
            "content": "..."
        },
        "finish_reason": "stop"
    }],
    "usage": {
        "prompt_tokens": 48,
        "completion_tokens": 783,
        "total_tokens": 831
    }
}

Code Examples

cURL

curl https://grok3api.com/api/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "grok-3",
    "messages": [{
      "role": "user",
      "content": "What is artificial intelligence?"
    }]
  }'

Python

import requests

url = "https://grok3api.com/api/chat/completions"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer YOUR_API_KEY"
}
data = {
    "model": "grok-3",
    "messages": [{
        "role": "user",
        "content": "What is artificial intelligence?"
    }]
}

response = requests.post(url, headers=headers, json=data)
print(response.json())

Rate Limits

Rate limits vary based on your subscription plan:

  • Demo Plan: 1,000 requests per month
  • Pro Plan: 100,000 requests per month