Skip to content

Commit 9d4ed40

Browse files
dot-agiclaude
andcommitted
fix(analyzer): normalize the wire model on the Anthropic API path
Review follow-up: the API analyzer client sent its model id to the Anthropic SDK unchanged, so an anthropic/-prefixed id (a canonical stored id after the prefix-routing change) would reach the API as an invalid wire model. The client now normalizes at construction with to_anthropic_api_model_id -- the prefix is stripped and Bedrock-shaped ids map to their dateless API id, the same normalization the CLI analyzer path applies. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012KtVx8UnLzag4idP3GDqa3
1 parent bd5a7c1 commit 9d4ed40

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

oddish/src/oddish/blocks/analyzer/analyzer_llm_client.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
_infer_provider_prefix,
2020
is_openai_platform_prefixed,
2121
settings,
22+
to_anthropic_api_model_id,
2223
)
2324

2425
_DEFAULT_MODEL = "claude-opus-4-8"
@@ -228,6 +229,11 @@ def __init__(
228229
# When set, the response is constrained to this JSON schema during
229230
# generation instead of being hand-written into free text.
230231
self._output_schema = output_schema
232+
# The Anthropic SDK only accepts plain API ids: strip an
233+
# ``anthropic/``/``claude/`` transport prefix and map
234+
# Bedrock-shaped ids to their dateless API id (the same
235+
# normalization the CLI analyzer path applies).
236+
self._model = to_anthropic_api_model_id(model) or model
231237
key = resolve_analyzer_api_key(api_key)
232238
self._anthropic = AsyncAnthropic(api_key=key) if key else AsyncAnthropic()
233239
self._openai = None

oddish/tests/test_analyzer_client_openai_usage.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,3 +201,17 @@ def test_bare_id_on_public_default_still_warns(monkeypatch):
201201
_warnings.simplefilter("error")
202202
_, wire = mod._build_openai_client(model="openai/gpt-5.2")
203203
assert wire == "gpt-5.2"
204+
205+
206+
def test_anthropic_path_normalizes_wire_model():
207+
from oddish.blocks.analyzer.analyzer_llm_client import ApiAnalyzerLLMClient
208+
209+
# The Anthropic SDK only accepts plain API ids: the transport prefix and
210+
# Bedrock-shaped ids both normalize at construction.
211+
client = ApiAnalyzerLLMClient(model="anthropic/claude-haiku-4-5")
212+
assert client._model == "claude-haiku-4-5"
213+
214+
client = ApiAnalyzerLLMClient(
215+
model="global.anthropic.claude-haiku-4-5-20251001-v1:0"
216+
)
217+
assert client._model == "claude-haiku-4-5"

0 commit comments

Comments
 (0)