diff --git a/hive-c0re/src/hive_stats.rs b/hive-c0re/src/hive_stats.rs index 470fb457..413661d8 100644 --- a/hive-c0re/src/hive_stats.rs +++ b/hive-c0re/src/hive_stats.rs @@ -98,23 +98,27 @@ pub struct Prices { /// every model uses [`builtin_prices`]. pub type PriceTable = HashMap; -/// Built-in fallback pricing — the historical hard-coded table. Used -/// when the operator's [`PriceTable`] has no key matching the model. +/// 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`). fn builtin_prices(model: &str) -> Prices { let m = model.to_ascii_lowercase(); if m.contains("opus") { Prices { - input: 15.0, - output: 75.0, - cache_read: 1.5, - cache_write: 18.75, + input: 5.0, + output: 25.0, + cache_read: 0.5, + cache_write: 6.25, } } else if m.contains("haiku") { Prices { - input: 0.8, - output: 4.0, - cache_read: 0.08, - cache_write: 1.0, + input: 1.0, + output: 5.0, + cache_read: 0.1, + cache_write: 1.25, } } else { // sonnet + unknown fallback diff --git a/hive-c0re/src/main.rs b/hive-c0re/src/main.rs index 81c1bdf9..e37fec13 100644 --- a/hive-c0re/src/main.rs +++ b/hive-c0re/src/main.rs @@ -89,9 +89,10 @@ enum Cmd { /// model id; models not covered fall back to the built-in /// estimate. Set via the `services.hyperhive.modelPrices` NixOS /// option (whose default carries the full opus/sonnet/haiku - /// table). Defaults to `{}` here so a bare `hive-c0re serve` - /// leans entirely on the in-code `builtin_prices` fallback — - /// keeping a single source of truth for the numbers. + /// table — kept in sync with the in-code `builtin_prices`). + /// Defaults to `{}` here so a bare `hive-c0re serve` leans + /// entirely on `builtin_prices`; the NixOS default (every real + /// deployment) shadows it with the same operator-tunable table. #[arg(long, default_value = "{}")] model_prices: String, }, diff --git a/nix/modules/hive-c0re.nix b/nix/modules/hive-c0re.nix index 9b0d7b1f..28013c70 100644 --- a/nix/modules/hive-c0re.nix +++ b/nix/modules/hive-c0re.nix @@ -446,12 +446,16 @@ 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 + # hive-c0re/src/hive_stats.rs. default = { opus = { - input = 15.0; - output = 75.0; - cache_read = 1.5; - cache_write = 18.75; + input = 5.0; + output = 25.0; + cache_read = 0.5; + cache_write = 6.25; }; sonnet = { input = 3.0; @@ -460,10 +464,10 @@ in cache_write = 3.75; }; haiku = { - input = 0.8; - output = 4.0; - cache_read = 0.08; - cache_write = 1.0; + input = 1.0; + output = 5.0; + cache_read = 0.1; + cache_write = 1.25; }; }; example = {