Use xAI’s Grok models for general tasks, reasoning, and real-time web search. xAI exposes an OpenAI-compatible API, making integration seamless.
Setup
Factory
Model ID (e.g., "grok-3", "grok-3-mini", "grok-2-vision", "grok-2").
Optional { apiKey?, baseURL? }.
Supported Models
Basic Example
Vision
Full Example
The tracker preserves reported usage. A missing tariff or billing field makes total null. Supply a catalog that matches your billing provider, API, model or deployment, tier, and region; see cost accounting.
Reasoning
Grok uses reasoning_effort. Grok 4.5 and 4.6 ignore effort: "none" and "minimal" (the field is omitted). If the call is already on the Responses API, Agentium also requests encrypted reasoning content.
Environment Variables
Cross-References
- OpenAI — Similar API format
- DeepSeek — Another reasoning-focused model
- Tools — Tool calling guide