Skip to content

Using NBility with OpenCode

Install OpenCode

bash
npm install -g opencode-ai@latest
bash
brew install opencode
bash
scoop install opencode

Configure NBility

  1. Get your API Key from https://nbility.dev/console/token
  2. Set the environment variable:
bash
export NBility_TOKEN=sk-xxx
powershell
$env:NBility_TOKEN="sk-xxx"
  1. Create opencode.json in your project root or ~/.config/opencode/:
json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "nbility-anthropic": {
      "npm": "@ai-sdk/anthropic",
      "name": "nbility-anthropic",
      "options": {
        "baseURL": "https://nbility.dev/v1",
        "apiKey": "{env:NBility_TOKEN}"
      },
      "models": {
        "claude-sonnet-4-6": {
          "name": "claude-sonnet-4-6"
        }
      }
    },
    "nbility-openai": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "nbility-openai",
      "options": {
        "baseURL": "https://nbility.dev/v1",
        "apiKey": "{env:NBility_TOKEN}"
      },
      "models": {
        "gpt-5.2-codex": {
          "name": "gpt-5.2-codex"
        }
      }
    }
  }
}

Important

Replace sk-xxx with your actual Token from the NBility console.

Launch

bash
cd my-project
opencode

Once launched, select a model under the NBility provider to start coding.