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
/// operator's [`PriceTable`] has no key matching the model. Figures are
/// 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
/// cache-TTL price. Keep in sync with the `services.hyperhive.modelPrices`
/// nix default (`nix/modules/hive-c0re.nix`).
/// Sonnet 4.x, Haiku 4.5); `cache_write` uses the 1-hour cache-TTL price,
/// which is the default through the Claude subscription the agents run
/// on. Keep in sync with the `services.hyperhive.modelPrices` nix default
/// (`nix/modules/hive-c0re.nix`).
fn builtin_prices(model: &str) -> Prices {
let m = model.to_ascii_lowercase();
if m.contains("opus") {
@ -111,14 +112,14 @@ fn builtin_prices(model: &str) -> Prices {
input: 5.0,
output: 25.0,
cache_read: 0.5,
cache_write: 6.25,
cache_write: 10.0,
}
} else if m.contains("haiku") {
Prices {
input: 1.0,
output: 5.0,
cache_read: 0.1,
cache_write: 1.25,
cache_write: 2.0,
}
} else {
// sonnet + unknown fallback
@ -126,7 +127,7 @@ fn builtin_prices(model: &str) -> Prices {
input: 3.0,
output: 15.0,
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
# 4.x, Sonnet 4.x, Haiku 4.5); cache_write is the default 5-minute
# cache-TTL price. Keep in sync with `builtin_prices` in
# 4.x, Sonnet 4.x, Haiku 4.5); cache_write is the 1-hour cache-TTL
# price (the default through the Claude subscription the agents run
# on). Keep in sync with `builtin_prices` in
# hive-c0re/src/hive_stats.rs.
default = {
opus = {
input = 5.0;
output = 25.0;
cache_read = 0.5;
cache_write = 6.25;
cache_write = 10.0;
};
sonnet = {
input = 3.0;
output = 15.0;
cache_read = 0.3;
cache_write = 3.75;
cache_write = 6.0;
};
haiku = {
input = 1.0;
output = 5.0;
cache_read = 0.1;
cache_write = 1.25;
cache_write = 2.0;
};
};
example = {