Providers
Grok provider for TypeScript AI agents
Use xAI Grok with a TypeScript AI agent using AgentsKit's OpenAI-compatible adapter, streaming, and tool calls.
import { grok } from '@agentskit/adapters'
const adapter = grok({
apiKey: process.env.XAI_API_KEY!,
model: 'grok-4',
})#Options
| Option | Type | Default |
|---|---|---|
apiKey | string | required |
model | string | required |
baseUrl | string | https://api.x.ai |
includeUsage | boolean | adapter default |
retry | RetryOptions | adapter defaults |
#Model examples
grok-4 Β· grok-code-fast-1 Β· grok-4-fast.
#Env
| Var | Purpose |
|---|---|
XAI_API_KEY | API key from x.ai |
#Notes
- OpenAI-compatible
/chat/completionsendpoint β works with many OpenAI SDK idioms. - Streaming via SSE.
#Related
Explore nearby
- PeerProviders
25 native chat and embedder adapters, plus higher-order adapters that compose candidates. Separate from the 184-provider models.dev catalog.
- PeerChoosing an adapter
Capability decision table and rules of thumb for picking a chat adapter.
- PeerHosted chat adapters
17 managed-LLM adapters. Same contract; swap by changing one import.