Downsizing logodownsizing
Documentation

Using Downsizing with OpenHands

Route OpenHands' LLM traffic through Downsizing using the CLI or manual configuration.


Prerequisites

Install the Downsizing CLI — see the CLI guide if you haven't already. You'll also need Docker running, since OpenHands itself is distributed and launched as a Docker container.

CLI Setup (Recommended)

The easiest way to connect OpenHands is with the Downsizing CLI. If you haven't installed it yet, grab it from the CLI guide.

Sign in, then link OpenHands:

bash
ds login
bash
ds link openhands

The CLI writes the correct base_url and api_key to ~/.openhands/config.toml. The command is idempotent — safe to run multiple times, and it edits only the block it owns, backing up your existing config the first time it runs.

Launch OpenHands

OpenHands runs as a Docker container and reads config.toml from a mounted ~/.openhands directory. After linking, mount that directory when you start the container:

bash
docker run -it --rm \
  -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.x-nikolaik \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v ~/.openhands:/.openhands \
  -p 3000:3000 \
  docker.all-hands.dev/all-hands-ai/openhands:0.x

Alternatively, skip ds link openhands entirely and pass the same values as environment variables when launching the container — OpenHands reads LLM_MODEL, LLM_BASE_URL, and LLM_API_KEY at startup:

bash
docker run -it --rm \
  -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.x-nikolaik \
  -e LLM_MODEL="anthropic/claude-opus-4-8" \
  -e LLM_BASE_URL="http://localhost:3001/YOUR_INFERENCE_ID/anthropic" \
  -e LLM_API_KEY="dws_YOUR_API_KEY" \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -p 3000:3000 \
  docker.all-hands.dev/all-hands-ai/openhands:0.x

Manual Setup

If you prefer to configure manually, edit ~/.openhands/config.toml and set:

toml
[llm]
model = "anthropic/claude-opus-4-8"
base_url = "http://localhost:3001/YOUR_INFERENCE_ID/anthropic"
api_key = "dws_YOUR_API_KEY"

Find your Inference ID and API key in the Inference API page. Replace YOUR_INFERENCE_ID with the workspace UUID and dws_YOUR_API_KEY with your Downsizing API key.

How it works

OpenHands sends all model requests through Downsizing over the native Anthropic Messages API, using your Downsizing API key for authentication. The anthropic/prefix on the model name tells OpenHands's underlying LiteLLM routing to call Anthropic's API shape against our base_urlrather than bridging through OpenAI's Chat Completions API. Downsizing validates the request, applies routing and reduction, then forwards the call using your stored credentials. Responses stream back to OpenHands unchanged.

Verify

Once the container is running, open http://localhost:3000and start a task, or use OpenHands' headless mode from inside the container:

bash
openhands --headless -t "say hello"

If OpenHands 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 OpenHands:

bash
ds unlink openhands

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