From ee9e029d1c8336d2e1e477c22b407850d4e3fbe0 Mon Sep 17 00:00:00 2001 From: Duyet Le Date: Wed, 21 Oct 2026 14:28:21 +0700 Subject: [PATCH] fix(cli): default pi and claude aliases to anyrouter/free New accounts have no credits or BYOK, so the anthropic defaults failed on first run. Co-Authored-By: Claude Sonnet 5.5 Co-authored-by: Duyet Le Co-authored-by: duyetbot --- src/config.rs | 11 +++++++---- src/spawn.rs | 8 ++++---- tests/cli.rs | 8 ++++---- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/config.rs b/src/config.rs index 873805f..95f9bfb 100644 --- a/src/config.rs +++ b/src/config.rs @@ -10,10 +10,13 @@ pub const DEFAULT_PROFILE: &str = "default"; pub const DEFAULT_PRESET: &str = "@preset/coding-stack"; /// Documented gateway auto preset. Never invent a catalog SKU for this slot. pub const DEFAULT_MODEL: &str = "anyrouter/auto"; -pub const DEFAULT_CLAUDE_HAIKU: &str = "anthropic/claude-haiku-4.5"; -pub const DEFAULT_CLAUDE_SONNET: &str = "anthropic/claude-sonnet-4.6"; -pub const DEFAULT_CLAUDE_OPUS: &str = "anthropic/claude-opus-4.6"; -pub const DEFAULT_CLAUDE_FABLE: &str = "anthropic/claude-fable-5"; +/// Free-tier defaults: work for a brand-new account (no credits, no BYOK). +/// Switch with `--model` or `anyr models use`. Keep as string literals; the +/// anyrouter repo check parses them. +pub const DEFAULT_CLAUDE_HAIKU: &str = "anyrouter/free"; +pub const DEFAULT_CLAUDE_SONNET: &str = "anyrouter/free"; +pub const DEFAULT_CLAUDE_OPUS: &str = "anyrouter/free"; +pub const DEFAULT_CLAUDE_FABLE: &str = "anyrouter/free"; #[derive(Debug, Clone, PartialEq)] pub enum YamlValue { diff --git a/src/spawn.rs b/src/spawn.rs index ffb6391..d677145 100644 --- a/src/spawn.rs +++ b/src/spawn.rs @@ -7,7 +7,7 @@ use crate::config::{ Profile, YamlValue, DEFAULT_BASE_URL, DEFAULT_MODEL, DEFAULT_PRESET, DEFAULT_TIMEOUT_MS, }; -pub const PI_DEFAULT_MODEL: &str = "anthropic/claude-sonnet-4.6"; +pub const PI_DEFAULT_MODEL: &str = "anyrouter/free"; /// Historical 1M-context suffix used by Claude Code. Claude Code used to strip /// it before the gateway, but third-party catalog ids (e.g. /// `meituan/longcat-2.0`) are forwarded verbatim to the provider and 404 on @@ -1174,16 +1174,16 @@ mod tests { ); assert_eq!( env.get("ANTHROPIC_DEFAULT_HAIKU_MODEL").map(String::as_str), - Some("anthropic/claude-haiku-4.5") + Some("anyrouter/free") ); assert_eq!( env.get("ANTHROPIC_DEFAULT_SONNET_MODEL") .map(String::as_str), - Some("anthropic/claude-sonnet-4.6") + Some("anyrouter/free") ); assert_eq!( env.get("ANTHROPIC_DEFAULT_OPUS_MODEL").map(String::as_str), - Some("anthropic/claude-opus-4.6") + Some("anyrouter/free") ); } diff --git a/tests/cli.rs b/tests/cli.rs index f859cd3..eaa7583 100644 --- a/tests/cli.rs +++ b/tests/cli.rs @@ -706,15 +706,15 @@ fn claude_dry_run_with_key_prints_base_and_redacts_secret() { "{stdout}" ); assert!( - stdout.contains("ANTHROPIC_DEFAULT_HAIKU_MODEL=anthropic/claude-haiku-4.5"), + stdout.contains("ANTHROPIC_DEFAULT_HAIKU_MODEL=anyrouter/free"), "{stdout}" ); assert!( - stdout.contains("ANTHROPIC_DEFAULT_SONNET_MODEL=anthropic/claude-sonnet-4.6"), + stdout.contains("ANTHROPIC_DEFAULT_SONNET_MODEL=anyrouter/free"), "{stdout}" ); assert!( - stdout.contains("ANTHROPIC_DEFAULT_OPUS_MODEL=anthropic/claude-opus-4.6"), + stdout.contains("ANTHROPIC_DEFAULT_OPUS_MODEL=anyrouter/free"), "{stdout}" ); assert!(!stdout.contains(key), "full key leaked:\n{stdout}"); @@ -963,7 +963,7 @@ fn claude_dry_run_haiku_flag_overrides_alias() { "{stdout}" ); assert!( - stdout.contains("ANTHROPIC_DEFAULT_SONNET_MODEL=anthropic/claude-sonnet-4.6"), + stdout.contains("ANTHROPIC_DEFAULT_SONNET_MODEL=anyrouter/free"), "{stdout}" ); }