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.xiurouterin 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:
{
"$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
- Close the workspace and reopen it.
- Open Settings → Cloud Providers.
- Find XiuRouter and connect it.
- Paste the XiuRouter key.
- Select
YOUR_MODEL_IDin 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
- Start a task that reads and summarizes one file.
- Confirm it uses
YOUR_MODEL_ID. - Inspect the key, model,
/v1/chat/completions, and successful result in XiuRouter. - 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.