OpenHands
Run the OpenHands agent on RouterPlex models.
On this page
Set it up with your coding agent #
Paste your key into the prompt's key field, then copy the prompt into Claude Code, Codex, Cursor, or any coding agent. It configures the tool and keeps testing until a real request goes through RouterPlex, fixing environment problems along the way. Prefer to do it by hand? Follow the manual setup below; your key fills those commands too.
Optional. It stays in this browser tab and is never saved or sent. No key yet? Create one in guided setup.
Set up OpenHands on this machine to use RouterPlex, an OpenAI- and Anthropic-compatible AI gateway. Keep working until a real request from OpenHands succeeds through RouterPlex.My RouterPlex API key: YOUR_ROUTERPLEX_API_KEYKey handling:- If the key line above is a placeholder rather than a real key (real keys start with sk-), use my ROUTERPLEX_API_KEY environment variable. If that is empty too, ask me for the key once, then continue.- Store the key only in user-level config or my user environment. Never put it in a project file, never commit it, and do not repeat the full key in your replies.Full guide: https://docs.routerplex.com/openhandsStep 1. Prove the key and the RouterPlex gateway work before changing anything else. Run:curl -sS https://api.routerplex.com/v1/chat/completions -H "Authorization: Bearer YOUR_ROUTERPLEX_API_KEY" -H "Content-Type: application/json" -d '{"model":"claude-sonnet-4-6","max_tokens":32,"messages":[{"role":"user","content":"Reply with exactly: RouterPlex connected."}]}'On Windows PowerShell, use curl.exe with the body in a file, or Invoke-RestMethod.- A reply containing "RouterPlex connected.": go on.- 401: the key is wrong or revoked. Stop and ask me for a correct key.- 402: my balance or trial credit is used up. 403: this key reached its own spending limit. Stop and tell me; retrying cannot fix these.- Network, DNS, TLS, or proxy errors: find and fix the cause (proxy variables, VPN, firewall, system clock, outdated CA certificates), then run it again.Step 2. Configure OpenHands:- OpenHands needs Docker and uv. On Windows it must run inside WSL2 Ubuntu, not native PowerShell. Check docker info works for my user.- Install it with: uv tool install openhands --python 3.12- Its LLM settings are entered in the app, not a file you should hand-edit. Tell me to run openhands serve, open Settings → LLM, turn on Advanced, and enter:Custom Model: openai/claude-sonnet-4-6Base URL: https://api.routerplex.com/v1API Key: <key>Then save and start a new conversation.Step 3. Test OpenHands itself from a new terminal or a restarted app, so you test the saved setup rather than the shell you changed:Ask me to send this in the new conversation and report the reply: Reply with exactly: RouterPlex connected. Do not modify files.Expected reply: "RouterPlex connected."Step 4. If step 1 works but step 3 fails, the problem is OpenHands's configuration or environment, not RouterPlex. Check these, fix what is wrong, and repeat step 3:- The key or base URL is set in one place but not where OpenHands starts: zsh vs bash startup files, login vs non-login shells, a desktop launcher, a background service, Windows vs WSL, or a remote SSH or container environment.- Another setting wins: OPENAI_API_KEY, OPENAI_BASE_URL, OPENAI_API_BASE, ANTHROPIC_API_KEY, ANTHROPIC_BASE_URL, or a project-level config that overrides the user-level one.- OpenHands is outdated, or still needs a full restart to read the new settings.- If an environment variable cannot be made to reach OpenHands reliably and OpenHands accepts a key in its user-level config, put the key there instead.Keep repeating steps 3 and 4 until the test reply comes back. Stop early only for a 401, 402, or 403, or for a step only I can do, such as a click in a settings window or a login. Then tell me exactly what to do, wait for me, and continue testing afterwards.When it works, tell me which files you changed, where the key is stored, and the final test output.
Manual setup #
Use RouterPlex in OpenHands' local UI or CLI. The model uses the openai/ prefix to select Chat Completions.
Windows uses WSL2 for this guide. Run the install and launch commands in an Ubuntu WSL terminal, not native PowerShell. OpenHands' official local setup also requires a working Docker environment for its default sandbox.
1. Prepare your operating system #
- macOS: install Docker Desktop and enable its default Docker socket. Install uv.
- Linux: install a supported Docker setup and uv. Confirm
docker infoworks for your user. - Windows: install WSL2 with Ubuntu and Docker Desktop. Enable Docker's WSL2 engine and Ubuntu integration. Run
wsl -d Ubuntufrom PowerShell, then install uv inside Ubuntu.
Use Python 3.12+; the uv command below selects Python 3.12 in an isolated environment.
2. Install and launch #
Run in the macOS/Linux/WSL terminal:
uv tool install openhands --python 3.12openhands serve
Follow the local URL printed by the launcher. It checks Docker and pulls the images needed for the UI. For the terminal interface, run openhands instead; its first-run wizard stores configuration in ~/.openhands/settings.json inside that environment.
To update the CLI, use uv tool upgrade openhands --python 3.12.
3. Configure RouterPlex #
In the UI, open Settings → LLM, enable Advanced, and enter:
Custom Model: openai/claude-sonnet-4-6Base URL: https://api.routerplex.com/v1API Key: YOUR_ROUTERPLEX_API_KEY
Save changes and start a new conversation. In the CLI first-run configuration, use the same model, base URL, and key values. Do not assume an old LLM_* environment-variable tutorial overrides a saved profile in your installed release.
For Windows, the OpenHands process and configuration live inside WSL. A key or configuration created only in your Windows home directory will not automatically reach it.
4. Verify #
Start with an empty test workspace and ask Reply with exactly: RouterPlex connected. Do not modify files. Confirm the reply and Usage. Then test reading a small disposable file to check the sandbox and tool loop.
A model must support the tools used by OpenHands. A successful connection alone does not establish compatibility with every autonomous coding workflow. Use a dedicated key and budget, and increase it only after reviewing a small test task.
Official references: OpenHands local setup, CLI installation, custom endpoints, LLM settings.