review: update default model prices to current Anthropic list pricing
Per operator request on the PR: the built-in/default prices were the old Claude 3 numbers (opus 15/75, etc.). Update opus + haiku to the current Claude 4.x family list pricing (cache_write = the default 5-minute cache TTL); sonnet was already correct: - opus: input 5, output 25, cache_read 0.5, cache_write 6.25 - sonnet: input 3, output 15, cache_read 0.3, cache_write 3.75 (unchanged) - haiku: input 1, output 5, cache_read 0.1, cache_write 1.25 Updated in both builtin_prices (hive_stats.rs) and the nix modelPrices default (hive-c0re.nix), with cross-reference "keep in sync" notes on both sides. Also addresses the earlier reviewer note: dropped the over-strong "single source of truth" wording in the --model-prices arg doc (the nix default does mirror the numbers in production).
This commit is contained in:
parent
60caef73f9
commit
a9560ebb51
3 changed files with 30 additions and 21 deletions
|
|
@ -98,23 +98,27 @@ pub struct Prices {
|
|||
/// every model uses [`builtin_prices`].
|
||||
pub type PriceTable = HashMap<String, Prices>;
|
||||
|
||||
/// 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
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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 = {
|
||||
|
|
|
|||
Loading…
Reference in a new issue