Simple CLI tool that generates opencode configuration for Nexos AI models. It fetches available models from the Nexos AI API and creates an opencode configuration file with proper model limits, costs, and variants.
- Node.js 18+
- opencode installed globally (
npm install -g opencode) NEXOS_API_KEYenvironment variable set with your Nexos AI API key
npm install -g opencode-nexos-models-configAdd to ~/.npmrc:
prefix=~/.npm-global
Add to ~/.bashrc:
export PATH="$HOME/.npm-global/bin:$PATH"Then reload shell and install:
source ~/.bashrc
npm install -g opencode-nexos-models-configAdd to ~/.npmrc:
prefix=~/.npm-global
Add to ~/.zshrc:
export PATH="$HOME/.npm-global/bin:$PATH"Then reload shell and install:
source ~/.zshrc
npm install -g opencode-nexos-models-confignpm update -g opencode-nexos-models-configOr to force the latest version:
npm install -g opencode-nexos-models-config@latestAfter global installation:
opencode-nexos-models-configOr without installation (using npx):
npx opencode-nexos-models-configThe tool will:
- Fetch the list of available models from the Nexos AI API
- Generate an opencode configuration with the nexos-provider plugin
- Write the config to
~/.config/opencode/opencode.json
By default, only models with predefined configuration (costs, limits, variants) are included. This is equivalent to running:
opencode-nexos-models-config
# or
opencode-nexos-models-config --supported-models
# or
opencode-nexos-models-config -mTo include all available models from the API (not just supported ones):
opencode-nexos-models-config --supported-models=false
# or
opencode-nexos-models-config -m falseThis filters the list to only include models from the curated SUPPORTED_MODELS list (see below).
If you have agents defined in your opencode.json (e.g. build, build-fast, build-heavy, plan), you can interactively assign models to them:
opencode-nexos-models-config --select-agentsThis opens an interactive prompt for each agent where you can search and select a model using arrow keys and type-to-filter.
To interactively set custom prices for models in your config:
opencode-nexos-models-config --custom-costsOr use the short flag:
opencode-nexos-models-config -cThis allows you to:
- Set custom input/output/cache prices per model
- See current costs while selecting
- Update prices for multiple models in one session
- Leave fields blank to keep existing values
When used with --supported-models, only supported models will be shown:
opencode-nexos-models-config -m -cThe tool automatically includes pricing information for all models in the generated configuration. Pricing includes:
- Input cost: Price per million input tokens
- Output cost: Price per million output tokens
- Cache read: Price per million cached tokens read (if supported)
- Cache write: Price per million tokens written to cache (if supported)
Default pricing:
- Supported models have predefined costs (see table below)
- Unknown models use fallback costs based on Claude Opus 4.6 pricing:
- Input: $5/M tokens
- Output: $25/M tokens
- Cache read: $0.5/M tokens
- Cache write: $6.25/M tokens
Custom pricing:
- Your existing custom costs are always preserved
- Use
--custom-costsflag to set new custom prices interactively - Custom costs take priority over default pricing
Note: The app always overwrites the entire model list with fresh data from the API on each run.
| Variable | Description | Default |
|---|---|---|
NEXOS_API_KEY |
Your Nexos AI API key (required) | - |
NEXOS_BASE_URL |
Custom API base URL | https://api.nexos.ai/v1 |
| Flag | Description | Default |
|---|---|---|
--help, -h |
Show help message | - |
--version, -v |
Show version number | - |
--select-agents, -s |
Interactively select models for agents defined in config | false |
--supported-models, -m |
Only include models with predefined configuration (true/false) |
true |
--custom-costs, -c |
Interactively set custom costs for models | false |
--output, -o |
Write config to a custom file path instead of default |
When using --supported-models flag, only these curated models are included:
| Model | Provider | Context | Output | Variants |
|---|---|---|---|---|
| Claude Opus 4.5 | Anthropic | 200k | 64k | low, high |
| Claude Opus 4.6 | Anthropic | 200k | 128k | low, high |
| Claude Sonnet 4.5 | Anthropic | 200k | 64k | low, high |
| GPT 5.2 | OpenAI | 400k | 128k | low, high |
| GPT 5 | OpenAI | 400k | 128k | low, high |
| Gemini 2.5 Pro | 1M | 65k | low, high | |
| Gemini 2.5 Flash | 1M | 65k | low, high | |
| Kimi K2.5 | Moonshot AI | 256k | 64k | - |
All models come with pre-configured context limits, output limits, and pricing information.
- low: Minimal thinking/reasoning (faster, cheaper)
- high: Extended thinking/reasoning (more accurate for complex tasks)
By default, the tool only includes supported models from the curated list above. This ensures you work with models that have pre-configured costs, limits, and variants.
To include all available models from the Nexos AI API (including unsupported ones):
opencode-nexos-models-config --supported-models=falseThe entire model list is replaced on each run to ensure you have the latest models and pricing.
Important: Your custom costs set via --custom-costs are preserved and take priority, but the model list itself is always refreshed from the API.
Model metadata is stored in models.config.mjs and includes:
- limits: Context window and max output tokens
- cost: Input/output pricing per 1M tokens, plus cache read/write if supported
- variants: Model-specific thinking/reasoning variants (low, high)
- options: Default model options (e.g., reasoningEffort)
MIT