Skip to content

eleqtrizit/Opencode-Model-Configurator

Repository files navigation

Open Code Model Configurator

A CLI tool for managing Opencode configuration. Switch, add, delete, set different AI models and providers.

Features

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)

Fast Install

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

Development Setup

Prerequisites

  • Python 3.11 or higher
  • uv package manager

Env Setup

Clone the repository:

git clone https://github.com/eleqtrizit/Opencode-Model-Configurator.git
cd opencode_model_configurator

Re/Install the package in development mode:

make install

Running the CLI

Run in development mode without installation:

make dev

Development Commands

  • make test - Run tests
  • make lint - Run linters (flake8, mypy)
  • make format - Format code with autopep8
  • make clean - Clean build artifacts

Usage

Basic Commands

List all available models:

ocs ls

Show current router configuration:

ocs show

Provider and Model Management

Add a provider:

ocs add provider --name myprovider --base-url https://api.example.com --api-key YOUR_KEY

Add a model to a provider:

ocs add model myprovider my-model-name

Delete a provider (with confirmation):

ocs delete provider myprovider

Delete 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

About

A simple cli to add and remove models to Opencode

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published