π OpenHands: AI-Driven Development
Add Claude Opus 4.6 model support (#12767)
Graham Neubigd63565186e52
diff --git a/frontend/src/utils/verified-models.ts b/frontend/src/utils/verified-models.tsindex 73ed9d4b63..d9e57b5fcb 100644--- a/frontend/src/utils/verified-models.ts+++ b/frontend/src/utils/verified-models.ts@@ -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",diff --git a/openhands/llm/llm.py b/openhands/llm/llm.pyindex 1a0734a6ee..e15a18c491 100644--- a/openhands/llm/llm.py+++ b/openhands/llm/llm.py@@ -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.6kwargs.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 errorsif (('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.modelfor 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',)diff --git a/openhands/utils/llm.py b/openhands/utils/llm.pyindex 515803f454..40c47e2769 100644--- a/openhands/utils/llm.py+++ b/openhands/utils/llm.py@@ -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',