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
retriesint0Number of retries to attempt before raising a ModelProviderError
delay_between_retriesint1Delay between retries, in seconds
exponential_backoffboolFalseIf True, the delay between retries is doubled each time
xAI extends the OpenAI-compatible interface and supports most parameters from OpenAI.