Skip to content

feat: add xAI Grok as LLM provider#61

Open
Karlblock wants to merge 1 commit intocalesthio:masterfrom
Karlblock:feat/xai-grok-provider
Open

feat: add xAI Grok as LLM provider#61
Karlblock wants to merge 1 commit intocalesthio:masterfrom
Karlblock:feat/xai-grok-provider

Conversation

@Karlblock
Copy link

Summary

Adds xAI Grok as the 8th LLM provider in Crucix.

  • New lib/llm/xai.mjs provider using xAI's OpenAI-compatible Chat Completions API (https://api.x.ai/v1)
  • Both xai and grok accepted as provider name (case-insensitive)
  • Default model: grok-3
  • Full unit test suite (test/llm-xai.test.mjs) — 10 tests, all passing
  • Updated .env.example, README.md (provider table, architecture tree, env reference)

Usage

LLM_PROVIDER=xai
LLM_API_KEY=xai-your-key
LLM_MODEL=grok-3        # optional, this is the default

Test plan

  • node --test test/llm-xai.test.mjs — 10/10 pass
  • Factory creates XAIProvider for both xai and grok aliases
  • Correct API endpoint, headers, and request body format
  • Error handling and empty response edge cases
  • Integration test with live xAI API key (not included, requires key)

Closes #54

Add xAI Grok support via their OpenAI-compatible Chat Completions API.
Accepts both `xai` and `grok` as provider aliases.
Default model: grok-3.

Closes calesthio#54
@Karlblock Karlblock requested a review from calesthio as a code owner March 20, 2026 19:39
@calesthio
Copy link
Owner

I haven't been able to get to this yet because work has been busy, but I definitely plan to review it over the weekend.

@3byss
Copy link

3byss commented Mar 20, 2026

I have already taken up this issue as one of my first Github contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add xAI Grok as an LLM provider

3 participants