Skip to content

docs(providers): add dedicated xAI / Grok provider guide#66

Merged
amondnet merged 7 commits into
mainfrom
amondnet/provider-docs
Jul 12, 2026
Merged

docs(providers): add dedicated xAI / Grok provider guide#66
amondnet merged 7 commits into
mainfrom
amondnet/provider-docs

Conversation

@amondnet

@amondnet amondnet commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Docs-only change to the Astro Starlight site under site/. Adds a dedicated per-provider guide for the xAI-family providers merged in #58 (grok and xai), links it from the providers overview, and corrects a couple of stale reference-doc gaps that predate this PR.

Changes

  • New guides/xai.md in all 4 locales (en, ko, ja, zh-cn), matching the existing codex.md depth. Documents both:
    • grok — SuperGrok / X Premium+ subscription OAuth via shunt login xai, backend cli-chat-proxy.grok.com
    • xai — API key (XAI_API_KEY), backend api.x.ai
    • Covers login, provider blocks, routing, model slugs, the opt-in reasoning-effort dial, context window, the no-web-search caveat, a full example, and troubleshooting.
  • Updated guides/providers.md (all 4 locales): added xai + grok to the built-in providers table, added a Grok section linking the new page, de-staled the shunt-xai plugin note, and backfilled the missing Subagent-plugins section in the ja locale for parity with the other locales.
  • Fixed reference/configuration.md (all 4 locales): the built-ins list omitted xai/grok and the auth enum omitted xai_oauth — a real accuracy gap now corrected.
  • Wired an "xAI / Grok" sidebar entry into site/astro.config.mjs right after Codex, with ko/ja/zh-CN labels.

Milestone / spec

Documentation for the xAI-family providers shipped in #58 (feat(xai): add grok subscription-OAuth provider via the Grok CLI proxy). No docs/ spec changes required — this is site-only user-facing documentation.

Checklist

  • cargo build passes — N/A, no Rust source changed (docs-only)
  • cargo test passes — N/A, no Rust source changed (docs-only)
  • cargo clippy --all-targets -- -D warnings clean — N/A, no Rust source changed (docs-only)
  • cargo fmt --all --check clean — N/A, no Rust source changed (docs-only)
  • Source files stay under 500 lines
  • English only; matches surrounding style — locale pages are ko/ja/zh-cn by design (site i18n), matching existing per-locale docs
  • Frozen spec in docs/ updated if this change deviates from it — N/A, no spec deviation
  • User-facing docs updated for behavior/config/endpoint/CLI/provider/model changes — this PR is the docs update (site/)
  • Any new GitHub Action is pinned to a full commit SHA — N/A, no workflow changes

Notes for reviewers

  • Verified with a full astro build (65 pages, no errors) before pushing.
  • The reference/configuration.md fixes (missing xai/grok builtins, missing xai_oauth auth enum) are pre-existing accuracy gaps from feat(xai): add grok subscription-OAuth provider via the Grok CLI proxy #58 landing without a docs update — bundled here since they're directly related to the new guide's accuracy.
  • ja/guides/providers.md picked up a Subagent-plugins section that the other locales already had; this is a parity backfill, not new content.

Summary by cubic

Adds a dedicated xAI / Grok provider guide across en/ko/ja/zh‑CN and wires it into the sidebar. Covers both grok (subscription OAuth via shunt login xaicli-chat-proxy.grok.com) and xai (API key to api.x.ai) with routing, model setup, and troubleshooting.

  • New Features

    • Added guides/xai.md in four locales with setup for grok and xai, routing, model slugs, opt‑in reasoning effort, context window, off‑origin token guard, web‑search caveat, example, and troubleshooting.
    • Added “xAI / Grok” to the sidebar; updated providers overview to list xai/grok and added a Grok section linking the guide; added subagent‑plugin notes in ko/ja/zh‑CN listing shunt-xai agents for grok-4.5/grok-4.3/grok-build-0.1.
  • Bug Fixes

    • Configuration reference (all locales) now includes built‑ins xai/grok and the auth enum xai_oauth.
    • Fixed localized anchor links; removed the false discovery claim; corrected $SHUNT_XAI_AUTH_FILE; clarified 0600 is the auth‑file permission; replaced the context‑window placeholder with CLAUDE_CODE_MAX_CONTEXT_TOKENS=256000; localized ja/ko code‑block comments and ja link texts.

