What is the Grok API and how do I use it?
The Grok API is xAI’s API for its Grok models: a key is created at console.x.ai, and the base URL is https://api.x.ai/v1. The same models are also served through MartLLM’s OpenAI-compatible API at https://api.martllm.com/v1: on November 20, 2026, 7 Grok models were taking requests there. Grok 4.20 Beta cost $0.375 per million input tokens and $0.75 per million output tokens. A request that fails is not billed. Credit is prepaid, from $5, with no subscription.
Prices as of November 20, 2026, 11:00 UTC. This page is rebuilt every hour.