Skip to content

feat: add xAI Grok provider - #109

Merged
igmarin merged 1 commit into
mainfrom
feat/xai-provider
Sep 14, 2026
Merged

igmarin merged 1 commit into
mainfrom
feat/xai-provider

Conversation

@igmarin

@igmarin igmarin commented Sep 14, 2026

Copy link
Copy Markdown
Owner

Why

ROADMAP item 2. The surrounding skill ecosystem already runs on Grok; SkillBench had no xAI client.

What

  • Clients::Providers::Xai (OpenAI-compatible, same shape as Mistral/OpenRouter)
  • Base URL https://api.x.ai, path /v1/chat/completions, default model grok-4
  • skill-bench init --xai
  • Env: SKILL_BENCH_XAI_API_KEY / XAI_API_KEY, SKILL_BENCH_XAI_MODEL / XAI_MODEL
  • README, first-eval-guide, architecture

Does not add AWS Bedrock.

Proof

bundle exec ruby -Itest test/evaluator/clients/providers/xai_test.rb
# 7 runs, 0 failures

bundle exec ruby -Itest test/evaluator/config/env_overrides_test.rb
# 3 runs, 0 failures

skill-bench --help
# Providers include --xai

Summary by CodeRabbit

  • New Features

    • Added xAI (Grok) as a supported provider.
    • Uses the OpenAI-compatible chat completions API with grok-4 as the default model.
    • Supports configuration through XAI_API_KEY or SKILL_BENCH_XAI_API_KEY, plus model overrides.
    • Added --xai initialization support.
  • Documentation

    • Updated provider lists, setup guidance, configuration references, and architecture documentation.
  • Tests

    • Added coverage for xAI requests, authentication, defaults, error handling, and environment-variable configuration.

OpenAI-compatible client for https://api.x.ai/v1/chat/completions.
Default model grok-4. Init --xai. Env SKILL_BENCH_XAI_API_KEY or XAI_API_KEY.
@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Advanced

Run ID: 09608336-231a-48ac-a3b1-1f672a0906b6

📥 Commits

Reviewing files that changed from the base of the PR and between 3f46789 and 0fe460f.

📒 Files selected for processing (13)
  • CHANGELOG.md
  • README.md
  • docs/architecture.md
  • docs/first-eval-guide.md
  • lib/skill_bench/clients/README.md
  • lib/skill_bench/clients/all.rb
  • lib/skill_bench/clients/provider_schemas.rb
  • lib/skill_bench/clients/providers/xai.rb
  • lib/skill_bench/config/defaults.rb
  • lib/skill_bench/config/env_overrides.rb
  • test/evaluator/clients/providers/xai_test.rb
  • test/evaluator/config/env_overrides_test.rb
  • test/test_helper.rb

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The PR adds xAI as a provider. It defines the Grok client, default model, API endpoint, environment mappings, request tests, and documentation updates.

Changes

xAI provider integration

Layer / File(s) Summary
Provider runtime and configuration
lib/skill_bench/clients/providers/xai.rb, lib/skill_bench/clients/provider_schemas.rb, lib/skill_bench/config/..., lib/skill_bench/clients/all.rb
Registers the :xai provider, adds the Xai client, sets grok-4 as the default model, maps xAI environment variables, and loads the provider.
Provider behavior validation
test/evaluator/clients/providers/xai_test.rb, test/evaluator/config/env_overrides_test.rb, test/test_helper.rb
Tests xAI requests, authentication, response extraction, missing-key errors, metadata, defaults, environment precedence, and environment cleanup.
Provider documentation
README.md, CHANGELOG.md, docs/..., lib/skill_bench/clients/README.md
Documents xAI availability, configuration variables, initialization flags, API details, registry data, and provider inheritance.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant Xai
  participant xAI_API as xAI API
  Caller->>Xai: submit chat messages and API key
  Xai->>xAI_API: POST /v1/chat/completions
  xAI_API-->>Xai: return completion content
  Xai-->>Caller: return result
Loading

Merge Risk: ⚪ Minimal · up to 0fe46

The xAI provider configuration and documentation do not retain a supported actionable defect. The change is ready to merge after normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 23.08% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 8 files. (5 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies the main change: adding the xAI Grok provider.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 23.08% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 8 files. (5 skipped: 5 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit found a Grok-shaped key,
And wired the paths from tree to API.
grok-4 hopped into the default seat,
Bearer tokens made the call complete.
Tests twitched their noses: all was neat.

Comment @coderabbitai help to get the list of available commands.

@igmarin
igmarin merged commit 1c87c25 into main Sep 14, 2026
6 checks passed
@igmarin
igmarin deleted the feat/xai-provider branch September 14, 2026 04:26
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.

1 participant