Skip to main content
Connect OpenCode to NoMask for terminal chat and code editing.

Before you start

  • Create a key on the API Keys page and add funds to your API balance.
  • Choose a text model with Function calling and streaming on the Models page. Copy its exact model ID.
  • Use the connection values below. Replace key placeholders locally; keep secrets out of project files and source control.
Replace your-model-id throughout the examples with the exact ID of a text model that supports function calling and streaming. Check the Models page for current availability and limits.
Examples use your selected model. If you change it, also update context, output and image settings to match that model. These guides cover text models; Image Studio models use separate image endpoints.

Install and configure

1. Choose your OpenCode version

OpenCode 1 and 2 use different configuration formats and share the opencode command. Use the install and configuration for one version.
For native Windows with OpenCode 2, download the Windows CLI binary from the official install page, extract it and add its folder to your PATH. Windows package-manager installation is not supported for version 2.

2. Set your API key

3. Save the matching configuration

Create opencode.json in your project directory. Merge these settings if you already have one.
The compatible package uses Chat Completions. nomask/ is OpenCode’s connection prefix; the remaining value is the exact NoMask model ID, including any slashes.
These examples enable text input and tools. Add images only when the selected model supports vision. If you change the model, update its context and output limits from its model card.

Launch and test

For OpenCode 2, --standalone starts a fresh local session with the environment from this terminal. For version 1, launch normally.
  • Run /models and select nomask/your-model-id under NoMask.
  • Ask: Reply with exactly NOMASK_OK. Do not edit files.
  • Ask it to create nomask-test.txt containing NOMASK_OK. Review the file changes and any requested permissions.
If the model is unavailable, confirm the configuration matches your installed major version and the terminal has NOMASK_API_KEY. A model selected in an existing session can override the configured default; select it again with /models.

Troubleshooting

  • 401: check that your key is active and available to the process running the tool. Restart the tool after changing environment variables.
  • 402: add funds to your API balance or reduce the requested output.
  • 404: check the exact model ID and base URL. Direct connections use Chat Completions, not Responses or Anthropic Messages.
  • 429: wait for Retry-After. API keys share account limits; creating another key does not reset usage. Check the key’s monthly spending cap too.
  • Context or tool errors: start a shorter task, lower the output limit and confirm the model supports function calling. A plain text reply alone does not confirm file-editing tools work.
Check API Overview for usage and recent errors. Include the request ID when contacting support; never send your key. See Errors and Rate Limits.

Official references

Setup checked against the documentation below. Tool versions may change their settings or configuration format.