xAI Grok

Setup xAI provider and learn how to use it in the starter kit.

The xAI provider integrates Grok models into your application using the AI SDK.

xAI Grok

Setup

Generate API Key

Visit the xAI website to create an account. After signing in, navigate to your account settings to generate an API key.

Add API Key to Environment

Once you've acquired an API key, add it to your project's .env file (e.g., in apps/web):

.env
XAI_API_KEY=your-api-key

Configure Provider (Optional)

The starter kit automatically uses the XAI_API_KEY environment variable. For advanced configurations and customization options, refer to the comprehensive AI SDK xAI documentation.

Features

Use Cases

AI Chatbot

Create intelligent chatbots that engage users in natural, informative conversations powered by xAI's Grok models, delivering responsive and contextually relevant interactions. Experience this capability in our Chat Demo.

Content Generation

Produce diverse, high-quality text content across various formats and styles, harnessing the unique characteristics and capabilities of Grok models for creative and informational outputs.

Automated Workflows

Streamline operations by connecting xAI's language models with your existing tools through function calling, enabling sophisticated automation of complex business processes and repetitive tasks.

Image Generation

Design striking visuals and artwork directly from text descriptions using xAI's image generation capabilities, enabling creative applications and rich visual content. Explore our Image Generation Demo to see these features in action.

How is this guide?

Last updated on

On this page

Make AI your edge, not replacement.