โœ–๏ธ

X Grok

Grok is xAI's family of large language models, built into the X (formerly Twitter) app and also accessible to developers through a standalone xAI API. It ranks #10 in usage share at roughly 11.1%. Grok is known for two things most competitors don't offer: real-time access to live X posts as a data source, and a more unfiltered, casual conversational personality than most mainstream assistants.

Quick facts
Made by: xAI
Access: Free inside X Premium subscriptions + a paid, usage-based standalone API
Context window: ~128K tokens (Grok 3/4 class models)
Strengths: Real-time knowledge of live X/Twitter data, casual/unfiltered tone, strong general reasoning
Primary use case: Real-time trend/news analysis, social-media-aware chat, general-purpose assistant tasks
Jump to: ExampleGetting startedBest for

Example

The xAI API is OpenAI-compatible โ€” you can use the standard OpenAI Python SDK and just point base_url at xAI's endpoint.

from openai import OpenAI

client = OpenAI(
    api_key="YOUR_XAI_API_KEY",
    base_url="https://api.x.ai/v1"
)

response = client.chat.completions.create(
    model="grok-3",
    messages=[{"role": "user", "content": "What are people on X saying about today's tech news?"}]
)

print(response.choices[0].message.content)

Getting started

Create an xAI account, generate an API key from the developer console, and install the OpenAI SDK to call it.

# 1. sign up and get an API key at console.x.ai

# 2. install the OpenAI-compatible SDK
pip install openai

# 3. set your key
export XAI_API_KEY="your-key-here"
Best for: Products that need awareness of what's trending right now on social media โ€” sentiment/news monitoring bots, social listening tools โ€” and users who prefer a less-filtered, more casual assistant personality.