Build With X

Build With X

Best practices and patterns for xAI's Grok API and X (Twitter) API

Welcome to Build With X! This guide provides comprehensive documentation for working with xAI's Grok API and the X (Twitter) API.

Getting Started

CLI Tool

Install the CLI for quick access to documentation:

bunx build-with-x list          # List all topics
bunx build-with-x show <topic>  # Show specific topic
bunx build-with-x setup         # Clone examples to .reference/xai/

Topics

xAI Grok API

TopicDescription
AuthenticationAPI keys, environment setup
Text GenerationChat completions, streaming, function calling
Image GenerationAurora image generation API
Voice AgentWebSocket-based text-to-speech

X (Twitter) API

TopicDescription
X API BasicsTimeline fetching, posting tweets
X API OAuthOAuth 2.0 PKCE authentication
X Search ToolGrok's x_search function

General

TopicDescription
Best PracticesError handling, rate limits, patterns

On this page