Hướng dẫn

OpenCode

Nhà cung cấp AI, server và phê duyệt cho OpenCode.

Hướng dẫn này hiện chỉ có bản tiếng Anh.

Install OpenCode on the machine running your environment, then enable it in Settings > Providers. See provider setup. VC requires OpenCode 1.14.19 or newer, including when you connect an existing OpenCode server.

Accounts and AI providers

Select OpenCode in Settings > Providers on web or desktop. Under Setup, use Sign in to connect an account through OpenCode’s terminal flow. Review the command, press Enter, and follow the prompts. Accounts lists CLI credentials; Sign out removes the account you choose. These actions run on the selected environment. Some sign-in methods need browser access on that machine.

Use Add AI provider to configure an API key, an optional Base URL, and model IDs for this instance. For a custom endpoint, select its API format and supply the Base URL and model IDs accepted by the service. Choose the model in the thread’s model picker. API keys are stored as secrets; leaving the key field blank while editing keeps the existing key. You can replace or explicitly remove it, or remove the connection. Signing out of the CLI does not remove these keys.

Connections configured here apply to OpenCode servers started by VC. When using an external Server URL, configure accounts and AI providers on that server. Existing OpenCode config files and CLI credentials remain available; accounts are shared across instances unless you set a separate XDG_DATA_HOME in the instance’s environment variables.

Local or external server

Leave Server URL empty to let VC start OpenCode locally. A password in provider settings applies to both that server and VC’s connection. With no password setting, the local server uses OPENCODE_SERVER_PASSWORD from its environment.

To use an existing OpenCode server, set Server URL and its password in provider settings. VC uses only that configured password for an external server; it does not forward a local OPENCODE_SERVER_PASSWORD. If connection or version checks fail, check the URL, credentials, and OpenCode version, then refresh provider status.

After a lost connection, send another prompt to reconnect to the same OpenCode session.

Approvals

OpenCode follows the shared permission modes. Auto has the same rules as Supervised because OpenCode has no AI approval reviewer. Environment files such as .env and .env.local need approval in restricted modes even though normal file reads do not; .env.example is allowed.

Allow for workspace applies to matching requests in other OpenCode sessions using the same workspace. It is broader than the current thread, especially on a shared external server. Use Allow once for a single request. Denying an action does not stop the whole turn.

Refresh models, commands, and skills

After changing an OpenCode login or configuration, use Refresh provider status in Settings > Providers for that environment. On mobile, use Refresh models in the thread settings. Reconnecting and periodic provider health checks also refresh the catalog while the provider is in use.

Credential changes are read on refresh. Native OpenCode configuration can remain cached while the local helper is running. Let it sit for 30 seconds without model refreshes or text-generation work, then refresh again to reload the files. Repeated refreshes keep the helper alive. An external server may need its own reload or restart before VC can see configuration changes.

Existing threads keep their selected model and options even when it disappears from the catalog. If OpenCode rejects that model, select an available one and retry.