Skip to main content
Watch: I Built an AI App Without Leaving Databricks

API compatibility - 8 documented limits

xAI (Grok) API compatibility

xAI documents an OpenAI-compatible API at https://api.x.ai/v1 (responses, chat/completions, images/generations, models, files and batches). Its Anthropic SDK compatibility is deprecated. The docs list 8 limitations: 7 for the OpenAI-compatible layer and 1 for the Anthropic-compatible layer.

Verified against xAI's own documentation. Not documented means the docs read that day do not say; it never means No.

Compare every provider in the API compatibility matrix.

OpenAI-compatible API

Supported
Base URL
https://api.x.ai/v1
Endpoints
  • responses
  • chat/completions
  • images/generations
  • models
  • files
  • batches
Auth
Authorization: Bearer $XAI_API_KEY
Regional and alternate URLs
  • Globalhttps://api.x.ai/v1
  • UShttps://us.api.x.ai/v1
Notes
Docs now brand the API as SpaceXSI; the host is still api.x.ai. Responses is the primary endpoint; Chat Completions is documented as legacy. The US regional endpoint (https://us.api.x.ai/v1) currently serves only grok-4.7 and grok-4.6, no image/video/voice APIs, and costs 10% more.

From the docs

client = OpenAI( api_key="<YOUR_XAI_API_KEY_HERE>", base_url="https://api.x.ai/v1", )
docs.x.ai/developers/quickstart.md

Anthropic-compatible API

Deprecated

Deprecated. xAI still lists the endpoint under its legacy APIs, but its docs say the Anthropic SDK compatibility is fully deprecated.

Notes
POST /v1/messages (and legacy POST /v1/complete) are still listed under Legacy & Deprecated, described as compatible with the Anthropic API, but the docs say the Anthropic SDK compatibility is fully deprecated and point to the Responses API or gRPC.

From the docs

Deprecated: The Anthropic SDK compatibility is fully deprecated. Please migrate to the Responses API or the gRPC API.
docs.x.ai/developers/rest-api-reference/inference/legacy.md

Documented limitations

Parameters, content types and features xAI (Grok)'s docs say its compatibility layers ignore, reject or change, each with the line it comes from. A layer with nothing listed may still differ in ways the docs do not spell out.

OpenAI-compatible layer7

Anthropic-compatible layer1

Example from xAI (Grok)'s docs

Copied verbatim from the provider's documentation, placeholders included.

Provider example
from openai import OpenAI

client = OpenAI(
    api_key="<YOUR_XAI_API_KEY_HERE>",
    base_url="https://api.x.ai/v1",
)

response = client.responses.create(
    model="grok-4.7",
    input="Fix this function and explain the bug: function median(a){a.sort();return a[a.length/2]}",
)

More on xAI (Grok)

Newsletter

Know when a provider changes its API

One email per week. New models, new endpoints and the compatibility changes that break a base URL, and what they mean for your stack.