Opair

The coding harness that eschews autonomy

Configuration

Opair can be configured with environment variables or a config.json file. This document is the guide for both.

Environment variables

If all you want is to use Opair with a single model provider and default settings, you can do it with a couple of environment variables, e.g.:

export OPAIR_PROVIDER=deepseek
export DEEPSEEK_API_KEY=...

Valid values for OPAIR_PROVIDER are any of the listed providers.

Valid API key environment variables are:

Config directory

By default, Opair looks for configuration in a per-user directory:

From there it tries to read config.json and it's also the default location for the loops/, mcp/, prompts/ and tools/ asset subdirectories. Session transcripts are saved there too under a sessions/ subdirectory.

All of these locations can be overriden at runtime with environment variables:

Setting these is especially useful if you've made changes to some assets and you don't want to clobber those changes when upgrading Opair.

Initial setup

Opair checks for valid configuration on startup. If no config is found, the setup wizard runs instead of the main application. So on a new installation, you can just run opair and set it up that way.

There's also an opair setup subcommand if you ever want to run the wizard explicitly. You can also specify provider keys as options to opair setup, e.g. opair setup deepseek.

/config

You can also configure Opair using the /config command within Opair itself. This command launches a sub-agent that will guide you through the configuration process.

config.json

config.json supports four top-level object properties: providers, roles, defaults and loops. Every setting in config.json is an overlay on application defaults, so a file that names one provider and nothing else is valid. If a config file doesn't match the expected schema, Opair aborts.

Providers

Each key under providers is the provider id. Valid provider ids are:

To enable a provider with the default settings, set it to an empty object:

{
  "providers": {
    "zai": {}
  }
}

Or you can set the following properties:

Default base URIs:

API keys are always read from the environment, either the default variable or the variable identified by apiKeyEnv.

Providers set in config.json take precedence over the OPAIR_PROVIDER environment variable.

Roles

Each key under roles is a role id. Valid role ids are:

Values under roles are model strings, either in the form {provider}/{model-id} or one of the tier literals frontier, standard or economy (see defaults). Note the providers used here must be configured; if a provider is used that's not set under providers, Opair aborts.

Unset, the plan, review, document and compactUncached roles use frontier, the driver, navigator and explain roles use standard, and the config and title roles use economy.

When a tier has no matching model on any configured provider, resolution falls back to the nearest tier, preferring the cheaper tier when two are equally close. A model that is not in the model catalog is never selected automatically, but you can still pick it explicitly by id.

Defaults

defaults specifies which models to use when a role names a tier instead of an explicit model:

Each value is a {provider}/{model-id} spec. With more than one provider configured, a default is required for each tier: frontier, standard and economy. Model specs that reference a default which isn't set are rejected when the config is resolved.

Loops

Each key under loops is a loop id. Valid loop ids are a subset of the valid role ids:

Values under loops are objects with the following properties:

Valid read permissions are:

Valid write permissions are everything under approveReads plus:

See the tools reference for more information about permissions.

Valid MCP integrations are:

See the MCP guide for more information about available MCP integrations.

Example

The example config below shows three different providers, specific models for certain roles, a loop-specific write approval and reasoning effort overrides:

{
  "providers": {
    "deepseek": {},
    "moonshot": {},
    "zai": {}
  },
  "defaults": {
    "frontier": "moonshot/kimi-k3.1-pro",
    "standard": "deepseek/deepseek-flash",
    "economy": "zai/glm-5.3-flash"
  },
  "roles": {
    "review": "zai/glm-5.3-flash"
  },
  "loops": {
    "driver": {
      "approveWrites": ["artifacts", "project"],
      "reasoningEffort": "low"
    },
    "navigator": {
      "reasoningEffort": "low"
    },
    "document": {
      "reasoningEffort": "high"
    },
    "plan": {
      "reasoningEffort": "low"
    }
  }
}

Model failover

When multiple providers are configured, HTTP 401, 402 and 403 responses will degrade an entire provider. A model-not-found error (HTTP 404) will degrade only that specific model. In both cases the router transparently fails over to the next available model or provider.

Transient errors (429, 5xx, network) are not failed over. They surface in the status area and you can retry.

Explicitly selecting a degraded model or provider via /model clears the degradation and retries. This can be useful after topping up API credits.

Running against llama.cpp

Start llama serve with:

Point baseUri at the server if it isn't on the default host and port. No LLAMACPP_API_KEY environment variable is needed unless your server needs authentication.

Reasoning effort is coarser than on hosted providers. "off" was verified against a live server to genuinely disable thinking. "low" and "high" both enable it, but whether llama-server distinguishes between the two was not verified.