--- title: xAI Grok description: Setup xAI provider and learn how to use it in the starter kit. url: /ai/docs/xai --- # xAI Grok The [xAI](https://x.ai) provider integrates Grok models into your application using the AI SDK. ![xAI Grok](/images/docs/ai/providers/xai.webp) ## Setup ### Generate API Key Visit the [xAI website](https://x.ai) 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`): ```bash title=".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](https://sdk.vercel.ai/providers/ai-sdk-providers/xai#provider-instance). ## Features Utilize xAI's language models for conversational AI, text generation, and other natural language processing tasks. Enable language models to interact with external tools and functions, allowing for more complex and automated task execution. Generate images based on textual descriptions using xAI's models. ## Use Cases 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](/ai/docs/chat). 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. 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. 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](/ai/docs/image) to see these features in action. ## Links * [xAI Website](https://x.ai) * [AI SDK - xAI Provider Docs](https://sdk.vercel.ai/providers/ai-sdk-providers/xai)