Skip to main content
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

string
required
Model ID (e.g., "grok-3", "grok-3-mini", "grok-2-vision", "grok-2").
XAIConfig
Optional { apiKey?, baseURL? }.

Supported Models


Basic Example


Tool Calling


Vision


Full Example


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