mirror of
https://github.com/OpenHands/OpenHands.git
synced 2026-03-22 13:47:19 +08:00
Add Claude Opus 4.6 model support (#12767)
Co-authored-by: openhands <openhands@all-hands.dev> Co-authored-by: neubig <neubig@users.noreply.github.com>
This commit is contained in:
@@ -8,6 +8,7 @@ export const VERIFIED_PROVIDERS = [
|
||||
"clarifai",
|
||||
];
|
||||
export const VERIFIED_MODELS = [
|
||||
"claude-opus-4-6",
|
||||
"claude-opus-4-5-20251101",
|
||||
"claude-sonnet-4-5-20250929",
|
||||
"gpt-5.2-codex",
|
||||
@@ -33,6 +34,7 @@ export const VERIFIED_OPENAI_MODELS = [
|
||||
// LiteLLM does not return the compatible Anthropic models with the provider, so we list them here to set them ourselves
|
||||
// (e.g., they return `claude-3-5-sonnet-20241022` instead of `anthropic/claude-3-5-sonnet-20241022`)
|
||||
export const VERIFIED_ANTHROPIC_MODELS = [
|
||||
"claude-opus-4-6",
|
||||
"claude-opus-4-5-20251101",
|
||||
"claude-sonnet-4-5-20250929",
|
||||
"claude-3-5-sonnet-20240620",
|
||||
@@ -50,6 +52,7 @@ export const VERIFIED_MISTRAL_MODELS = ["devstral-medium-2512"];
|
||||
// LiteLLM does not return the compatible OpenHands models with the provider, so we list them here to set them ourselves
|
||||
// (e.g., they return `claude-sonnet-4-20250514` instead of `openhands/claude-sonnet-4-20250514`)
|
||||
export const VERIFIED_OPENHANDS_MODELS = [
|
||||
"claude-opus-4-6",
|
||||
"claude-opus-4-5-20251101",
|
||||
"claude-sonnet-4-5-20250929",
|
||||
"gpt-5.2-codex",
|
||||
|
||||
@@ -160,9 +160,13 @@ class LLM(RetryMixin, DebugMixin):
|
||||
)
|
||||
elif any(
|
||||
k in self.config.model
|
||||
for k in ('claude-sonnet-4-5', 'claude-haiku-4-5-20251001')
|
||||
for k in (
|
||||
'claude-sonnet-4-5',
|
||||
'claude-haiku-4-5-20251001',
|
||||
'claude-opus-4-6',
|
||||
)
|
||||
):
|
||||
# don't send reasoning_effort to specific Claude Sonnet/Haiku 4.5 variants
|
||||
# don't send reasoning_effort to specific Claude Sonnet/Haiku 4.5 variants or Claude Opus 4.6
|
||||
kwargs.pop('reasoning_effort', None)
|
||||
else:
|
||||
if self.config.reasoning_effort is not None:
|
||||
@@ -198,10 +202,10 @@ class LLM(RetryMixin, DebugMixin):
|
||||
if 'claude-opus-4-1' in self.config.model.lower():
|
||||
kwargs['thinking'] = {'type': 'disabled'}
|
||||
|
||||
# Anthropic constraint: Opus 4.1, Opus 4.5, Opus 4.6, and Sonnet 4 models cannot accept both temperature and top_p
|
||||
# Anthropic constraint: Opus 4.1, Opus 4.5, Opus 4.6, and Sonnet 4.x models cannot accept both temperature and top_p
|
||||
# Prefer temperature (drop top_p) if both are specified.
|
||||
_model_lower = self.config.model.lower()
|
||||
# Apply to Opus 4.1, Opus 4.5, Opus 4.6, and Sonnet 4 models to avoid API errors
|
||||
# Apply to Opus 4.1, Opus 4.5, Opus 4.6, and Sonnet 4.x models to avoid API errors
|
||||
if (
|
||||
('claude-opus-4-1' in _model_lower)
|
||||
or ('claude-opus-4-5' in _model_lower)
|
||||
@@ -844,6 +848,7 @@ class LLM(RetryMixin, DebugMixin):
|
||||
k in self.config.model
|
||||
for k in (
|
||||
'openrouter/anthropic/claude-sonnet-4',
|
||||
'openrouter/anthropic/claude-opus-4-6',
|
||||
'openrouter/anthropic/claude-sonnet-4-5-20250929',
|
||||
'openrouter/anthropic/claude-haiku-4-5-20251001',
|
||||
)
|
||||
|
||||
@@ -14,6 +14,7 @@ from openhands.llm import bedrock
|
||||
# Hardcoded OpenHands provider models used in self-hosted mode.
|
||||
# In SaaS mode these are loaded from the database instead.
|
||||
OPENHANDS_MODELS = [
|
||||
'openhands/claude-opus-4-6',
|
||||
'openhands/claude-opus-4-5-20251101',
|
||||
'openhands/claude-sonnet-4-5-20250929',
|
||||
'openhands/gpt-5.2-codex',
|
||||
|
||||
Reference in New Issue
Block a user