# Overview

> OpenHands can connect to any LLM supported by LiteLLM. However, it requires a powerful model to work.

<Note>
  This section is for users who want to connect OpenHands to different LLMs.
</Note>

<Info>
  OpenHands now delegates all LLM orchestration to the <a href="/sdk/arch/llm">Agent SDK</a>. The guidance on this
  page focuses on how the OpenHands interfaces surface those capabilities. When in doubt, refer to the SDK documentation
  for the canonical list of supported parameters.
</Info>

## Model Recommendations

Based on our evaluations of language models for coding tasks (using the SWE-bench dataset), we can provide some
recommendations for model selection. Our latest benchmarking results can be found in
[this spreadsheet](https://docs.google.com/spreadsheets/d/1wOUdFCMyY6Nt0AIqF705KN4JKOWgeI4wUGUP60krXXs/edit?gid=0).

Based on these findings and community feedback, these are the latest models that have been verified to work reasonably well with OpenHands:

### Cloud / API-Based Models

* [anthropic/claude-sonnet-4-20250514](https://www.anthropic.com/api) (recommended)
* [anthropic/claude-sonnet-4-5-20250929](https://www.anthropic.com/api) (recommended)
* [openai/gpt-5-2025-08-07](https://openai.com/api/) (recommended)
* [gemini/gemini-3-pro-preview](https://blog.google/products/gemini/gemini-3/)
* [deepseek/deepseek-chat](https://api-docs.deepseek.com/)
* [moonshot/kimi-k2-0711-preview](https://platform.moonshot.ai/docs/pricing/chat#generation-model-kimi-k2)

If you have successfully run OpenHands with specific providers, we encourage you to open a PR to share your setup process
to help others using the same provider!

For a full list of the providers and models available, please consult the
[litellm documentation](https://docs.litellm.ai/docs/providers).

<Warning>
  OpenHands will issue many prompts to the LLM you configure. Most of these LLMs cost money, so be sure to set spending
  limits and monitor usage.
</Warning>

### Local / Self-Hosted Models

* [mistralai/devstral-small](https://openhands.dev/blog/devstral-a-new-state-of-the-art-open-model-for-coding-agents) (20 May 2025) -- also available through [OpenRouter](https://openrouter.ai/mistralai/devstral-small:free)
* [all-hands/openhands-lm-32b-v0.1](https://openhands.dev/blog/introducing-openhands-lm-32b----a-strong-open-coding-agent-model) (31 March 2025) -- also available through [OpenRouter](https://openrouter.ai/all-hands/openhands-lm-32b-v0.1)

### Known Issues

<Note>
  Most current local and open source models are not as powerful. When using such models, you may see long
  wait times between messages, poor responses, or errors about malformed JSON. OpenHands can only be as powerful as the
  models driving it. However, if you do find ones that work, please add them to the verified list above.
</Note>

## LLM Configuration

The following can be set in the OpenHands UI through the Settings. Each option is serialized into the
`LLM.load_from_env()` schema before being passed to the Agent SDK:

* `LLM Provider`
* `LLM Model`
* `API Key`
* `Base URL` (through `Advanced` settings)

There are some settings that may be necessary for certain providers that cannot be set directly through the UI. Set them
as environment variables (or add them to your `config.toml`) so the SDK picks them up during startup:

* `LLM_API_VERSION`
* `LLM_EMBEDDING_MODEL`
* `LLM_EMBEDDING_DEPLOYMENT_NAME`
* `LLM_DROP_PARAMS`
* `LLM_DISABLE_VISION`
* `LLM_CACHING_PROMPT`

## LLM Provider Guides

We have a few guides for running OpenHands with specific model providers:

* [Azure](/openhands/usage/llms/azure-llms)
* [Google](/openhands/usage/llms/google-llms)
* [Groq](/openhands/usage/llms/groq)
* [Local LLMs with SGLang or vLLM](/openhands/usage/llms/local-llms)
* [LiteLLM Proxy](/openhands/usage/llms/litellm-proxy)
* [Moonshot AI](/openhands/usage/llms/moonshot)
* [OpenAI](/openhands/usage/llms/openai-llms)
* [OpenHands](/openhands/usage/llms/openhands-llms)
* [OpenRouter](/openhands/usage/llms/openrouter)

These pages remain the authoritative provider references for both the Agent SDK
and the OpenHands interfaces.

## Model Customization

LLM providers have specific settings that can be customized to optimize their performance with OpenHands, such as:

* **Custom Tokenizers**: For specialized models, you can add a suitable tokenizer.
* **Native Tool Calling**: Toggle native function/tool calling capabilities.

For detailed information about model customization, see
[LLM Configuration Options](/openhands/usage/advanced/configuration-options#llm-configuration).

### API retries and rate limits

LLM providers typically have rate limits, sometimes very low, and may require retries. OpenHands will automatically
retry requests if it receives a Rate Limit Error (429 error code).

You can customize these options as you need for the provider you're using. Check their documentation, and set the
following environment variables to control the number of retries and the time between retries:

* `LLM_NUM_RETRIES` (Default of 4 times)
* `LLM_RETRY_MIN_WAIT` (Default of 5 seconds)
* `LLM_RETRY_MAX_WAIT` (Default of 30 seconds)
* `LLM_RETRY_MULTIPLIER` (Default of 2)

If you are running OpenHands in development mode, you can also set these options in the `config.toml` file:

```toml  theme={null}
[llm]
num_retries = 4
retry_min_wait = 5
retry_max_wait = 30
retry_multiplier = 2
```


---

> To find navigation and other pages in this documentation, fetch the llms.txt file at: https://docs.openhands.dev/llms.txt