Skip to content

Craft Anything: understand how any software works, and craft your own.

Rust

Offer Kimi K3.1 Pro instead of the older Kimi K3 (#655)

Firefly2d06e6642e52
diff --git a/crates/ai/src/detect.rs b/crates/ai/src/detect.rs
index 7b8c5776..470fef41 100644
--- a/crates/ai/src/detect.rs
+++ b/crates/ai/src/detect.rs
@@ -31,22 +31,22 @@ pub fn env_keys(get: impl Fn(&str) -> Option<String>) -> Vec<Detected> {
out.push(Detected { suggestion: cfg(name, kind, model), reason: format!("Found {var} in your environment"), needs_key: false });
}
}
- // Kimi K3 builds through OpenRouter: with its key found, or one the person pastes.
+ // Kimi K3.1 Pro builds through OpenRouter: with its key found, or one the person pastes.
let found = get("OPENROUTER_API_KEY").is_some_and(|v| !v.trim().is_empty());
out.push(Detected {
- suggestion: cfg(KIMI_NAME, BackendKind::Openrouter, crate::openai::KIMI_K3),
+ suggestion: cfg(KIMI_NAME, BackendKind::Openrouter, crate::openai::KIMI_K3_1),
reason: if found {
- "Kimi K3 through OpenRouter, with the OPENROUTER_API_KEY in your environment".into()
+ "Kimi K3.1 Pro through OpenRouter, with the OPENROUTER_API_KEY in your environment".into()
} else {
- "Kimi K3 through OpenRouter: paste your OpenRouter key".into()
+ "Kimi K3.1 Pro through OpenRouter: paste your OpenRouter key".into()
},
needs_key: !found,
});
out
}
-/// The name Kimi K3 is added under.
-pub const KIMI_NAME: &str = "Kimi K3 (OpenRouter)";
+/// The name Kimi K3.1 Pro is added under.
+pub const KIMI_NAME: &str = "Kimi K3.1 Pro (OpenRouter)";
/// Is something listening at this URL's host:port? (bounded TCP connect)
pub fn port_open(base_url: &str, timeout: Duration) -> bool {
@@ -259,9 +259,9 @@ mod tests {
assert_eq!(d.len(), 2);
assert_eq!(d[0].suggestion.kind, BackendKind::Openrouter);
assert!(d[0].reason.contains("OPENROUTER_API_KEY"));
- // Kimi K3 rides on the same key, so it needs none of its own.
- assert_eq!((d[1].suggestion.model.as_str(), d[1].needs_key), (crate::openai::KIMI_K3, false));
- // Without a key, Kimi K3 is still offered, asking for one.
+ // Kimi K3.1 Pro rides on the same key, so it needs none of its own.
+ assert_eq!((d[1].suggestion.model.as_str(), d[1].needs_key), (crate::openai::KIMI_K3_1, false));
+ // Without a key, Kimi K3.1 Pro is still offered, asking for one.
let none = env_keys(|_| Some(" ".into()));
assert_eq!(none.len(), 1);
assert!(none[0].needs_key && none[0].suggestion.name == KIMI_NAME);
diff --git a/crates/ai/src/openai.rs b/crates/ai/src/openai.rs
index 3313e78a..b2a5f483 100644
--- a/crates/ai/src/openai.rs
+++ b/crates/ai/src/openai.rs
@@ -12,10 +12,10 @@ pub const OPENAI_BASE: &str = "https://api.openai.com/v1";
pub const OPENROUTER_BASE: &str = "https://openrouter.ai/api/v1";
pub const OPENAI_DEFAULT_MODEL: &str = "gpt-5";
pub const OPENROUTER_DEFAULT_MODEL: &str = "anthropic/claude-opus-5-5";
-/// Kimi K3 (Moonshot AI) on OpenRouter: 1M-token context, tool calls.
-pub const KIMI_K3: &str = "moonshotai/kimi-k3";
+/// Kimi K3.1 Pro (Moonshot AI) on OpenRouter: 1M-token context, tool calls.
+pub const KIMI_K3_1: &str = "moonshotai/kimi-k3.1-pro";
/// OpenRouter models offered when adding it.
-pub const OPENROUTER_MODELS: &[&str] = &[OPENROUTER_DEFAULT_MODEL, KIMI_K3];
+pub const OPENROUTER_MODELS: &[&str] = &[OPENROUTER_DEFAULT_MODEL, KIMI_K3_1];
/// Generic app identification for OpenRouter (no personal data).
pub const APP_REFERER: &str = "https://github.com/storytold/craft-anything";
pub const APP_TITLE: &str = "Craft Anything";
diff --git a/crates/ai/src/price.rs b/crates/ai/src/price.rs
index ea9c6f32..b83b4b6f 100644
--- a/crates/ai/src/price.rs
+++ b/crates/ai/src/price.rs
@@ -18,8 +18,8 @@ pub fn builtin(model: &str) -> Option<Price> {
"claude-fable-5-1" => p(10.0, 50.0, 0.25),
"claude-opus-5" => p(5.0, 25.0, 0.50),
"claude-sonnet-5" => p(2.0, 10.0, 0.20),
- // OpenRouter's list price (checked 2026-10-20); cached input isn't listed, so the default.
- "kimi-k3" => Price { input_per_mtok: 0.239, output_per_mtok: 11.936, cache_read_per_mtok: None, cache_write_per_mtok: None },
+ // OpenRouter's list price (checked 2026-11-03).
+ "kimi-k3.1-pro" => p(2.0, 10.0, 0.20),
_ => return None,
})
}
@@ -76,10 +76,10 @@ mod tests {
assert!((c - (4.0 + 2.0 + 0.2)).abs() < 1e-9, "{c}");
assert_eq!(cost("anthropic/claude-sonnet-5-5", &Usage { output_tokens: 1_000_000, ..Default::default() }, &BTreeMap::new(), false), Some(10.0));
assert_eq!(cost("mystery", &u, &BTreeMap::new(), false), None);
- // Kimi K3 through OpenRouter is priced by its model id.
- let k =
- cost("moonshotai/kimi-k3", &Usage { input_tokens: 1_000_000, output_tokens: 1_000_000, ..Default::default() }, &BTreeMap::new(), false).unwrap();
- assert!((k - (0.239 + 11.936)).abs() < 1e-9, "{k}");
+ // Kimi K3.1 Pro through OpenRouter is priced by its model id.
+ let k = cost("moonshotai/kimi-k3.1-pro", &Usage { input_tokens: 1_000_000, output_tokens: 1_000_000, ..Default::default() }, &BTreeMap::new(), false)
+ .unwrap();
+ assert!((k - (2.0 + 10.0)).abs() < 1e-9, "{k}");
assert_eq!(cost("mystery", &u, &BTreeMap::new(), true), Some(0.0));
let mut o = BTreeMap::new();
o.insert("mystery".into(), Price { input_per_mtok: 1.0, output_per_mtok: 1.0, cache_read_per_mtok: None, cache_write_per_mtok: None });
diff --git a/crates/ai/src/tests.rs b/crates/ai/src/tests.rs
index 328e9bd7..182c15f0 100644
--- a/crates/ai/src/tests.rs
+++ b/crates/ai/src/tests.rs
@@ -234,8 +234,8 @@ fn a_failed_save_changes_nothing() {
fn ai_settings_that_cant_be_read_are_never_saved_over() {
let (h, d) = hub();
add(&h, "Claude Code", BackendKind::AgentCli, "http://127.0.0.1:9", None);
- add(&h, "Kimi K3 (OpenRouter)", BackendKind::Openrouter, "http://127.0.0.1:9", None);
- h.set_role(Role::Builder, Some("Kimi K3 (OpenRouter)")).unwrap();
+ add(&h, "Kimi K3.1 Pro (OpenRouter)", BackendKind::Openrouter, "http://127.0.0.1:9", None);
+ h.set_role(Role::Builder, Some("Kimi K3.1 Pro (OpenRouter)")).unwrap();
let file = d.path().join("config.toml");
let mut bad = h.engine.session().settings.clone();
let price: toml::Table = toml::from_str(
@@ -262,17 +262,17 @@ input_per_mtok = 1.0
fn the_person_chooses_who_builds() {
let (h, _d) = hub();
add(&h, "Claude Code", BackendKind::AgentCli, "http://127.0.0.1:9", None);
- add(&h, "Kimi K3 (OpenRouter)", BackendKind::Openrouter, "http://127.0.0.1:9", Some("sk-test"));
+ add(&h, "Kimi K3.1 Pro (OpenRouter)", BackendKind::Openrouter, "http://127.0.0.1:9", Some("sk-test"));
assert_eq!(h.chosen(Role::Builder), None, "automatic until chosen");
assert!(h.set_role(Role::Builder, Some("Nobody")).is_err(), "only a configured backend");
- h.set_role(Role::Builder, Some("Kimi K3 (OpenRouter)")).unwrap();
- assert_eq!(h.chosen(Role::Builder).as_deref(), Some("Kimi K3 (OpenRouter)"));
+ h.set_role(Role::Builder, Some("Kimi K3.1 Pro (OpenRouter)")).unwrap();
+ assert_eq!(h.chosen(Role::Builder).as_deref(), Some("Kimi K3.1 Pro (OpenRouter)"));
// The extractor is chosen the same way, and has no default.
assert_eq!(h.chosen(Role::Extractor), None);
- h.set_role(Role::Extractor, Some("Kimi K3 (OpenRouter)")).unwrap();
- assert_eq!(h.chosen(Role::Extractor).as_deref(), Some("Kimi K3 (OpenRouter)"));
+ h.set_role(Role::Extractor, Some("Kimi K3.1 Pro (OpenRouter)")).unwrap();
+ assert_eq!(h.chosen(Role::Extractor).as_deref(), Some("Kimi K3.1 Pro (OpenRouter)"));
// A removed backend can't stay the builder.
- h.remove_backend("Kimi K3 (OpenRouter)").unwrap();
+ h.remove_backend("Kimi K3.1 Pro (OpenRouter)").unwrap();
assert_eq!((h.chosen(Role::Builder), h.chosen(Role::Extractor)), (None, None));
h.set_role(Role::Builder, Some("Claude Code")).unwrap();
h.set_role(Role::Builder, None).unwrap();
diff --git a/crates/ui-egui/examples/snapshot.rs b/crates/ui-egui/examples/snapshot.rs
index b1f412ce..ab8e9426 100644
--- a/crates/ui-egui/examples/snapshot.rs
+++ b/crates/ui-egui/examples/snapshot.rs
@@ -355,7 +355,7 @@ fn main() {
let b = |name: &str, kind, model: &str| BackendConfig { name: name.into(), kind, model: model.into(), base_url: None, ssh_host: None, enabled: true };
a.backends = vec![
b("Claude Code", BackendKind::AgentCli, "claude-code"),
- b("Kimi K3 (OpenRouter)", BackendKind::Openrouter, "moonshotai/kimi-k3"),
+ b("Kimi K3.1 Pro (OpenRouter)", BackendKind::Openrouter, "moonshotai/kimi-k3.1-pro"),
b("Claude", BackendKind::Anthropic, "claude-opus-5-5"),
];
a.state.backend = Some("Claude".into());
diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md
index c83576b6..3b9d3860 100644
--- a/docs/ROADMAP.md
+++ b/docs/ROADMAP.md
@@ -267,7 +267,7 @@ yet, and the quick start is how every new person begins.
- [ ] fal bills pictures "by rounding up to the nearest megapixel"; estimates use the exact size.
Confirm on a real invoice whether a 1024×1024 picture bills as 1 or 2 megapixels, then round
in the table (needs a key)
-- [ ] A live extraction run with Kimi K3 (needs the person's OpenRouter key)
+- [ ] A live extraction run with Kimi K3.1 Pro (needs the person's OpenRouter key)
**A second computer or another system:**
- [ ] A live run of a project copied between two real computers with Claude Code (#451, #452); done
diff --git a/docs/STATUS.md b/docs/STATUS.md
index 66558852..54289d5c 100644
--- a/docs/STATUS.md
+++ b/docs/STATUS.md
@@ -217,7 +217,7 @@ was run; other text-call formats remain unsupported.
own permissions. It hasn't been run as a `maki -p` builder here.
- Claude Code is fully wired as a builder; Codex works through its own flags (our tools are pre-approved for
`codex exec`, see `docs/codex.md`) but is unverified on a real install and doesn't resume; other agent programs get plain text in and out. API-key
- backends (Anthropic, OpenRouter, OpenAI, local; Kimi K3 through OpenRouter is offered by Detect; a backend chosen as the Extractor takes a Deep-mode game's own files out into `app/Original/` after the study) build with our own loop and the Build tools,
+ backends (Anthropic, OpenRouter, OpenAI, local; Kimi K3.1 Pro through OpenRouter is offered by Detect; a backend chosen as the Extractor takes a Deep-mode game's own files out into `app/Original/` after the study) build with our own loop and the Build tools,
trim and summarise long conversations and keep them in `transcript.json`; no live API build has
been run yet.
- Website checks compare the start page and up to 12 linked pages at the configured widths; the