Skip to main content
The xAI model provides access to xAI’s language models.

Parameters

ParameterTypeDefaultDescription
idstr"grok-beta"The id of the xAI model to use
namestr"xAI"The name of the model
providerstr"xAI"The provider of the model
api_keyOptional[str]NoneThe API key for xAI (defaults to XAI_API_KEY env var)
base_urlstr"https://api.x.ai/v1"The base URL for the xAI API
xAI extends the OpenAI-compatible interface and supports most parameters from OpenAI.
I