--- title: "Connect OpenWork to XiuRouter" description: "Configure a workspace-specific OpenCode-compatible provider and save its key through OpenWork settings." image: "https://docs.xiu.ai/og.png" --- > XiuAI documentation index > Full documentation index: https://docs.xiu.ai/en/llms.txt > Check the index for current pages before reading. # Connect OpenWork to XiuRouter OpenWork uses the OpenCode engine for custom providers, but configuration belongs to the current workspace. Write the workspace config, reload it, then save the key in OpenWork settings. ## Choose a setup method - First setup: create `provider.xiurouter` in the workspace. - Existing setup: merge only that provider and keep other providers and models. - Chat-assisted setup: unavailable; workspace reload and credential connection still happen in OpenWork. ## Before you start Open or create the target workspace, create a dedicated XiuRouter key, and copy the exact model ID from the current catalog. ## Add a workspace provider Create `.config/opencode/opencode.json` inside the current workspace, including any missing directories. If it exists, merge only `provider.xiurouter`: ```json { "$schema": "https://opencode.ai/config.json", "provider": { "xiurouter": { "npm": "@ai-sdk/openai-compatible", "name": "XiuRouter", "options": { "baseURL": "https://router-api.xiu.ai/v1" }, "models": { "YOUR_MODEL_ID": { "name": "YOUR_MODEL_ID" } } } } } ``` This is workspace configuration, not global OpenCode configuration. Keep the real key out of the file. ## Reload and save the key 1. Close the workspace and reopen it. 2. Open **Settings → Cloud Providers**. 3. Find **XiuRouter** and connect it. 4. Paste the XiuRouter key. 5. Select `YOUR_MODEL_ID` in the model selector. OpenWork does not hot-reload providers. The settings and model list will not show the new provider until the workspace reloads. ## Verify 1. Start a task that reads and summarizes one file. 2. Confirm it uses `YOUR_MODEL_ID`. 3. Inspect the key, model, `/v1/chat/completions`, and successful result in XiuRouter. 4. After the read-only task succeeds, test a reversible file edit. ## Troubleshoot | Symptom | Next step | | --- | --- | | XiuRouter missing from the selector | Check the workspace `.config/opencode/opencode.json` path and fully reload | | Provider connection fails | Return to Cloud Providers and check that the key was saved for XiuRouter | | Request format incompatible | Use `@ai-sdk/openai-compatible` for `npm` | | XiuRouter missing from another workspace | Add it separately there; configuration is workspace-specific | ## Roll back Remove the workspace's XiuRouter provider, reload, and select the old model. Verify a new task before revoking the dedicated key. ## Sources and review date Reviewed on 2026-08-31. This translation preserves that date. Basic setup requires a full reply and matching successful request record. Source: https://docs.xiu.ai/en/router/integrations/openwork/index.mdx