Skip to content

feat(providers): add xAI support - #873

Merged
Astro-Han merged 6 commits into
mainfrom
feat/xai-provider-support
Jul 13, 2026
Merged

Astro-Han merged 6 commits into
mainfrom
feat/xai-provider-support

Conversation

@Astro-Han

@Astro-Han Astro-Han commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add xAI as a first-class xai provider backed by the shared registry and checked-in models.dev snapshot.
  • Wire xAI API-key credentials, account model discovery, exact model selection, and OpenAI-compatible runtime execution across Desktop, CLI, and headless.
  • Render a traceable upstream xAI SVG through the shared provider-logo seam and ship the complete Lobe Icons MIT notice in the renderer distribution.

Why

xAI is the next Phase 3 hosted API slice in #860. This extends the Phase 2 registry seam instead of adding provider-specific lists or routing layers, while preserving exact Grok model IDs and using /v1/models as the account-specific source of truth.

Refs #860

Scope

This PR adds only the xAI direct API provider and the shared third-party notice delivery check required by its vendored Lobe Icons asset. It consumes the provider detail-header seam from #872 and does not add a parallel implementation. It does not implement other Phase 3 providers, Phase 7 conformance cleanup, or live-credential smoke evidence.

Verification

  • npm run typecheck — passed
  • npm test — all affected package suites passed; one resource-timing run hit the existing Rive child pid-file timeout, then the complete Desktop suite passed 2403/2403 on serial rerun
  • npm --workspace @maka/desktop run e2e — 15/15 passed with one worker
  • npm run check:stale — passed
  • Renderer build copied src/renderer/public/THIRD_PARTY_LICENSES.txt to dist-renderer byte-for-byte and the post-build notice contract passed
  • Deterministic xAI runtime conformance verified Bearer authentication, GET /v1/models, exact grok-4.5 preservation across both tool-loop requests, local tool execution and result round-trip, and the final assistant response
  • xAI catalog and saved-detail E2E verified that the real upstream SVG is consumed as a theme-aware CSS mask whose computed background follows the provider-logo foreground color

No standalone visual artifact is included because this extends the existing provider catalog/detail interaction; the deterministic Desktop E2E covers both rendered entry points and their computed asset contract.

Impact

Adds the persisted provider ID xai and the XAI_API_KEY, XAI_API_KEY_FILE, and XAI_BASE_URL headless configuration. Existing provider IDs and behavior remain compatible.

The vendored xai.svg is byte-identical to @lobehub/[email protected] at Lobe Icons commit 32f4083f7a20b67ecdc7b29c0af031ada5a29c52, upstream path packages/static-svg/icons/xai.svg, SHA-256 89eb7de9f0d02a41cfecd9109e253d7fd3529e27467dee4254faa67f3ac21451. The renderer distribution includes the complete upstream MIT notice.

No migration or release-note change is required.

Reviewer notes

The models.dev snapshot supplies model facts but currently omits xAI’s API base URL, so the registry pins the official https://api.x.ai/v1 endpoint. xAI uses the existing OpenAI-compatible adapter because the exercised official contract supports chat completions and model listing; no provider override was added.

The xAI SVG declares fill="currentColor". Because external <img> SVG documents do not inherit the parent color, the shared mark implementation consumes the byte-identical file as a CSS mask with background: currentColor; this keeps it legible across themes without modifying the upstream asset.

The required independent reviewer found no remaining findings and explicitly passed the final rebased diff after the dark-theme rendering fix.

Ready for review

  • Verification is complete and the results above are current
  • Impact, compatibility, migration, documentation, and release-note needs are addressed
  • User-visible UI/UX changes include visual evidence, or Verification explains why it is not applicable

@Astro-Han
Astro-Han marked this pull request as ready for review July 13, 2026 13:30
@Astro-Han
Astro-Han force-pushed the feat/xai-provider-support branch from d624dca to 0a2b9e1 Compare July 13, 2026 14:22
@Astro-Han
Astro-Han merged commit f854977 into main Jul 13, 2026
3 checks passed
@Astro-Han
Astro-Han deleted the feat/xai-provider-support branch July 13, 2026 14: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