Skip to content

Commit e19b3dd

Browse files
Add claude-sonnet-4-5 model support (OpenHands#11179)
Co-authored-by: openhands <[email protected]>
1 parent c3da6c2 commit e19b3dd

File tree

12 files changed

+32
-8
lines changed

12 files changed

+32
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ docker run -it --rm --pull=always \
100100
### Getting Started
101101

102102
When you open the application, you'll be asked to choose an LLM provider and add an API key.
103-
[Anthropic's Claude Sonnet 4](https://www.anthropic.com/api) (`anthropic/claude-sonnet-4-20250514`)
103+
[Anthropic's Claude Sonnet 4.5](https://www.anthropic.com/api) (`anthropic/claude-sonnet-4-5-20250929`)
104104
works best, but you have [many options](https://docs.all-hands.dev/usage/llms).
105105

106106
See the [Running OpenHands](https://docs.all-hands.dev/usage/installation) guide for

docs/usage/how-to/cli-mode.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ The conversation history will be saved in `~/.openhands/sessions`.
105105

106106
1. Set the following environment variables in your terminal:
107107
- `SANDBOX_VOLUMES` to specify the directory you want OpenHands to access ([See using SANDBOX_VOLUMES for more info](../runtimes/docker#using-sandbox_volumes))
108-
- `LLM_MODEL` - the LLM model to use (e.g. `export LLM_MODEL="anthropic/claude-sonnet-4-20250514"`)
108+
- `LLM_MODEL` - the LLM model to use (e.g. `export LLM_MODEL="anthropic/claude-sonnet-4-20250514"` or `export LLM_MODEL="anthropic/claude-sonnet-4-5-20250929"`)
109109
- `LLM_API_KEY` - your API key (e.g. `export LLM_API_KEY="sk_test_12345"`)
110110

111111
2. Run the following command:

docs/usage/how-to/headless-mode.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Set environment variables and run the Docker command:
5353
```bash
5454
# Set required environment variables
5555
export SANDBOX_VOLUMES="/path/to/workspace:/workspace:rw" # Format: host_path:container_path:mode
56-
export LLM_MODEL="anthropic/claude-sonnet-4-20250514"
56+
export LLM_MODEL="anthropic/claude-sonnet-4-20250514" # or "anthropic/claude-sonnet-4-5-20250929"
5757
export LLM_API_KEY="your-api-key"
5858
export SANDBOX_SELECTED_REPO="owner/repo-name" # Optional: requires GITHUB_TOKEN
5959
export GITHUB_TOKEN="your-token" # Required for repository operations

docs/usage/llms/llms.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Based on these findings and community feedback, these are the latest models that
1818
### Cloud / API-Based Models
1919

2020
- [anthropic/claude-sonnet-4-20250514](https://www.anthropic.com/api) (recommended)
21+
- [anthropic/claude-sonnet-4-5-20250929](https://www.anthropic.com/api) (recommended)
2122
- [openai/gpt-5-2025-08-07](https://openai.com/api/) (recommended)
2223
- [gemini/gemini-2.5-pro](https://blog.google/technology/google-deepmind/gemini-model-thinking-updates-march-2025/)
2324
- [deepseek/deepseek-chat](https://api-docs.deepseek.com/)

docs/usage/llms/openhands-llms.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ description: OpenHands LLM provider with access to state-of-the-art (SOTA) agent
1515

1616
When running OpenHands, you'll need to set the following in the OpenHands UI through the Settings under the `LLM` tab:
1717
- `LLM Provider` to `OpenHands`
18-
- `LLM Model` to the model you will be using (e.g. claude-sonnet-4-20250514)
18+
- `LLM Model` to the model you will be using (e.g. claude-sonnet-4-20250514 or claude-sonnet-4-5-20250929)
1919
- `API Key` to your OpenHands LLM API key copied from above
2020

2121
## Using OpenHands LLM Provider in the CLI
@@ -36,6 +36,7 @@ Pricing follows official API provider rates. Below are the current pricing detai
3636
|-------|----------------------------|-----------------------------------|------------------------------|------------------|-------------------|
3737
| claude-opus-4-20250514 | $15.00 | $1.50 | $75.00 | 200,000 | 32,000 |
3838
| claude-sonnet-4-20250514 | $3.00 | $0.30 | $15.00 | 200,000 | 64,000 |
39+
| claude-sonnet-4-5-20250929 | $3.00 | $0.30 | $15.00 | 200,000 | 64,000 |
3940
| devstral-medium-2507 | $0.40 | N/A | $2.00 | 128,000 | 128,000 |
4041
| devstral-small-2505 | $0.10 | N/A | $0.30 | 128,000 | 128,000 |
4142
| devstral-small-2507 | $0.10 | N/A | $0.30 | 128,000 | 128,000 |

frontend/src/mocks/handlers.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@ const openHandsHandlers = [
115115
"gpt-4o-mini",
116116
"anthropic/claude-3.5",
117117
"anthropic/claude-sonnet-4-20250514",
118+
"anthropic/claude-sonnet-4-5-20250929",
118119
"openhands/claude-sonnet-4-20250514",
120+
"openhands/claude-sonnet-4-5-20250929",
119121
"sambanova/Meta-Llama-3.1-8B-Instruct",
120122
]),
121123
),

frontend/src/utils/verified-models.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export const VERIFIED_MODELS = [
1313
"claude-3-5-sonnet-20241022",
1414
"claude-3-7-sonnet-20250219",
1515
"claude-sonnet-4-20250514",
16+
"claude-sonnet-4-5-20250929",
1617
"claude-opus-4-20250514",
1718
"claude-opus-4-1-20250805",
1819
"gemini-2.5-pro",
@@ -51,6 +52,7 @@ export const VERIFIED_ANTHROPIC_MODELS = [
5152
"claude-3-5-haiku-20241022",
5253
"claude-3-7-sonnet-20250219",
5354
"claude-sonnet-4-20250514",
55+
"claude-sonnet-4-5-20250929",
5456
"claude-opus-4-20250514",
5557
"claude-opus-4-1-20250805",
5658
];
@@ -67,6 +69,7 @@ export const VERIFIED_MISTRAL_MODELS = [
6769
// (e.g., they return `claude-sonnet-4-20250514` instead of `openhands/claude-sonnet-4-20250514`)
6870
export const VERIFIED_OPENHANDS_MODELS = [
6971
"claude-sonnet-4-20250514",
72+
"claude-sonnet-4-5-20250929",
7073
"gpt-5-2025-08-07",
7174
"gpt-5-mini-2025-08-07",
7275
"claude-opus-4-20250514",

openhands/cli/utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ def organize_models_and_providers(
165165

166166
VERIFIED_ANTHROPIC_MODELS = [
167167
'claude-sonnet-4-20250514',
168+
'claude-sonnet-4-5-20250929',
168169
'claude-opus-4-20250514',
169170
'claude-opus-4-1-20250805',
170171
'claude-3-7-sonnet-20250219',
@@ -186,6 +187,7 @@ def organize_models_and_providers(
186187

187188
VERIFIED_OPENHANDS_MODELS = [
188189
'claude-sonnet-4-20250514',
190+
'claude-sonnet-4-5-20250929',
189191
'gpt-5-2025-08-07',
190192
'gpt-5-mini-2025-08-07',
191193
'claude-opus-4-20250514',

openhands/llm/llm.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,10 @@ def __init__(
148148
logger.debug(
149149
f'Gemini model {self.config.model} with reasoning_effort {self.config.reasoning_effort} mapped to thinking {kwargs.get("thinking")}'
150150
)
151-
151+
elif 'claude-sonnet-4-5' in self.config.model:
152+
kwargs.pop(
153+
'reasoning_effort', None
154+
) # don't send reasoning_effort to Claude Sonnet 4.5
152155
else:
153156
kwargs['reasoning_effort'] = self.config.reasoning_effort
154157
kwargs.pop(
@@ -507,6 +510,7 @@ def init_model_info(self) -> None:
507510
'claude-3-7-sonnet',
508511
'claude-3.7-sonnet',
509512
'claude-sonnet-4',
513+
'claude-sonnet-4-5-20250929',
510514
]
511515
if any(model in self.config.model for model in sonnet_models):
512516
self.config.max_output_tokens = 64000 # litellm set max to 128k, but that requires a header to be set
@@ -817,6 +821,8 @@ def format_messages_for_llm(self, messages: Message | list[Message]) -> list[dic
817821
message.force_string_serializer = True
818822
if 'openrouter/anthropic/claude-sonnet-4' in self.config.model:
819823
message.force_string_serializer = True
824+
if 'openrouter/anthropic/claude-sonnet-4-5-20250929' in self.config.model:
825+
message.force_string_serializer = True
820826

821827
# let pydantic handle the serialization
822828
return [message.model_dump() for message in messages]

openhands/llm/model_features.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ class ModelFeatures:
103103
'gpt-5*',
104104
# DeepSeek reasoning family
105105
'deepseek-r1-0528*',
106+
'claude-sonnet-4-5*',
106107
]
107108

108109
PROMPT_CACHE_PATTERNS: list[str] = [

0 commit comments

Comments
 (0)