OpenAiCompatibleChatModel.grok constructor
OpenAiCompatibleChatModel.grok({})
Creates an adapter for xAI's Grok.
The default names a specific model rather than a -latest alias: xAI
publishes aliases for some families and not others, and an alias that
moves under you changes both price and behaviour without a code change.
Implementation
factory OpenAiCompatibleChatModel.grok({
required String apiKey,
String model = 'grok-4.6',
http.Client? client,
}) => OpenAiCompatibleChatModel.custom(
baseUrl: Uri.parse('https://api.x.ai/v1'),
model: model,
provider: 'grok',
apiKey: apiKey,
capabilities: ModelCapabilities.frontier,
client: client,
);