xAI's Grok uses an OpenAI-compatible endpoint, making it a one-row addition to the provider registry introduced in #413.
Blocked by #413 — the _PROVIDERS registry must land first.
Background
xAI's Grok API is OpenAI-compatible:
- Endpoint:
https://api.x.ai/v1/chat/completions
- Auth:
Bearer token (identical to OpenAI/Moonshot/Mistral pattern)
- Response:
choices[0].message.content (identical)
- Env var:
VERA_XAI_API_KEY
- Default model:
grok-3-mini-fast-beta (cheap/fast tier — analogous to Haiku, GPT-4o-mini, mistral-small-latest; their flagship is grok-4-0709 but that's the expensive tier)
Once the _PROVIDERS registry exists, this is literally one dict entry:
"xai": _ProviderConfig(
env_key="VERA_XAI_API_KEY",
url="https://api.x.ai/v1/chat/completions",
default_model="grok-3-mini-fast-beta",
auth_style="bearer",
response_style="openai",
),
Auto-detection, error messages, and the dispatch logic all inherit from the registry with no further changes.
Change list
vera/codegen/api.py
Tests — tests/test_codegen.py
test_inference_xai_auto_detect — copy pattern from other provider auto-detect tests
test_xai_provider — unit test for the xAI config entry
Documentation sweep
spec/09-standard-library.md — one row in the provider table
SKILL.md — one row in the provider table
README.md — one row in the env var table
CHANGELOG.md — entry for xAI support
Out of scope
- Grok-specific features (real-time web search, etc.) —
Inference.complete is plain String → Result<String, String>
- Browser runtime — separate PR, same pattern as other providers
xAI's Grok uses an OpenAI-compatible endpoint, making it a one-row addition to the provider registry introduced in #413.
Blocked by #413 — the
_PROVIDERSregistry must land first.Background
xAI's Grok API is OpenAI-compatible:
https://api.x.ai/v1/chat/completionsBearertoken (identical to OpenAI/Moonshot/Mistral pattern)choices[0].message.content(identical)VERA_XAI_API_KEYgrok-3-mini-fast-beta(cheap/fast tier — analogous to Haiku, GPT-4o-mini, mistral-small-latest; their flagship isgrok-4-0709but that's the expensive tier)Once the
_PROVIDERSregistry exists, this is literally one dict entry:Auto-detection, error messages, and the dispatch logic all inherit from the registry with no further changes.
Change list
vera/codegen/api.py"xai"entry to_PROVIDERS(after Add Mistral AI provider to the Inference effect #413 lands)Tests —
tests/test_codegen.pytest_inference_xai_auto_detect— copy pattern from other provider auto-detect teststest_xai_provider— unit test for the xAI config entryDocumentation sweep
spec/09-standard-library.md— one row in the provider tableSKILL.md— one row in the provider tableREADME.md— one row in the env var tableCHANGELOG.md— entry for xAI supportOut of scope
Inference.completeis plainString → Result<String, String>