Skip to navigation

OpenHands (gateway)

Route OpenHands’ LLM calls through the Respan gateway for automatic logging, caching, and model switching. OpenHands uses LiteLLM under the hood and accepts any OpenAI-compatible base URL, so only your RESPAN_API_KEY is needed.

Setup

1

Install the OpenHands CLI

uv tool install openhands --python 3.12
2

Set environment variables

Add to your shell profile (.bashrc, .zshrc, or PowerShell $PROFILE):

export LLM_MODEL="openai/gpt-4o"
export LLM_BASE_URL="https://api.respan.ai/api"
export LLM_API_KEY="YOUR_RESPAN_API_KEY"

Keep the openai/ prefix on the model. It tells LiteLLM to use the OpenAI-compatible protocol, and the gateway receives the part after the prefix.

No separate provider key needed. The Respan gateway handles provider authentication.

3

Run OpenHands

OpenHands ignores LLM_* environment variables unless you pass --override-with-envs:

openhands --override-with-envs

For a one-shot, non-interactive run:

openhands --headless --override-with-envs -t "your task"

All LLM calls now route through Respan.

You can also set the same values from inside the CLI. Press Ctrl+P, open Settings, switch to Advanced, and fill in Custom Model (openai/gpt-4o), Base URL (https://api.respan.ai/api), and API Key. Settings persist in ~/.openhands/, so you no longer need --override-with-envs.

Switch models

Change LLM_MODEL to use any of the 1000+ models available through the gateway. Keep the openai/ prefix.

export LLM_MODEL="openai/gpt-4o"
# export LLM_MODEL="openai/claude-sonnet-4-5-20250929"
# export LLM_MODEL="openai/gemini/gemini-3.5-flash"

See the full model list.