Written for commit bd1ff28. Summary will update on new commits.

@codecov

codecov Bot commented Jul 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces comprehensive documentation across multiple languages (English, Japanese, Korean, and Chinese) for routing Claude Code to xAI's Grok models using the new grok (subscription-based) and xai (API key-based) providers. The documentation covers setup, configuration, model routing, reasoning effort, and troubleshooting. A review comment correctly identifies an issue in the English guide where an executable shell command example uses angle-bracket placeholders (<your-slug's real window>), which could be misinterpreted by the shell as input-redirection operators; it is recommended to use quoted shell variables instead.

Comment thread site/src/content/docs/guides/xai.md Outdated
@amondnet amondnet marked this pull request as ready for review July 12, 2026 11:18

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 13 files

Architecture diagram
sequenceDiagram
    participant User as Claude Code User
    participant CLI as shunt CLI
    participant Auth as xAI Auth Service
    participant File as ~/.shunt/xai-auth.json
    participant GW as shunt Gateway
    participant xAI as xAI Backend

    Note over User,xAI: NEW: xAI/Grok Provider Flow
    
    User->>CLI: shunt login xai
    CLI->>Auth: Device code login (RFC 8628)
    Auth-->>CLI: Tokens
    CLI->>File: Write tokens (0600 perm)
    File-->>CLI: Stored

    Note over User,GW: Runtime Gateway Flow
    
    User->>GW: Claude Code request (Anthropic Messages)
    
    alt Grok Subscription Path (provider = "grok")
        GW->>File: Read OAuth tokens from ~/.shunt/xai-auth.json
        GW->>GW: Add Grok CLI headers (x-xai-token-auth, x-grok-client-identifier, x-grok-client-version)
        GW->>GW: Transform Messages -> xAI Responses API
        opt Reasoning effort configured
            GW->>GW: Inject reasoning.effort field (opt-in only)
        end
        GW->>xAI: POST /v1/responses to cli-chat-proxy.grok.com
        xAI-->>GW: Streamed response
        GW-->>User: Translated Anthropic Messages response
    else xAI Developer API Path (provider = "xai")
        GW->>GW: Read XAI_API_KEY from environment
        GW->>GW: Transform Messages -> xAI Responses API
        opt Reasoning effort configured
            GW->>GW: Inject reasoning.effort field (opt-in only)
        end
        GW->>xAI: POST /v1/responses to api.x.ai with Bearer token
        xAI-->>GW: Streamed response
        GW-->>User: Translated Anthropic Messages response
    end

    Note over GW,xAI: NEW: Web Search Not Available
    
    alt Error Cases
        xAI-->>GW: 402 Payment Required (subscription on API key path, or no credits)
        xAI-->>GW: 403 Not Authorized (subscription tier gate)
        xAI-->>GW: 400 on reasoning.effort (unsupported model)
    end
Loading

Re-trigger cubic

@amondnet

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

본 풀요청(PR)은 SuperGrok 구독 또는 xAI 개발자 API를 통해 Claude Code 추론을 xAI의 Grok 모델로 라우팅할 수 있도록 지원하는 문서 및 구성 업데이트를 추가합니다. 이를 위해 xAI/Grok 전용 가이드 문서를 신설하고, 프로바이더 및 구성 참조 문서를 업데이트하였으며, 일본어, 한국어, 중국어 번역본을 함께 제공합니다. 리뷰어는 한국어 번역 가이드 문서(site/src/content/docs/ko/guides/xai.md) 내의 여러 설정 예시 및 셸 스크립트 코드 블록에 남아 있는 영어 주석과 섹션 참조 링크를 한국어로 번역하여 일관성과 가독성을 높이도록 개선을 제안했습니다.

