A CLI tool for managing Opencode configuration. Switch, add, delete, set different AI models and providers.
ocs --help
usage: ocs [-h] [--config CONFIG] {ls,show,update,change,add,delete} ...
Open Code Model Configurator
positional arguments:
{ls,show,update,change,add,delete}
Available commands
ls List all models grouped by provider
show Show current model configuration
update Update models by querying provider /v1/models endpoints
change Change the model configuration value
add Add provider or model
delete Delete provider or model
options:
-h, --help show this help message and exit
--config CONFIG Path to config file (default: ~/.config/opencode/config.json)Install uv: https://docs.astral.sh/uv/getting-started/installation/
Install CLI:
uv tool install git+https://github.com/eleqtrizit/Opencode-Model-Configurator.git
Update CLI:
uv tool update opencode-model-configurator
- Python 3.11 or higher
- uv package manager
Clone the repository:
git clone https://github.com/eleqtrizit/Opencode-Model-Configurator.git
cd opencode_model_configuratorRe/Install the package in development mode:
make installRun in development mode without installation:
make devmake test- Run testsmake lint- Run linters (flake8, mypy)make format- Format code with autopep8make clean- Clean build artifacts
List all available models:
ocs lsShow current router configuration:
ocs showAdd a provider:
ocs add provider --name myprovider --base-url https://api.example.com --api-key YOUR_KEYAdd a model to a provider:
ocs add model myprovider my-model-nameDelete a provider (with confirmation):
ocs delete provider myproviderDelete a model (with confirmation):
ocs delete model my-model-name# will use auto discovery to determine if /v1 is required automatically
ocs add provider --name spark --base-url http://localhost