Downsizing logodownsizing
Documentation

Using Downsizing with OpenCode

Route OpenCode traffic through Downsizing in seconds using the CLI.


Prerequisites

Install the Downsizing CLI — see the CLI guide if you haven't already.

Link OpenCode (Recommended)

Link OpenCode to Downsizing:

bash
ds link opencode

This writes a custom downsizing provider (backed by the Anthropic-compatible @ai-sdk/anthropic package) into your global OpenCode config and sets it as the default model. It's idempotent — safe to run again any time.

Manual Setup

If you prefer to configure manually, edit ~/.config/opencode/opencode.json and add:

json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "downsizing": {
      "npm": "@ai-sdk/anthropic",
      "name": "Downsizing",
      "options": {
        "baseURL": "https://api.downsizing.dev/YOUR_INFERENCE_ID/anthropic",
        "apiKey": "dws_YOUR_API_KEY"
      },
      "models": {
        "claude-opus-4-8": { "name": "Downsizing" }
      }
    }
  },
  "model": "downsizing/claude-opus-4-8"
}

Find your Inference ID and API key on the Inference API page.

Verify

Run a quick one-shot query to confirm traffic is routing through Downsizing:

bash
opencode run "hello"

If OpenCode responds, Downsizing is set up correctly. You can also check your savings dashboard to see the request appear in your usage metrics.

Unlinking

To remove Downsizing from OpenCode and restore your original settings:

bash
ds unlink opencode

Spot an error or something not working? Tell us on Discord or email docs@downsizing.dev.