From 6ec7b63ebe68ba8999fab1b71331f239557e6035 Mon Sep 17 00:00:00 2001 From: Denis Shulyaka Date: Sun, 5 Oct 2025 22:29:24 +0300 Subject: [PATCH] Add support for Anthropic Claude Sonnet 4.5 (#153769) --- homeassistant/components/anthropic/const.py | 9 ++++----- homeassistant/components/anthropic/entity.py | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/anthropic/const.py b/homeassistant/components/anthropic/const.py index 356140ff66e..395f7fa8a81 100644 --- a/homeassistant/components/anthropic/const.py +++ b/homeassistant/components/anthropic/const.py @@ -19,9 +19,8 @@ CONF_THINKING_BUDGET = "thinking_budget" RECOMMENDED_THINKING_BUDGET = 0 MIN_THINKING_BUDGET = 1024 -THINKING_MODELS = [ - "claude-3-7-sonnet", - "claude-sonnet-4-0", - "claude-opus-4-0", - "claude-opus-4-1", +NON_THINKING_MODELS = [ + "claude-3-5", # Both sonnet and haiku + "claude-3-opus", + "claude-3-haiku", ] diff --git a/homeassistant/components/anthropic/entity.py b/homeassistant/components/anthropic/entity.py index 7338cbe2906..7c58326515e 100644 --- a/homeassistant/components/anthropic/entity.py +++ b/homeassistant/components/anthropic/entity.py @@ -51,11 +51,11 @@ from .const import ( DOMAIN, LOGGER, MIN_THINKING_BUDGET, + NON_THINKING_MODELS, RECOMMENDED_CHAT_MODEL, RECOMMENDED_MAX_TOKENS, RECOMMENDED_TEMPERATURE, RECOMMENDED_THINKING_BUDGET, - THINKING_MODELS, ) # Max number of back and forth with the LLM to generate a response @@ -364,7 +364,7 @@ class AnthropicBaseLLMEntity(Entity): if tools: model_args["tools"] = tools if ( - model.startswith(tuple(THINKING_MODELS)) + not model.startswith(tuple(NON_THINKING_MODELS)) and thinking_budget >= MIN_THINKING_BUDGET ): model_args["thinking"] = ThinkingConfigEnabledParam(