Skip to Content

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.

Paste this into your coding agent:

Help me set up the Respan gateway with the OpenHands integration. Follow https://www.respan.ai/docs/integrations/gateway/open-hands.md

Setup

Install the OpenHands CLI

Terminal
uv tool install openhands --python 3.12

Set environment variables

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

Terminal
export LLM_MODEL="openai/gpt-4o" export LLM_BASE_URL="https://gateway.respan.ai" 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.

Run OpenHands

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

Terminal
openhands --override-with-envs

For a one-shot, non-interactive run:

Terminal
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://gateway.respan.ai), 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.

Terminal
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 .