xAI API
The official xAI Python SDK describes access to xAI APIs.
- Verified facts
- 7
- Offers
- —
- Sources
- 2
- Pricing
- Metered usage
Overview
API and client scope
The publisher describes xAI APIs and an official Python SDK using gRPC, with synchronous and asynchronous clients. Its README includes examples involving text and other output types. Confirm the current model, endpoint, region and input or output support for the workload you intend to run.
The SDK is Apache 2.0 licensed; that licence applies to the client code, not automatically to hosted API access, model weights, trademarks or third-party libraries. SDK examples describe interfaces, not a measured service result.
Read the full editorial overview
Operational checks
Check current API charges, token and media units, rate limits, data retention, regional availability and account terms before sending any data. Compare those conditions on the same workload rather than treating SDK licensing as free inference.
The selected source does not establish a current comparable price, latency, accuracy or safety outcome. No API key, account, inference call or product test was used.
Sources
xAI API: xai-sdk · Evidence: documentation · Not checked
Documented facts
Each fact comes from official documentation and shows when it was verified.
Who it is for
The official xAI Python SDK describes access to xAI APIs.
Coverage limits
The xAI Python SDK describes synchronous and asynchronous clients.
API interfaces
Responses API, Image and video generation, Files API, Batch API, Voice API, Tokenization, Model and account lookup
Official TypeScript SDK README (xai-org/xai-sdk-ts, release v0.2.8, commit ef80b018, Apache-2.0) captured 9 November 2026; supplier documentation, not an API call, deployment or independent test. Lists what this SDK release covers, not every API the provider offers; the README marks the SDK experimental, so its interfaces may change before 1.0.
Model catalogue
A separate catalogue for chat and image-understanding models lists modalities, aliases, token pricing and supported reasoning efforts.
Official TypeScript SDK README (xai-org/xai-sdk-ts, release v0.2.8, commit ef80b018, Apache-2.0) captured 9 November 2026; supplier documentation, not an API call, deployment or independent test. Describes how the API and SDK expose model information; it does not name the currently available models. Check the provider’s model documentation for the live list.
Billing basis
Usage is priced per token, with token prices reported in USD cents per 100 million tokens.
Official TypeScript SDK README (xai-org/xai-sdk-ts, release v0.2.8, commit ef80b018, Apache-2.0) captured 9 November 2026; supplier documentation, not an API call, deployment or independent test. The same README says the Batch API processes requests asynchronously at a reduced price and that the "priority" or "fast" service tier costs more; it states no actual rates. Current rates and tool, image, video and voice charges must be checked in the provider’s pricing documentation.
Data controls
By default the SDK sends store: false, asking that responses not be stored, unless the caller opts in; this differs from the API’s own default.
Official TypeScript SDK README (xai-org/xai-sdk-ts, release v0.2.8, commit ef80b018, Apache-2.0) captured 9 November 2026; supplier documentation, not an API call, deployment or independent test. Client behaviour of this SDK only. Retention, training use and other data terms of the service are governed by the provider’s terms and settings, which this capture does not cover.
Availability
A priority (or fast) service tier gives faster responses at a higher price.
Official TypeScript SDK README (xai-org/xai-sdk-ts, release v0.2.8, commit ef80b018, Apache-2.0) captured 9 November 2026; supplier documentation, not an API call, deployment or independent test. Rates for the tier are on the provider’s Priority Processing page, which this capture does not include. Which models offer a fast deployment is not stated.
Applies to the facts above: Publisher SDK README captured 3 November 2026; describes that SDK and API examples, not a live service test. Current models, prices, availability and service terms require confirmation.
Not confirmed in our sources
We have not confirmed these terms for xAI API in the linked documentation. That does not mean xAI API lacks them; confirm them before you rely on them.
- Pricing
Sources & methodology
Facts come from the linked documentation. Documentation checks are not hands-on tests, and readable sources can have incomplete coverage.
Discovered an undocumented discrepancy or pricing shift? Submit a correction request.
Submit correctionxAI API alternatives
Other AI providers tools to weigh. Different billing units do not establish a cost winner, so compare plans side by side.
OpenAI API
AI providers
Hosted models for text and image inputs, with Responses API access and client SDKs. · Evidence needs recheck
PricingUsage-basedPrice needs recheckPrice terms
Usage-based API pricing
Anthropic Claude API
AI providers
Programmatic access to Claude models through a REST API. · Evidence needs recheck
PricingUsage-basedPrice needs recheckPrice terms
Usage-based API pricing
Google Gemini API
AI providers
A developer API catalogue with text, multimodal, audio and image model families. · Evidence needs recheck
PricingUsage-basedPrice needs recheckPrice terms
Usage-based API pricing
xAI API comparisons
Compare two products in the same category using their documented terms and sources.
- xAI API vs Anthropic Claude API
- xAI API vs DeepInfra
- xAI API vs Google Gemini API
- xAI API vs Mistral AI API
- xAI API vs Nebius Token Factory
- xAI API vs OpenAI API
- xAI API vs Perplexity API Platform
- xAI API vs Replicate
- xAI API vs Together AI
- xAI API vs Baseten
- xAI API vs Cerebras Inference
- xAI API vs Cohere API
- xAI API vs Fireworks AI API
- xAI API vs Groq API
- xAI API vs Hugging Face Inference Providers
- xAI API vs IBM watsonx.ai
- xAI API vs NVIDIA NIM
- xAI API vs OpenRouter API
- xAI API vs SambaCloud