CLI commands
Every command, every flag, every exit code.
nib login
Starts a device-code sign-in. Prints a short code, opens the browser, and polls until approval. Stores a bearer token at ~/.config/nib/config.json with mode 0600.
| Flag | Effect |
|---|---|
--no-open | Print the URL instead of opening a browser. Use over SSH. |
--api-url <url> | Override the gateway for this login only. |
nib logout
Removes the local config file. The token stays valid server-side until it expires; revoke it explicitly at sknib.com/keys if you suspect a leak.
nib status
Prints plan, credits used and remaining, weekly and daily caps, reset date, concurrency, RPM, and model count.
| Flag | Effect |
|---|---|
--json | Print the raw entitlement payload. Stable for scripts. |
Exit code 3 when the token is missing or expired, 4 when credits are exhausted.
nib models
Lists every model id routable on your plan, with its tier.
| Flag | Effect |
|---|---|
--json | Print the OpenAI-compatible model list. |
nib init
Writes a nib provider block into an OpenCode config and sets the default model. Idempotent: refuses to overwrite an existing Nib block unless --force is passed.
| Flag | Effect |
|---|---|
--model <id> | Set the default model. Must be in your plan. |
--project | Write opencode.json in the current directory. |
--force | Replace an existing Nib provider block. |
nib run [args...]
Launches the upstream OpenCode binary with NIB_API_KEY set from your stored token. All arguments are forwarded unchanged.
nib run "refactor the payment module"
nib run --model nib-frontier "why does this test hang?"
| Flag | Effect |
|---|---|
--dry-run | Print the command that would run. |
nib key print
Prints the API key for use in other tools. Intended for export NIB_API_KEY=$(nib key print). Exit code 3 if not signed in.
nib whoami
Prints the current plan name. Useful in scripts that gate on subscription tier.
Exit codes
| Code | Meaning | Usual fix |
|---|---|---|
| 0 | Success | — |
| 1 | Unexpected error | Read the message |
| 2 | Bad request or network failure | Check connectivity and NIB_API_URL |
| 3 | Not authenticated | nib login |
| 4 | Credits exhausted | Top up or upgrade |
| 5 | Rate limited | Wait for retry-after |
| 6 | Gateway error | Retry; check the status page |
| 64 | Usage error | nib --help |
| 127 | Upstream binary not found | Install opencode-ai |
Scripting
All commands are safe to run non-interactively. nib status --json and nib models --json never prompt, and nib login only opens a browser when a display is available. In CI, skip login entirely and set NIB_API_KEY.
if nib whoami | grep -q Starter; then
echo "on the starter plan"
fi
nib status --json | jq '.usage.credits_used'