Configuration
Environment variables, the config file, and the OpenCode provider block.
Environment variables
| Variable | Default | Purpose |
|---|---|---|
NIB_API_URL | https://api.sknib.com | Gateway base URL. Plain http is accepted only for localhost and 127.0.0.1. |
NIB_API_KEY | — | Overrides the stored device token. Use in CI and scripts. |
NIB_OPENCODE_BIN | opencode | Path or name of the upstream binary launched by nib run. |
XDG_CONFIG_HOME | ~/.config | Base directory for the Nib and OpenCode configs. |
NO_COLOR | — | Disables ANSI colour in CLI output. |
Nib config file
Location: $XDG_CONFIG_HOME/nib/config.json, defaulting to ~/.config/nib/config.json. Created with mode 0600.
{
"apiUrl": "https://api.sknib.com",
"token": "nib_dev_...",
"tokenIssuedAt": "2026-10-27T09:12:44.201Z",
"email": "[email protected]",
"planName": "Starter"
}
nib logout and revoke the token in the console.OpenCode provider block
nib init writes this into ~/.config/opencode/opencode.json, merging with any existing keys rather than replacing the file.
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"nib": {
"npm": "@ai-sdk/openai-compatible",
"name": "Nib",
"options": {
"baseURL": "https://api.sknib.com/v1",
"apiKey": "{env:NIB_API_KEY}"
},
"models": {
"nib-efficient": { "name": "nib-efficient" },
"nib-frontier": { "name": "nib-frontier" }
}
}
},
"model": "nib/nib-efficient"
}
The apiKey value is an environment reference, not a literal. Before launching, export the key:
export NIB_API_KEY=$(nib key print)
nib run
Project-local configuration
For a team that wants the same model defaults across a repository, commit an opencode.json at the project root:
nib init --project --model nib-frontier
Because the key is an environment reference, committing this file is safe.
Precedence
- Command-line flags
NIB_API_URL/NIB_API_KEY- Nib config file
- Built-in defaults
OpenCode merges its own configs in a separate order; opencode.json in a project overrides the global file for conflicting keys, and non-conflicting keys from both are preserved.
Self-hosted gateway
If you run your own gateway, point the CLI at it:
nib login --api-url https://gateway.internal.example
# or, persistently:
export NIB_API_URL=https://gateway.internal.example
The gateway must implement the endpoints in the API reference.