review: use 1-hour cache-TTL prices (the subscription default)

This commit is contained in:
iris 2026-06-08 20:03:47 +02:00
commit b066af010b
2 changed files with 13 additions and 11 deletions

View file

@ -101,9 +101,10 @@ pub type PriceTable = HashMap<String, Prices>;
/// Built-in fallback pricing, per **million** tokens. Used when the /// Built-in fallback pricing, per **million** tokens. Used when the
/// operator's [`PriceTable`] has no key matching the model. Figures are /// operator's [`PriceTable`] has no key matching the model. Figures are
/// current Anthropic list prices for the Claude 4.x family (Opus 4.x, /// current Anthropic list prices for the Claude 4.x family (Opus 4.x,
/// Sonnet 4.x, Haiku 4.5); `cache_write` uses the default 5-minute /// Sonnet 4.x, Haiku 4.5); `cache_write` uses the 1-hour cache-TTL price,
/// cache-TTL price. Keep in sync with the `services.hyperhive.modelPrices` /// which is the default through the Claude subscription the agents run
/// nix default (`nix/modules/hive-c0re.nix`). /// on. Keep in sync with the `services.hyperhive.modelPrices` nix default
/// (`nix/modules/hive-c0re.nix`).
fn builtin_prices(model: &str) -> Prices { fn builtin_prices(model: &str) -> Prices {
let m = model.to_ascii_lowercase(); let m = model.to_ascii_lowercase();
if m.contains("opus") { if m.contains("opus") {
@ -111,14 +112,14 @@ fn builtin_prices(model: &str) -> Prices {
input: 5.0, input: 5.0,
output: 25.0, output: 25.0,
cache_read: 0.5, cache_read: 0.5,
cache_write: 6.25, cache_write: 10.0,
} }
} else if m.contains("haiku") { } else if m.contains("haiku") {
Prices { Prices {
input: 1.0, input: 1.0,
output: 5.0, output: 5.0,
cache_read: 0.1, cache_read: 0.1,
cache_write: 1.25, cache_write: 2.0,
} }
} else { } else {
// sonnet + unknown fallback // sonnet + unknown fallback
@ -126,7 +127,7 @@ fn builtin_prices(model: &str) -> Prices {
input: 3.0, input: 3.0,
output: 15.0, output: 15.0,
cache_read: 0.3, cache_read: 0.3,
cache_write: 3.75, cache_write: 6.0,
} }
} }
} }

View file

@ -447,27 +447,28 @@ in
} }
); );
# Current Anthropic list prices for the Claude 4.x family (Opus # Current Anthropic list prices for the Claude 4.x family (Opus
# 4.x, Sonnet 4.x, Haiku 4.5); cache_write is the default 5-minute # 4.x, Sonnet 4.x, Haiku 4.5); cache_write is the 1-hour cache-TTL
# cache-TTL price. Keep in sync with `builtin_prices` in # price (the default through the Claude subscription the agents run
# on). Keep in sync with `builtin_prices` in
# hive-c0re/src/hive_stats.rs. # hive-c0re/src/hive_stats.rs.
default = { default = {
opus = { opus = {
input = 5.0; input = 5.0;
output = 25.0; output = 25.0;
cache_read = 0.5; cache_read = 0.5;
cache_write = 6.25; cache_write = 10.0;
}; };
sonnet = { sonnet = {
input = 3.0; input = 3.0;
output = 15.0; output = 15.0;
cache_read = 0.3; cache_read = 0.3;
cache_write = 3.75; cache_write = 6.0;
}; };
haiku = { haiku = {
input = 1.0; input = 1.0;
output = 5.0; output = 5.0;
cache_read = 0.1; cache_read = 0.1;
cache_write = 1.25; cache_write = 2.0;
}; };
}; };
example = { example = {