Connect OpenHands to byesu API
Key Takeaways
- OpenAI-compatible route (LiteLLM
openai/prefix): Set Custom Model toopenai/claude-sonnet-5-5,openai/gpt-6.2-sol, oropenai/deepseek-v4-proand Base URL tohttps://byesu.com/v1.- Native Anthropic route (
0.1xcache reads): Set Custom Model toanthropic/claude-opus-5-5oranthropic/claude-sonnet-5-5and Base URL tohttps://byesu.com(without/v1).- Headless CLI env vars: Configure
LLM_API_KEY,LLM_BASE_URL,LLM_MODEL, andLLM_CACHING_PROMPT=truewith a single defaultautogroupsk-...key.- 30–100 turn cost control: Prompt caching (
0.1xcached reads) plus pairingclaude-opus-5-5(planning) withclaude-sonnet-5-5ordeepseek-v4-pro(execution) keeps per-issue spend to a fraction of list rates, funded pay-as-you-go via USDT or Alipay.
OpenHands (formerly OpenDevin) is an autonomous software engineering agent that spins up an isolated sandbox container to inspect repositories, edit multi-file codebases, run test suites, and resolve GitHub issues end to end. Connecting OpenHands to byesu lets you switch seamlessly between Anthropic, OpenAI, Google, and DeepSeek models under one API key with per-request cost telemetry.
Quick configuration matrix
| Route in OpenHands | LLM_MODEL / Custom Model | LLM_BASE_URL / Base URL | Best For |
|---|---|---|---|
| Native Anthropic | anthropic/claude-opus-5-5 · anthropic/claude-sonnet-5-5 | https://byesu.com (no /v1) | Explicit cache_control (0.1x reads) & native Claude tool loops |
| OpenAI-Compatible | openai/gpt-6.2-sol · openai/deepseek-v4-pro · openai/claude-sonnet-5-5 | https://byesu.com/v1 (with /v1) | Unified /v1/chat/completions across GPT-6.2, DeepSeek V4 & Gemini 4 |
Step 0: Verify Your Key in 5 Seconds
Issue an sk-... token in the byesu Console under the default auto group (Quickstart). Before launching Docker sandboxes, run the 5-second terminal smoke test to confirm both /v1/chat/completions and /v1/messages respond cleanly:
curl -fsSL https://docs.byesu.com/setup/test.sh | sh(In non-interactive CI shells, pass your token directly: BYESU_KEY="sk-your-byesu-token" curl -fsSL https://docs.byesu.com/setup/test.sh | bash.) You can also generate ready-to-paste OpenHands env blocks in the Client & SDK Config Generator.
Option 1: OpenHands Docker Web UI Setup
- Start the OpenHands application container (
v0.54+):
docker run -it --rm --pull=always \
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.54-nikolaik \
-e LOG_ALL_EVENTS=true \
-v /var/run/docker.sock:/var/run/docker.sock \
-v ~/.openhands:/.openhands \
-p 3000:3000 \
--add-host host.docker.internal:host-gateway \
--name openhands-app \
ghcr.io/all-hands-ai/openhands:0.54Open
http://localhost:3000in your browser, click the Settings gear icon (bottom left) → LLM, and toggle Advanced ON.Fill in the fields depending on which wire protocol you prefer:
Route A — Native Anthropic (recommended for Claude
0.1xprompt caching):textCustom Model: anthropic/claude-sonnet-5-5 Base URL: https://byesu.com API Key: sk-your-byesu-tokenRoute B — OpenAI-compatible (for GPT-6.2, DeepSeek V4, or cross-vendor switching):
textCustom Model: openai/gpt-6.2-sol Base URL: https://byesu.com/v1 API Key: sk-your-byesu-tokenKeep Enable Prompt Caching checked (if shown in your UI build) and click Save Changes.
Option 2: Headless CLI & config.toml Automation
For automated issue resolution, SWE-bench evaluation, or GitHub Actions workflows, install the openhands CLI (uv tool install openhands-ai or pip install openhands-ai) and pass the LLM_* environment variables directly:
export LLM_API_KEY="sk-your-byesu-token"
# Native Anthropic route (NO /v1 suffix; preserves 0.1x cache reads)
export LLM_MODEL="anthropic/claude-sonnet-5-5"
export LLM_BASE_URL="https://byesu.com"
export LLM_CACHING_PROMPT="true"
export LLM_TIMEOUT="180"
openhands --override-cli-mode true \
-t "Reproduce the race condition in tests/test_worker_pool.py and patch pool.py until pytest passes."To run GPT-6.2 Sol or DeepSeek V4 Pro in headless mode, switch to the openai/ LiteLLM prefix and include /v1:
export LLM_API_KEY="sk-your-byesu-token"
export LLM_MODEL="openai/gpt-6.2-sol" # or "openai/deepseek-v4-pro"
export LLM_BASE_URL="https://byesu.com/v1"
export LLM_DROP_PARAMS="true"
export LLM_TIMEOUT="180"
python -m openhands.core.main -t "Audit SQL migrations in db/migrations/ for lock-timeout hazards."You can also persist multi-profile LLM blocks inside ~/.openhands/config.toml (or repository ./config.toml):
[core]
max_iterations = 60
[llm]
# Default fast executor with 0.1x cached prefix reads
model = "anthropic/claude-sonnet-5-5"
base_url = "https://byesu.com"
api_key = "sk-your-byesu-token"
caching_prompt = true
drop_params = true
timeout = 180
num_retries = 3
[llm.architect]
# Invoke via --llm-config architect for hard root-cause tickets
model = "anthropic/claude-opus-5-5"
base_url = "https://byesu.com"
api_key = "sk-your-byesu-token"
caching_prompt = true
drop_params = true
timeout = 240Cutting Spend Across 30–100 Iterative Agent Turns
Unlike single-shot chat prompts, a single OpenHands ticket routinely executes 30 to 100 bash, grep, file-edit, and pytest turns. Each turn resends OpenHands' system prompt, bash/editor tool definitions, and growing trajectory history — easily exceeding 1.5M cumulative input tokens per issue if uncached.
- Keep
0.1xPrompt Caching Active: Onclaude-sonnet-5-5,claude-opus-5-5, andgpt-6.2-sol, cached prefix tokens bill at0.1xof uncached input rates, whiledeepseek-v4-proapplies automatic prefix caching with zero cache-write surcharge. Because OpenHands appends new bash observations sequentially without mutating prior turns, cache hit ratios typically exceed 85% after turn 3 — see Prompt Caching, Explained. - Split Planning vs Execution Tiers: Use
anthropic/claude-opus-5-5oropenai/gpt-6.2-solto diagnose cross-module architecture bugs and write a concrete plan inPLAN.md, then run iterative test-fix loops onanthropic/claude-sonnet-5-5oropenai/deepseek-v4-proat a fraction of list rates. - Cap Runaway Loops: Set
max_iterations = 50–80inconfig.tomlso a failing test loop pauses for human review rather than spinning indefinitely. Fund your pay-as-you-go balance with USDT or Alipay with zero monthly subscription.
Troubleshooting Common Errors
404 Not Found(model_not_foundor/v1/v1/messages): OpenHands uses LiteLLM prefixes. WhenLLM_MODELstarts withanthropic/, setLLM_BASE_URL="https://byesu.com"(no/v1). WhenLLM_MODELstarts withopenai/, setLLM_BASE_URL="https://byesu.com/v1"(with/v1). Verify exact hyphenated IDs (claude-sonnet-5-5, notclaude-sonnet-5.5) — see Claude 404 model not found.401 AuthenticationError: ConfirmLLM_API_KEYhas no trailing newline or quotes inside Docker-eflags, and verify the key belongs to the defaultautogroup (Claude 401 fix, OpenAI 401 fix).400 BadRequestError(temperatureor unsupported sampling params): Enabledrop_params = true(LLM_DROP_PARAMS=true) and avoid hardcodingtemperatureon Claude 5.5 and GPT-6.2 reasoning tiers (Claude 400 temperature fix).
FAQ
How do I configure a custom model and Base URL in OpenHands for byesu?
Open Settings → LLM, toggle Advanced, and enter either anthropic/claude-sonnet-5-5 with Base URL https://byesu.com (native /v1/messages) or openai/gpt-6.2-sol with Base URL https://byesu.com/v1 (OpenAI-compatible /v1/chat/completions), using your auto-group sk-... key.
Which environment variables configure OpenHands headless CLI mode?
Export LLM_API_KEY, LLM_MODEL, LLM_BASE_URL, and LLM_CACHING_PROMPT=true before running openhands or python -m openhands.core.main.
How do I cut token spend across 30 to 100 OpenHands bash/edit turns?
Enable caching_prompt = true so repeated trajectory prefixes hit 0.1x cached reads on Claude 5.5 and GPT-6.2, and route day-to-day test-fix iterations to claude-sonnet-5-5 or deepseek-v4-pro while reserving claude-opus-5-5 for deep architectural tickets.
Why does OpenHands return 404 Not Found on anthropic/ vs openai/ model prefixes?
LiteLLM appends /v1/messages for anthropic/ models (expecting https://byesu.com) and appends /chat/completions for openai/ models (expecting https://byesu.com/v1).