Comment thread site/src/content/docs/ko/guides/xai.md Outdated
Comment thread site/src/content/docs/ko/guides/xai.md
Comment thread site/src/content/docs/ko/guides/xai.md
Comment thread site/src/content/docs/ko/guides/xai.md
@greptile-apps

greptile-apps Bot commented Jul 12, 2026

Copy link
Copy Markdown

Greptile Summary

This docs-only PR adds a dedicated xAI / Grok provider guide (guides/xai.md) to the Astro Starlight site in all four locales (en, ko, ja, zh-cn), links it from the providers overview and sidebar, and backfills two accuracy gaps in reference/configuration.md (missing built-ins xai/grok and auth enum value xai_oauth) left from PR #58.

  • New guides/xai.md (all 4 locales): documents both the grok subscription-OAuth path and the xai API-key path, covering login, provider blocks, model slugs, opt-in reasoning effort, context sizing, the web-search caveat, a full end-to-end example, and a troubleshooting table.
  • Updated guides/providers.md (all 4 locales): adds xai/grok rows to the built-in providers table, adds a summary section with a link to the new guide, and backfills the missing Subagent-plugins section in the ja locale for parity.
  • Fixed reference/configuration.md (all 4 locales): built-ins list now includes xai/grok; auth enum now includes xai_oauth with description.

Confidence Score: 5/5

Docs-only change with no Rust source modifications; safe to merge.

