Skip to content

Commit 74de7af

Browse files
author
1bcMax
committed
fix: use dashes in Claude model IDs (claude-opus-4-6 not 4.6) for Anthropic API compatibility
Fixes #38 - Model name translation error causing 404s
1 parent 390950e commit 74de7af

5 files changed

Lines changed: 41 additions & 36 deletions

File tree

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@blockrun/clawrouter",
3-
"version": "0.9.26",
3+
"version": "0.9.27",
44
"description": "Smart LLM router — save 78% on inference costs. 30+ models, one wallet, x402 micropayments.",
55
"type": "module",
66
"main": "dist/index.js",

scripts/reinstall.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,8 @@ echo ""
275275
echo "Run: openclaw gateway restart"
276276
echo ""
277277
echo "Model aliases available:"
278-
echo " /model sonnet4.6 → anthropic/claude-sonnet-4.6"
279-
echo " /model opus4.6 → anthropic/claude-opus-4.6"
278+
echo " /model sonnet4.6 → anthropic/claude-sonnet-4-6"
279+
echo " /model opus4.6 → anthropic/claude-opus-4-6"
280280
echo " /model codex → openai/gpt-5.2-codex"
281281
echo " /model deepseek → deepseek/deepseek-chat"
282282
echo " /model minimax → minimax/minimax-m2.5"

