Skip to main content

Variable: xai

const xai: (modelId, config?) => ModelConfig & object

Defined in: packages/core/src/providers/factories.ts:257

xAI (Grok). Auto-detection already routes any grok-* id here; the factory is for explicit config. The API key defaults to XAI_API_KEY.

Vision-tagged Grok variants accept images. Audio and arbitrary file inputs are not supported by xAI.

Type Declaration​

models​

models: (config?) => Promise<ModelInfo[]>

List the xAI (Grok) models the configured key can see, newest-first.

Parameters​

config?​

ProviderConfig

Returns​

Promise<ModelInfo[]>

Examples​

With reasoning

const bot = new Baleybot({
model: xai('grok-4', { reasoning: { effort: 'high' } })
});

Custom API key + base URL (e.g. for a proxy)

const bot = new Baleybot({
model: xai('grok-4', { apiKey: 'xai-...', baseUrl: 'https://my-proxy.example/v1' })
});