Skip to main content

xAI Provider

Use xAI’s Grok models including Grok-4 and Grok-3.

Environment Variables

export XAI_API_KEY=xai-...

Supported Modalities

ModalitySupported
Text/Chat
Embeddings
Image
Tools

Quick Start

import { Agent } from 'praisonai';

const agent = new Agent({
  name: 'Grok',
  instructions: 'You are a helpful assistant.',
  llm: 'xai/grok-3'
});

const response = await agent.chat('Hello!');
console.log(response);

Available Models

ModelDescription
grok-4Latest Grok model
grok-3Grok 3
grok-3-fastFast variant
grok-3-miniLightweight

Troubleshooting

Missing API Key

export XAI_API_KEY=xai-your-key