src/models.ts

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,23 @@ import type { ModelDefinitionConfig, ModelProviderConfig } from "./types.js";
1515
* Users can type `/model claude` instead of `/model blockrun/anthropic/claude-sonnet-4.6`.
1616
*/
1717
export const MODEL_ALIASES: Record<string, string> = {
18-
// Claude - short names
19-
claude: "anthropic/claude-sonnet-4.6",
20-
sonnet: "anthropic/claude-sonnet-4.6",
21-
opus: "anthropic/claude-opus-4.6", // Updated to latest Opus 4.6
22-
"opus-46": "anthropic/claude-opus-4.6",
23-
"opus-45": "anthropic/claude-opus-4.5",
24-
haiku: "anthropic/claude-haiku-4.5",
18+
// Claude - short names (use dashes in version, not dots - Anthropic API format)
19+
claude: "anthropic/claude-sonnet-4-6",
20+
sonnet: "anthropic/claude-sonnet-4-6",
21+
opus: "anthropic/claude-opus-4-6",
22+
"opus-46": "anthropic/claude-opus-4-6",
23+
"opus-45": "anthropic/claude-opus-4-5",
24+
haiku: "anthropic/claude-haiku-4-5",
2525
// Claude - provider/shortname patterns (common in agent frameworks)
26-
"anthropic/sonnet": "anthropic/claude-sonnet-4.6",
27-
"anthropic/opus": "anthropic/claude-opus-4.6",
28-
"anthropic/haiku": "anthropic/claude-haiku-4.5",
29-
"anthropic/claude": "anthropic/claude-sonnet-4.6",
26+
"anthropic/sonnet": "anthropic/claude-sonnet-4-6",
27+
"anthropic/opus": "anthropic/claude-opus-4-6",
28+
"anthropic/haiku": "anthropic/claude-haiku-4-5",
29+
"anthropic/claude": "anthropic/claude-sonnet-4-6",
30+
// Backward compatibility - old dot notation still works
31+
"anthropic/claude-sonnet-4.6": "anthropic/claude-sonnet-4-6",
32+
"anthropic/claude-opus-4.6": "anthropic/claude-opus-4-6",
33+
"anthropic/claude-opus-4.5": "anthropic/claude-opus-4-5",
34+
"anthropic/claude-haiku-4.5": "anthropic/claude-haiku-4-5",
3035

3136
// OpenAI
3237
gpt: "openai/gpt-4o",
@@ -258,7 +263,7 @@ export const BLOCKRUN_MODELS: BlockRunModel[] = [
258263

259264
// Anthropic - all Claude models excel at agentic workflows
260265
{
261-
id: "anthropic/claude-haiku-4.5",
266+
id: "anthropic/claude-haiku-4-5",
262267
name: "Claude Haiku 4.5",
263268
inputPrice: 1.0,
264269
outputPrice: 5.0,
@@ -267,7 +272,7 @@ export const BLOCKRUN_MODELS: BlockRunModel[] = [
267272
agentic: true,
268273
},
269274
{
270-
id: "anthropic/claude-sonnet-4.6",
275+
id: "anthropic/claude-sonnet-4-6",
271276
name: "Claude Sonnet 4.6",
272277
inputPrice: 3.0,
273278
outputPrice: 15.0,
@@ -287,7 +292,7 @@ export const BLOCKRUN_MODELS: BlockRunModel[] = [
287292
agentic: true,
288293
},
289294
{
290-
id: "anthropic/claude-opus-4.5",
295+
id: "anthropic/claude-opus-4-5",
291296
name: "Claude Opus 4.5",
292297
inputPrice: 5.0,
293298
outputPrice: 25.0,
@@ -297,7 +302,7 @@ export const BLOCKRUN_MODELS: BlockRunModel[] = [
297302
agentic: true,
298303
},
299304
{
300-
id: "anthropic/claude-opus-4.6",
305+
id: "anthropic/claude-opus-4-6",
301306
name: "Claude Opus 4.6",
302307
inputPrice: 5.0,
303308
outputPrice: 25.0,

src/router/config.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ export const DEFAULT_ROUTING_CONFIG: RoutingConfig = {
663663
"xai/grok-4-0709",
664664
"openai/gpt-5.2", // Newer and cheaper input than gpt-4o
665665
"openai/gpt-4o",
666-
"anthropic/claude-sonnet-4.6",
666+
"anthropic/claude-sonnet-4-6",
667667
],
668668
},
669669
REASONING: {
@@ -717,32 +717,32 @@ export const DEFAULT_ROUTING_CONFIG: RoutingConfig = {
717717
premiumTiers: {
718718
SIMPLE: {
719719
primary: "moonshot/kimi-k2.5", // $0.50/$2.40 - good for simple coding
720-
fallback: ["anthropic/claude-haiku-4.5", "google/gemini-2.5-flash", "xai/grok-code-fast-1"],
720+
fallback: ["anthropic/claude-haiku-4-5", "google/gemini-2.5-flash", "xai/grok-code-fast-1"],
721721
},
722722
MEDIUM: {
723723
primary: "openai/gpt-5.2-codex", // $2.50/$10 - strong coding for medium tasks
724724
fallback: [
725725
"moonshot/kimi-k2.5",
726726
"google/gemini-2.5-pro",
727727
"xai/grok-4-0709",
728-
"anthropic/claude-sonnet-4.6",
728+
"anthropic/claude-sonnet-4-6",
729729
],
730730
},
731731
COMPLEX: {
732-
primary: "anthropic/claude-opus-4.6", // Best quality for complex tasks
732+
primary: "anthropic/claude-opus-4-6", // Best quality for complex tasks
733733
fallback: [
734734
"openai/gpt-5.2-codex",
735-
"anthropic/claude-opus-4.5",
736-
"anthropic/claude-sonnet-4.6",
735+
"anthropic/claude-opus-4-5",
736+
"anthropic/claude-sonnet-4-6",
737737
"google/gemini-3-pro-preview",
738738
"moonshot/kimi-k2.5",
739739
],
740740
},
741741
REASONING: {
742-
primary: "anthropic/claude-sonnet-4.6", // $3/$15 - best for reasoning/instructions
742+
primary: "anthropic/claude-sonnet-4-6", // $3/$15 - best for reasoning/instructions
743743
fallback: [
744-
"anthropic/claude-opus-4.6",
745-
"anthropic/claude-opus-4.5",
744+
"anthropic/claude-opus-4-6",
745+
"anthropic/claude-opus-4-5",
746746
"openai/o4-mini", // Newer and cheaper than o3 ($1.10 vs $2.00)
747747
"openai/o3",
748748
"xai/grok-4-1-fast-reasoning",
@@ -756,7 +756,7 @@ export const DEFAULT_ROUTING_CONFIG: RoutingConfig = {
756756
primary: "moonshot/kimi-k2.5", // Cheaper than Haiku ($0.5/$2.4 vs $1/$5), larger context
757757
fallback: [
758758
"minimax/minimax-m2.5", // $0.30/$1.20 - agentic capable, cheaper than kimi
759-
"anthropic/claude-haiku-4.5",
759+
"anthropic/claude-haiku-4-5",
760760
"xai/grok-4-1-fast-non-reasoning",
761761
"openai/gpt-4o-mini",
762762
],
@@ -766,24 +766,24 @@ export const DEFAULT_ROUTING_CONFIG: RoutingConfig = {
766766
fallback: [
767767
"minimax/minimax-m2.5", // $0.30/$1.20 - agentic capable
768768
"moonshot/kimi-k2.5",
769-
"anthropic/claude-haiku-4.5",
770-
"anthropic/claude-sonnet-4.6",
769+
"anthropic/claude-haiku-4-5",
770+
"anthropic/claude-sonnet-4-6",
771771
],
772772
},
773773
COMPLEX: {
774-
primary: "anthropic/claude-sonnet-4.6",
774+
primary: "anthropic/claude-sonnet-4-6",
775775
fallback: [
776-
"anthropic/claude-opus-4.6", // Latest Opus - best agentic
776+
"anthropic/claude-opus-4-6", // Latest Opus - best agentic
777777
"minimax/minimax-m2.5", // $0.30/$1.20 - cheap agentic fallback
778778
"openai/gpt-5.2",
779779
"google/gemini-3-pro-preview",
780780
"xai/grok-4-0709",
781781
],
782782
},
783783
REASONING: {
784-
primary: "anthropic/claude-sonnet-4.6", // Strong tool use + reasoning for agentic tasks
784+
primary: "anthropic/claude-sonnet-4-6", // Strong tool use + reasoning for agentic tasks
785785
fallback: [
786-
"anthropic/claude-opus-4.6",
786+
"anthropic/claude-opus-4-6",
787787
"minimax/minimax-m2.5", // $0.30/$1.20 - reasoning + agentic
788788
"xai/grok-4-1-fast-reasoning",
789789
"deepseek/deepseek-reasoner",

0 commit comments

Comments
 (0)