Repository navigation
Description
Summary
Add OpenCode Go and Grok Supergrok (xAI OAuth) as supported AI providers in Silo's AI Services settings, alongside the existing OpenAI-compatible endpoint and ChatGPT plan options.
Motivation
Silo's AI features (subtitle translation, metadata translation, transcription) currently accept any OpenAI-compatible endpoint via manual base-URL/model/key entry. Users frequently ask for first-class support for popular providers so they don't have to look up endpoints and model names themselves. Two providers in particular are widely used:
- OpenCode Go — an OpenAI-compatible gateway (endpoint
https://opencode.ai/zen/go/v1, default modeldeepseek-v4-flash). Already integrated elsewhere as a standard API-key provider. - Grok Supergrok (xAI OAuth) — xAI's SuperGrok / X Premium+ tier accessed via OAuth device authorization (endpoint
https://api.x.ai/v1, default modelgrok-4.5). This is the same pattern as Silo's existing ChatGPT plan OAuth flow.
Implementation guidance
OpenCode Go (API-key provider, OpenAI-compatible)
This is the simpler of the two. It behaves like any other OpenAI-compatible endpoint — no custom HTTP shape, no OAuth. The work is mostly about making it discoverable:
- Default endpoint and model — add a preset or documentation entry:
- Base URL:
https://opencode.ai/zen/go/v1 - Default model:
deepseek-v4-flash - Auth: API key (Bearer token)
- Base URL:
- Hosted-provider detection — add
opencode.aito theKEY_REQUIRED_HOSTSlist inweb/src/pages/admin-settings/AISettings.tsxso the UI correctly marks a missing key as "API key required" instead of allowing a keyless (and doomed) request. - Transcription presets (optional) — if OpenCode Go offers a Whisper-compatible endpoint, add a preset to
TRANSCRIPTION_PRESETSin the same file. - Documentation — list OpenCode Go in the AI provider authentication docs (
docs/architecture/ai-provider-authentication.md) as a known compatible provider.
Grok Supergrok / xAI OAuth (OAuth provider, OpenAI-compatible)
This follows the same pattern as Silo's existing ChatGPT plan OAuth flow (auth_mode: "chatgpt"). The xAI OAuth flow uses device authorization (RFC 8628) rather than the browser redirect flow that OpenAI uses, but the Silo-side integration shape is identical: an auth_mode value, a connection dialog, token storage, and model catalog fetching.
- Auth mode — add
"xai-oauth"(or"supergrok") as a newauth_modevalue alongside"api_key"and"chatgpt"in the settings form and theai.auth_modesetting. - OAuth device flow — implement an xAI device-authorization flow analogous to the ChatGPT sign-in attempt flow:
POST https://api.x.ai/v1/oauth/device/codeto get a device code + user code- Poll
POST https://api.x.ai/v1/oauth/tokenuntil the user completes authorization - Store access token + refresh token + expiry, same as ChatGPT registration
- Token refresh — implement refresh-token rotation before expiry, same as the ChatGPT refresh path.
- Model catalog — fetch available models from
GET https://api.x.ai/v1/models, filtered togrok*chat models (exclude image/video/voice variants). - Endpoint — base URL
https://api.x.ai/v1, default modelgrok-4.5. - Recommended-family pairing — pair
xai(API-key) andxai-oauth(SuperGrok) as recommended siblings, so a recommended model name copies across. - UI — add a SuperGrok connection tile in
AISettings.tsxanalogous toChatGPTConnection, showing connection status, model picker, and disconnect. - Reasoning effort — xAI Grok models support reasoning; wire into the existing reasoning-effort selector.
- Documentation — document the xAI OAuth flow in
docs/architecture/ai-provider-authentication.md.
Shared considerations
- Both providers are OpenAI-compatible on the chat completions path, so no changes are needed in
internal/ai/llm/client.gobeyond possibly adding host entries tostrictHostedASRHostsintranscribe.goif they offer transcription. - The
reasoning.Validate/reasoning.OmitTemperaturefunctions ininternal/ai/reasoning/reasoning.gomay need entries for new model families (Grok, DeepSeek via OpenCode Go). - No database migration is strictly required if providers are configured via the existing
ai.*settings keys, but adding preset defaults would improve UX.
References
- Silo's existing ChatGPT OAuth —
internal/ai/chatgpt/package andweb/src/pages/admin-settings/ChatGPTConnection.tsxas the template for the SuperGrok connection UI. - xAI API documentation for device authorization flow and model listing.
- OpenCode Go API documentation for endpoint and model details.
Acceptance criteria
- OpenCode Go appears as a selectable preset (or is documented as a known-compatible provider) in AI Services settings, with correct default endpoint and model.
- Grok Supergrok can be connected via OAuth device flow, with model selection and token refresh.
- Both providers work for subtitle translation, metadata translation, and (where applicable) transcription.
- Documentation updated to list both providers.
Activity
feat(ai): add OpenCode Go and xAI/Grok as known compatible providers
feat(ai): add OpenCode Go and xAI/Grok as known compatible providers
feat(ai): add OpenCode Go and xAI/Grok as known compatible providers