Nexus
1.x
Docs/Nexus/xAI (Grok)
Open

Reading1 min
Updated31 Jul 2026
Sourcev1/providers/xai.mdx

xAI offers the Grok family of models with vision and tool-calling support. Uses an OpenAI-compatible API.

Installation01

import "github.com/xraph/nexus/providers/xai"

Quick Start02

provider := xai.New(os.Getenv("XAI_API_KEY"))

gw := nexus.New(
    nexus.WithProvider(provider),
)

Options03

OptionDescription
xai.WithBaseURL(url)Override the API base URL (default: https://api.x.ai/v1)

Capabilities04

CapabilitySupported
ChatYes
StreamingYes
EmbeddingsNo
VisionYes
ToolsYes
ThinkingNo

Models05

ModelContextMax OutputInput PriceOutput Price
grok-2131K8,192$2.00/M$10.00/M
grok-2-mini131K8,192$0.30/M$0.50/M