Stelladocs
API Providers

xAI

Grok over an OpenAI-compatible API — a distinct model family with strong reasoning, useful as an alternate judge, with grok-4 as the default model.

xAI serves the Grok family — strong reasoning models from a lineage independent of the Claude, GPT, and Gemini lines. That independence is the point: in a pipeline built on cross-family judging, a third or fourth distinct family is genuinely useful. Stella speaks the OpenAI-compatible dialect against https://api.x.ai/v1.

Setup

export XAI_API_KEY="xai-..."

xAI sits fourth in auto-detection, so the key alone is enough. Prefer a file? Store the key in ~/.config/stella/credentials.toml, or rename the env var Stella reads with providers.xai.api_key_env — see overriding the key source.

Selecting models

The provider id is xai; the default model is grok-4.

stella --model xai/grok-4 run "review the retry logic for races"
export STELLA_MODEL=xai/grok-4

Configuration

Being OpenAI-compatible, xAI takes the standard sampling parameters — temperature, top_p, max_tokens, and friends — configured per agent under agent_engine_config. The settings.json providers map can override the base URL or default model like any other provider:

~/.config/stella/settings.json
{
  "providers": {
    "xai": {
      "base_url": "https://llm-gateway.internal.example.com/v1",
      "default_model": "grok-4"
    }
  }
}

--base-url (env form STELLA_BASE_URL) overrides the settings value for one run. In a project's .stella/settings.json, base_url is ignored unless STELLA_TRUST_PROJECT=1 — see the project trust boundary.

In the pipeline

grok-4's sweet spot is the alternate judge: when your worker and primary judge are already Claude and GPT, Grok gives you a third family for tie-breaking or for goal-mode round judging without same-model bias. It holds its own as a worker on reasoning-heavy tasks too. See Examples for profile patterns and Agent engine config for the per-agent wiring.

Catalog pricing

ModelContextIn $/MtokOut $/MtokCached-in $/Mtok
grok-4256k3.0015.000.75

List prices from Stella's seed catalog — verify with xAI; your local catalog re-syncs from models.dev via stella models refresh. See the Model guide for the full cross-provider table.

Stella is totally free and open source, dual-licensed MIT or Apache 2.0— your choice: MIT's three-paragraph simplicity, or Apache 2.0's explicit patent grant that enterprises prefer. Use it, fork it, embed it, ship it — no account, no phone-home, no strings. What that means →

On this page