Nexus

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.

Installation

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

Quick Start

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

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

Options

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

Capabilities

CapabilitySupported
ChatYes
StreamingYes
EmbeddingsNo
VisionYes
ToolsYes
ThinkingNo

Models

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

On this page