All fourteen changed files are Markdown/MJS documentation. The new xai.md guide accurately describes both credential paths (verified against the implementation details in PR #58). Configuration reference fixes are consistent across all four locales. Internal locale-prefixed links are correctly formed throughout. No logic, configuration, or binary behavior is altered.

No files require special attention. The README gap from a previous review thread was already addressed in commit a903d17.

Important Files Changed

Filename Overview
site/src/content/docs/guides/xai.md New English guide — accurate, comprehensive; covers both credential paths, opt-in effort, context sizing, web-search caveat, full example, and troubleshooting table.
site/src/content/docs/guides/providers.md Adds a summary xai/grok section with link to the dedicated guide; xai/grok rows were already in the built-in table (pre-existing from #58).
site/src/content/docs/reference/configuration.md Backfills missing xai/grok built-ins and xai_oauth auth enum value; change is accurate and matches the Rust implementation from #58.
site/astro.config.mjs Adds xAI / Grok sidebar entry after Codex with correct slug and locale labels; change is minimal and correct.
site/src/content/docs/ja/guides/xai.md Japanese locale guide; internal links correctly use /ja/ prefix; content mirrors the English guide.
site/src/content/docs/ko/guides/xai.md Korean locale guide; internal links correctly use /ko/ prefix; content mirrors the English guide.
site/src/content/docs/zh-cn/guides/xai.md Simplified Chinese locale guide; internal links correctly use /zh-cn/ prefix; content mirrors the English guide.
site/src/content/docs/ja/guides/providers.md Adds xai/grok table rows, summary section, and backfills the missing Subagent-plugins section for ja locale parity.
site/src/content/docs/ja/reference/configuration.md Backfills xai/grok built-ins and xai_oauth auth enum in the Japanese configuration reference.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant CC as Claude Code
    participant S as shunt
    participant G as grok proxy<br/>(cli-chat-proxy.grok.com/v1)
    participant X as xai API<br/>(api.x.ai/v1)

    CC->>S: Anthropic Messages request
    alt grok provider (xai_oauth)
        S->>S: translate to Responses API + add Grok CLI identity headers
        S->>G: POST /v1/responses Bearer xai-auth.json token
        G-->>S: streamed Responses reply
    else xai provider (api_key)
        S->>S: translate to Responses API
        S->>X: POST /v1/responses Bearer XAI_API_KEY
        X-->>S: streamed Responses reply
    end
    S-->>CC: translated Anthropic Messages reply
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant CC as Claude Code
    participant S as shunt
    participant G as grok proxy<br/>(cli-chat-proxy.grok.com/v1)
    participant X as xai API<br/>(api.x.ai/v1)

    CC->>S: Anthropic Messages request
    alt grok provider (xai_oauth)
        S->>S: translate to Responses API + add Grok CLI identity headers
        S->>G: POST /v1/responses Bearer xai-auth.json token
        G-->>S: streamed Responses reply
    else xai provider (api_key)
        S->>S: translate to Responses API
        S->>X: POST /v1/responses Bearer XAI_API_KEY
        X-->>S: streamed Responses reply
    end
    S-->>CC: translated Anthropic Messages reply
Loading

Reviews (7): Last reviewed commit: "docs(xai): use a concrete context-window..." | Re-trigger Greptile

Comment thread site/src/content/docs/guides/xai.md
@amondnet

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support and documentation for routing Claude Code inference to xAI's Grok models, supporting both the SuperGrok subscription (via OAuth) and the developer API (via API key). It includes comprehensive guides in English, Japanese, and Korean. The review feedback highlights several translation gaps in the Japanese guide, such as untranslated English link texts and code block comments, as well as inconsistent anchor links. It also recommends using quoted shell variables instead of raw placeholders in shell command examples to comply with the style guide.

Comment thread site/src/content/docs/ja/guides/xai.md Outdated
Comment thread site/src/content/docs/ja/guides/xai.md Outdated
Comment thread site/src/content/docs/ja/guides/xai.md Outdated
Comment thread site/src/content/docs/ja/guides/xai.md Outdated
Comment thread site/src/content/docs/ja/guides/xai.md Outdated
Comment thread site/src/content/docs/ja/guides/xai.md Outdated
Comment thread site/src/content/docs/ja/guides/xai.md Outdated
Comment thread site/src/content/docs/ja/guides/xai.md Outdated
@amondnet

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

본 풀 리퀘스트는 xAI/Grok 프로바이더(grokxai) 지원을 추가하고 관련 다국어(영어, 한국어, 일본어, 중국어) 가이드 및 설정 문서를 업데이트합니다. 리뷰어 피드백에서는 xAI 가이드 문서 내에서 0600이 토큰 값이 아닌 파일 권한(permissions)을 의미함을 명확히 하도록 다국어 문서 전반에 걸쳐 수정을 제안했습니다.

Comment thread site/src/content/docs/guides/xai.md Outdated
Comment thread site/src/content/docs/ko/guides/xai.md Outdated
Comment thread site/src/content/docs/ja/guides/xai.md Outdated
Comment thread site/src/content/docs/zh-cn/guides/xai.md Outdated
amondnet added a commit that referenced this pull request Jul 12, 2026
Rephrase the token-write sentence across all four locales so 0600 reads as a chmod permission on ~/.shunt/xai-auth.json rather than the token payload. Per gemini-code-assist review on PR #66.
@amondnet

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

이번 풀리퀘스트는 xAI의 Grok 모델을 지원하기 위해 grokxai 프로바이더에 대한 다국어(영어, 한국어, 일본어, 중국어) 가이드 문서와 설정 레퍼런스를 추가하고 관련 설정을 업데이트합니다. 리뷰 과정에서 실행 가능한 셸 명령 예시 내 플레이스홀더(YOUR_WINDOW)가 그대로 복사되어 실행될 때 오류를 유발할 수 있으므로, 이를 따옴표로 감싼 셸 변수("$MAX_TOKENS")로 개선하도록 권장하는 피드백이 제시되었습니다.

Comment thread site/src/content/docs/guides/xai.md Outdated
amondnet added a commit that referenced this pull request Jul 12, 2026
…lder

Replace the YOUR_WINDOW placeholder in the CLAUDE_CODE_MAX_CONTEXT_TOKENS example with a concrete grok-4-family integer (256000), matching the house convention in codex.md / effort-and-context.md and keeping the 'set your slug's real window' comment. Copy-paste-safe and avoids an undefined shell var. Per gemini-code-assist review on PR #66.
@amondnet

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

본 풀 리퀘스트는 Claude Code 추론을 xAI의 Grok 모델로 라우팅하기 위한 다국어 문서 및 설정 가이드를 추가합니다. 리뷰 결과, 일본어 번역 문서 파일들에서 한국어 텍스트가 유출되거나 오타가 발생한 다수의 번역 오류가 발견되어 이를 올바른 일본어 표현으로 수정하도록 피드백을 제공했습니다.

Comment thread site/src/content/docs/ja/guides/providers.md Outdated
Comment thread site/src/content/docs/ja/guides/xai.md
Comment thread site/src/content/docs/ja/guides/xai.md
Comment thread site/src/content/docs/ja/guides/xai.md
Comment thread site/src/content/docs/ja/guides/xai.md
Comment thread site/src/content/docs/ja/guides/xai.md
Comment thread site/src/content/docs/ja/guides/xai.md
Comment thread site/src/content/docs/ja/guides/xai.md
amondnet added 7 commits July 13, 2026 00:10
Add a standalone xai.md guide (en/ko/ja/zh-cn) covering the Grok
subscription-OAuth provider, link it from the sidebar, and reference
xai/grok as a built-in provider in providers.md and configuration.md
across all four locales.
… typo

- Localized xai.md cross-page anchors used English slugs that don't resolve
  against translated headings; point them at the real localized anchor IDs
  (verified from the built HTML).
- Drop the false 'model discovery exposes grok-4.5/grok-4.3' claim (config
  seeds an empty model catalog; discovery only surfaces claude-named aliases)
  — it also self-contradicted the next paragraph. All 4 locales.
- Troubleshooting row referenced $XAI_AUTH_FILE; the real override env var is
  $SHUNT_XAI_AUTH_FILE. All 4 locales.
…lder

Angle brackets in the CLAUDE_CODE_MAX_CONTEXT_TOKENS example could be parsed as
shell input-redirection when copy-pasted. Use an all-caps placeholder token
instead. All 4 locales.
- README.md: add xai/grok rows to the built-in provider table and mention
  them in the intro (AGENTS.md requires README updated with provider changes).
- ko/guides/xai.md: translate code-block comments to Korean to match the
  ko/codex.md convention (zh-cn was already translated; ja keeps English
  comments per ja/codex.md convention).
Bring ja/guides/xai.md to parity with ko/zh-cn: translate cross-page link
texts to the official ja sidebar titles (Effort とコンテキスト / モデルディスカバリー
/ プロバイダー) and translate all code-block comments to Japanese. Kept the
anchors that actually resolve (#reasoning-エフォート, not the non-existent
#推論エフォート) and the YOUR_WINDOW placeholder for cross-locale consistency.
Rephrase the token-write sentence across all four locales so 0600 reads as a chmod permission on ~/.shunt/xai-auth.json rather than the token payload. Per gemini-code-assist review on PR #66.
…lder

Replace the YOUR_WINDOW placeholder in the CLAUDE_CODE_MAX_CONTEXT_TOKENS example with a concrete grok-4-family integer (256000), matching the house convention in codex.md / effort-and-context.md and keeping the 'set your slug's real window' comment. Copy-paste-safe and avoids an undefined shell var. Per gemini-code-assist review on PR #66.
@amondnet amondnet force-pushed the amondnet/provider-docs branch from 03b0866 to bd1ff28 Compare July 12, 2026 15:43
@sonarqubecloud

Copy link
Copy Markdown

@amondnet amondnet merged commit eefcf01 into main Jul 12, 2026
13 checks passed
@amondnet amondnet deleted the amondnet/provider-docs branch July 12, 2026 15:47
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