grok-3 model is good for most use-cases.
Authentication
Set yourXAI_API_KEY environment variable. You can get one from xAI here.
Example
UsexAI with your Agent:
Live Search
xAI models support live search capabilities that can access real-time information: View more examples here.
Params
| Parameter | Type | Default | Description |
|---|---|---|---|
id | str | "grok-3" | The specific model ID used for generating responses. |
name | str | "xAI" | The name identifier for the xAI agent. |
provider | str | "xAI" | The provider of the model, combining "xAI" with the model ID. |
api_key | Optional[str] | None | The API key for authenticating requests to the xAI service. Retrieved from the environment variable XAI_API_KEY. |
base_url | str | "https://api.x.ai/v1" | The base URL for making API requests to the xAI service. |
search_parameters | Optional[Dict[str, Any]] | None | Parameters for enabling live search capabilities. Supports mode, max_search_results, and return_citations. |
xAI also supports the params of OpenAI.