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.Install and configure
1. Choose your OpenCode version
OpenCode 1 and 2 use different configuration formats and share theopencode command. Use the install and configuration for one version.
- OpenCode 2 · macOS / Linux / WSL
- OpenCode 1
2. Set your API key
- macOS / Linux / WSL
- Windows PowerShell
3. Save the matching configuration
Createopencode.json in your project directory. Merge these settings if you already have one.
- OpenCode 2
- OpenCode 1
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.
- OpenCode 2
- OpenCode 1
- Run
/modelsand selectnomask/your-model-idunder NoMask. - Ask:
Reply with exactly NOMASK_OK. Do not edit files. - Ask it to create
nomask-test.txtcontainingNOMASK_OK. Review the file changes and any requested permissions.
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.