Skip to content

Grok (xAI)

The Grok provider gives access to xAI's Grok models. Models are accessed with the grok: prefix.

Setup

export XAI_API_KEY="your-api-key"

Base URL: https://api.x.ai/v1

Available Models

Model Use Case
grok-1 First generation model
grok-2 Latest generation, recommended

Usage

from eval_lib.metrics import AnswerRelevancyMetric

metric = AnswerRelevancyMetric(model="grok:grok-2", threshold=0.7)