Skip to Content
NotPixel SDK v1.0.1 — Now with caching, hooks, and browser tracking!

xAI (Grok)

Access xAI’s Grok models through NotPixel. Grok is designed for real-time knowledge and witty, engaging responses.

Setup

1. Get API Key

  1. Go to xAI 
  2. Sign up for API access
  3. Create an API key

2. Configure Environment

.env
XAI_API_KEY=xai-...

Usage

import Ads from 'notpixel'; const ads = new Ads({ publisherId: 'pub_xxx', model: 'xai/grok-2', input: 'What happened in tech news today?', }); const response = await ads.offer(); console.log(response.text);

Available Models

ModelDescription
xai/grok-2Latest Grok model
xai/grok-2-miniFaster, smaller variant

Grok has access to real-time information from X (formerly Twitter), making it particularly useful for current events and trending topics.

Environment Variable

VariableDescription
XAI_API_KEYYour xAI API key