What is OpenHands?
OpenHands is an open-source software development agent that can work with repositories, terminals, browsers, and configurable language models.
This OpenHands setup saves a TokenHub-backed LLM profile through Advanced LLM Settings. Use an OpenAI-prefixed LiteLLM model name and validate a read-only task in a new conversation before allowing changes. OpenHands routes custom models through LiteLLM, which is why the Custom Model value includes an OpenAI provider prefix as well as the exact TokenHub model ID. Saved LLM settings may not replace the profile of an existing conversation, so create a new session and validate repository reading before permitting terminal or file changes.
OpenHands resolves custom models through LiteLLM. The important step is not merely choosing “OpenAI,” but entering a provider-qualified Custom Model in the official Advanced LLM Settings. For TokenHub, use openai/YOUR_TOKENHUB_MODEL_ID.
Open Advanced LLM Settings
- Open LLM Settings in OpenHands.
- Turn on Advanced. The official Custom Model, Base URL, and API Key fields appear only in advanced settings.
- Enter
openai/YOUR_TOKENHUB_MODEL_IDin Custom Model. - Enter
https://us-api.tokenhub.com/v1in Base URL. - Enter your TokenHub API key in API Key.
- Click Save Changes.
The openai/ prefix tells LiteLLM to use its OpenAI-compatible route. The model ID sent to TokenHub is still the value after the slash. A bare ID does not reliably tell OpenHands which LiteLLM provider to use.
Start a new Conversation after saving
OpenHands documents that LLM settings apply to new conversations by default. Restart an existing conversation if it must use the new model. For a first connection test, create a new conversation so that an old LLM profile cannot affect the result.
Test the new conversation in this order:
- Ask OpenHands to read and explain one file without modifying it.
- Check the model ID, status code, and
/v1/chat/completionspath in TokenHub logs. - Then ask it to perform one explicit, reversible file edit or terminal command.
OpenHands also warns that it needs a capable model. If plain chat succeeds but the agent stalls at a tool step, the model may lack reliable tool calling; that does not necessarily mean the Base URL was lost.
Troubleshoot field by field
Model not foundor a LiteLLM routing error: confirm Custom Model isopenai/EXACT_MODEL_ID.- 401: save API Key again and do not include a
Bearerprefix. - 404: Base URL should end in
/v1, not/chat/completions. - Requests still use the old model: restart that conversation or create a new one.
- Text works but tools do not: choose a TokenHub model with documented native function calling.
Official reference
Choose a compatible OpenHands model
OpenHands custom LLM FAQ
How do I configure a custom LLM in OpenHands?
Open Settings → LLM → Advanced, set Custom Model to openai/<TokenHub Model ID>, then enter the TokenHub /v1 Base URL and API key.
Why does the OpenHands model need an openai/ prefix?
OpenHands uses LiteLLM routing. The prefix tells LiteLLM to send the exact following model ID through an OpenAI-compatible transport.
Why did an existing OpenHands conversation keep the old model?
Saved LLM settings may not replace an existing conversation profile. Start or restart a conversation and inspect the active LLM profile.
Which models are suitable for OpenHands?
Use a coding model with reliable native tool calling and enough context for the task. A model that only chats cannot reliably operate the terminal, browser, and file tools.
How should I test OpenHands safely?
Use a test repository and start with a read-only explanation or search. Check TokenHub logs, then allow file changes and commands gradually.
References
This setup is based on TokenHub and official documentation, last verified on 2026-09-08.