# xAI API

> Developer API for Grok models covering text, multimodal, voice, and vision

xAI's developer platform provides API access to Grok models for text generation, reasoning, coding, and multimedia capabilities. It supports OpenAI-compatible SDK integrations, function calling, structured outputs, real-time voice, and image or video generation. Developers can use it to build AI-driven applications with large context windows and integrated live search tools.

Website: https://docs.x.ai/docs

## What it is for

- Integrate Grok into web or backend apps using OpenAI-compatible SDKs
- Run structured data extraction and reasoning tasks with function calling
- Generate images and videos via programmatic API prompts
- Build real-time voice agents with speech-to-speech and text-to-speech endpoints

## Features

- Access to Grok text and reasoning models with up to 500k context
- OpenAI SDK compatibility using custom base URLs
- Built-in tool calling including web search and X search
- Structured outputs and JSON schema enforcement
- Imagine API for image and video generation and editing
- Voice API supporting speech-to-speech, text-to-speech, and transcription
- Batch API, async requests, and prompt caching

## Pricing

Paid. Pay-as-you-go per token, image, or audio second (e.g. Grok 4.7 at $2/1M input, $6/1M output tokens)

## Details

- Type: Web app
- Category: [AI](https://xiry.app/topics/ai.md)
- Open source: no
- Platforms: API, Web
- For: Software engineers and product builders integrating LLMs into software
- Alternative to: OpenAI API, Anthropic Claude API, Google Gemini API
- Tags: grok, xai, llm, api, ai models, multimodal

## Why it was saved

- [@AlexFinn, 21 October 2024](https://x.com/AlexFinn/status/1848492578582487508): Access to Grok-2 and Grok-2 mini models via API for building applications.

## Related

- [Agentic video understanding in Gemini: Developer Guide](https://xiry.app/resources/agentic-video-understanding-in-gemini-developer-guide): Developer guide for on-demand, agentic video analysis in the Gemini API (Article or course, Freemium)
- [Prompt Engineering (Google Whitepaper)](https://xiry.app/resources/prompt-engineering-google-whitepaper-2086): A comprehensive guide to prompt engineering techniques and LLM parameters by Google. (Article or course, Free)
- [Pixtral Large](https://xiry.app/resources/pixtral-large): Mistral AI's 124B parameter open-weights multimodal vision and language model (AI model, Freemium)
- [Agentic Video in Gemini](https://xiry.app/resources/agentic-video-in-gemini): Dynamic video inspection for Gemini models that cuts token usage and cost (AI model, Paid)
- [Building a Style-Mimicking News Bot with Grok API](https://xiry.app/resources/building-a-style-mimicking-news-bot-with-grok-api): Recipe for scraping news URLs and rewriting them in your voice using Grok (Tip, Free)
- [Cheaper Inference](https://xiry.app/resources/cheaper-inference): OpenAI-compatible API marketplace routing model requests at discounted rates (Web app, Paid)

Updated 10 October 2026. Page: https://xiry.app/resources/xai-api

Make your own library: Xiry takes your saved reels, tweets, Reddit bookmarks and Watch Later videos, makes them searchable and pulls the useful stuff out, like this library. It's invite-only for now; join the waitlist at https://xiry.app/#waitlist.
