xAI API
Hosted API for the Grok models, billed per token.
What it does
- Text generation
- Code generation
- Image generation
- Video generation
Features 8
- Web Search toolLets Grok search the web in real time and browse pages to answer queries.
- X Search toolLets Grok perform keyword, semantic, user search and thread fetch on X.
- Code execution toolLets Grok write and execute Python code in real time for calculations and data analysis.
- Collections searchLets Grok search uploaded knowledge bases to retrieve relevant information from documents.
- Remote MCP toolsConnects Grok to external MCP servers to extend it with custom tools.
- Function callingDefine custom tools the model can invoke during a conversation.
- Structured outputsReturns responses in a specific format such as a JSON object matching a schema.
- Batch APIProcesses large volumes of requests asynchronously with reduced pricing and higher rate limits.
How it compares
-
Grok
Grok Models & Pricing | SpaceXAI Docs
Official documentation · 5 Sep 2026 -
Claude API
Can I use the OpenAI or Anthropic SDK with Grok? Yes. Point your existing SDK at base URL https://api.x.ai/v1 with your SpaceXAI API key.
Official documentation · 19 Sep 2026 -
OpenAI API
Can I use the OpenAI or Anthropic SDK with Grok? Yes. Point your existing SDK at base URL https://api.x.ai/v1 with your SpaceXAI API key.
Official documentation · 19 Sep 2026
Sources
- Pricing
- Constraints
-
Official documentation · 2 Oct 2026
Derived from the security facts on this page, from the same source.
- Security
-
Official documentation · 2 Oct 2026
API only: docs.x.ai API Security FAQ (site now branded SpaceXAI) covers API requests/responses; consumer Grok, Grok Bot, Grok Build, Grokipedia and voice products are left out. ZDR is a vendor team-level setting. Certifications and DPA not found on fetched pages (x.ai legal pages returned 403 to curl; trust.x.ai is a Vanta script-only page).
- Sold within
-
Official documentation · 30 Sep 2026
xAI's API pricing page states "All prices are in USD." and lists per-model token rates, e.g. grok-4.7 at "$2.00" input and "$6.00" output per 1M tokens, plus Imagine and Voice API rates.
- Interfaces
-
Official documentation · 28 Sep 2026
Docs show REST calls to https://api.x.ai/v1 with a bearer API key (x.ai/api itself returned 403, so the docs subdomain was used).
- Modalities
-
Official documentation · 1 Oct 2026
Page: 'Any image/text input order is accepted / Real-time conversations, speech-to-text, and text-to-speech / image and video generation'.
- Intended for
-
xAI's own announcement: "we launched the public beta of our enterprise API"; described elsewhere as xAI's "pay-per-token developer interface for building applications, agents, and integrations", with a separate custom-priced enterprise contract tier
Also from xAI
-
Grok Application
Assistant for chat, real-time web and X search, image generation and voice, on the web and in the X apps.
-
Grok Bot AI agent
Persistent AI teammate agents that retain context and learn from prior work across sessions, for delegated business tasks (e.g. account management); they use apps and websites as the user would.
-
Grok Build AI agent
Terminal-based coding agent powered by Grok 4.6 with plan mode, subagents, skills, plugins and MCP-server support for software development workflows.
-
Grok Imagine API API service
API for generating and editing images and video via Grok Imagine, distinct from the consumer Imagine surface inside the Grok app.
-
Grokipedia Application
AI-generated reference encyclopedia, freely browsable without sign-in, listed in x.ai's own top-level Products nav; also has Grok write articles on a named topic, checked against sources.
-
Grok Voice API service
Voice agent builder and API suite from xAI: real-time speech-to-speech conversational agents, speech-to-text transcription, text-to-speech, voice cloning and (upcoming) live translation, built on Grok.
Something wrong here? Send a correction — quote this product id: xai-api.