---
url: 'https://docs.byesu.com/en/clients/openhands.md'
description: >-
  Connect OpenHands (Docker UI & headless CLI) to byesu API: run Claude 5.5,
  GPT-6.2, and DeepSeek V4 with 0.1x prompt caching on one pay-as-you-go key.
---

# Connect OpenHands to byesu API

> **Key Takeaways**
>
> * **OpenAI-compatible route (LiteLLM `openai/` prefix)**: Set **Custom Model** to `openai/claude-sonnet-5-5`, `openai/gpt-6.2-sol`, or `openai/deepseek-v4-pro` and **Base URL** to `https://byesu.com/v1`.
> * **Native Anthropic route (`0.1x` cache reads)**: Set **Custom Model** to `anthropic/claude-opus-5-5` or `anthropic/claude-sonnet-5-5` and **Base URL** to `https://byesu.com` (**without `/v1`**).
> * **Headless CLI env vars**: Configure `LLM_API_KEY`, `LLM_BASE_URL`, `LLM_MODEL`, and `LLM_CACHING_PROMPT=true` with a single default **`auto`** group `sk-...` key.
> * **30–100 turn cost control**: Prompt caching (`0.1x` cached reads) plus pairing `claude-opus-5-5` (planning) with `claude-sonnet-5-5` or `deepseek-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](https://byesu.com)** lets you switch seamlessly between Anthropic, OpenAI, Google, and DeepSeek models under one API key with per-request cost telemetry.

::: tip 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](https://byesu.com/register) under the default **`auto`** group ([Quickstart](/en/guide/quickstart)). Before launching Docker sandboxes, run the 5-second terminal smoke test to confirm both `/v1/chat/completions` and `/v1/messages` respond cleanly:

```bash
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](/en/tools/config-generator)**.

## Option 1: OpenHands Docker Web UI Setup

1. Start the OpenHands application container (`v0.54+`):

```bash
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.54
```

2. Open `http://localhost:3000` in your browser, click the **Settings** gear icon (bottom left) → **LLM**, and toggle **Advanced** ON.

3. Fill in the fields depending on which wire protocol you prefer:

   **Route A — Native Anthropic (recommended for Claude `0.1x` prompt caching):**

   ```text
   Custom Model: anthropic/claude-sonnet-5-5
   Base URL:     https://byesu.com
   API Key:      sk-your-byesu-token
   ```

   **Route B — OpenAI-compatible (for GPT-6.2, DeepSeek V4, or cross-vendor switching):**

   ```text
   Custom Model: openai/gpt-6.2-sol
   Base URL:     https://byesu.com/v1
   API Key:      sk-your-byesu-token
   ```

4. Keep **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:

```bash
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`:

```bash
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`):

```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 = 240
```

## Cutting 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.

1. **Keep `0.1x` Prompt Caching Active**: On [`claude-sonnet-5-5`](/en/models/claude-sonnet-5-5), [`claude-opus-5-5`](/en/models/claude-opus-5-5), and [`gpt-6.2-sol`](/en/models/gpt-6-2), cached prefix tokens bill at **`0.1x`** of uncached input rates, while [`deepseek-v4-pro`](/en/models/deepseek-v4) applies 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](/en/guide/prompt-caching)**.
2. **Split Planning vs Execution Tiers**: Use `anthropic/claude-opus-5-5` or `openai/gpt-6.2-sol` to diagnose cross-module architecture bugs and write a concrete plan in `PLAN.md`, then run iterative test-fix loops on `anthropic/claude-sonnet-5-5` or `openai/deepseek-v4-pro` at a fraction of list rates.
3. **Cap Runaway Loops**: Set `max_iterations = 50`–`80` in `config.toml` so a failing test loop pauses for human review rather than spinning indefinitely. Fund your pay-as-you-go balance with **[USDT](/en/guide/pay-with-usdt)** or **Alipay** with zero monthly subscription.

## Troubleshooting Common Errors

* **`404 Not Found` (`model_not_found` or `/v1/v1/messages`)**: OpenHands uses LiteLLM prefixes. When `LLM_MODEL` starts with `anthropic/`, set `LLM_BASE_URL="https://byesu.com"` (**no `/v1`**). When `LLM_MODEL` starts with `openai/`, set `LLM_BASE_URL="https://byesu.com/v1"` (**with `/v1`**). Verify exact hyphenated IDs (`claude-sonnet-5-5`, not `claude-sonnet-5.5`) — see [Claude 404 model not found](/en/errors/claude-api-model-not-found-404).
* **`401 AuthenticationError`**: Confirm `LLM_API_KEY` has no trailing newline or quotes inside Docker `-e` flags, and verify the key belongs to the default **`auto`** group ([Claude 401 fix](/en/errors/claude-api-401-authentication-error), [OpenAI 401 fix](/en/errors/openai-api-401-invalid-api-key)).
* **`400 BadRequestError` (`temperature` or unsupported sampling params)**: Enable `drop_params = true` (`LLM_DROP_PARAMS=true`) and avoid hardcoding `temperature` on Claude 5.5 and GPT-6.2 reasoning tiers ([Claude 400 temperature fix](/en/errors/claude-api-400-temperature-top-p-not-supported)).

## 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`).

## Related Guides & Tools

* [Connect Block Goose CLI & Desktop to byesu API](/en/clients/goose)
* [Connect LangGraph Multi-Agent Workflows to byesu API](/en/clients/langgraph)
* [Connect Neovim (`avante.nvim` & `codecompanion.nvim`) to byesu API](/en/clients/neovim)
* [Prompt Caching, Explained (`0.1x` Cache Reads)](/en/guide/prompt-caching)
* [AI Client & SDK Config Generator](/en/tools/config-generator)
* [Pay for Claude & GPT API with USDT](/en/guide/pay-with-usdt)
