xAI (Grok)
Use xAI Grok models with Nexus — vision and tool calling support.
xAI offers the Grok family of models with vision and tool-calling support. Uses an OpenAI-compatible API.
import "github.com/xraph/nexus/providers/xai"
provider := xai.New(os.Getenv("XAI_API_KEY"))
gw := nexus.New(
nexus.WithProvider(provider),
)
| Option | Description |
|---|
xai.WithBaseURL(url) | Override the API base URL (default: https://api.x.ai/v1) |
| Capability | Supported |
|---|
| Chat | Yes |
| Streaming | Yes |
| Embeddings | No |
| Vision | Yes |
| Tools | Yes |
| Thinking | No |
| Model | Context | Max Output | Input Price | Output Price |
|---|
grok-2 | 131K | 8,192 | $2.00/M | $10.00/M |
grok-2-mini | 131K | 8,192 | $0.30/M | $0.50/M |