Utiliser NBility avec OpenCode
Installer OpenCode
bash
npm install -g opencode-ai@latestbash
brew install opencodebash
scoop install opencodeConfigurer NBility
- Obtenez votre cle API sur https://nbility.dev/console/token
- Definissez la variable d'environnement :
bash
export NBility_TOKEN=sk-xxxpowershell
$env:NBility_TOKEN="sk-xxx"- Creez
opencode.jsona la racine de votre projet ou dans~/.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
Remplacez sk-xxx par votre token reel obtenu depuis la console NBility.
Demarrage
bash
cd my-project
opencodeUne fois lance, selectionnez un modele sous le fournisseur NBility pour commencer.