review: address damocles nits on modelPrices
- modelPrices submodule fields use lib.types.numbers.nonnegative
instead of lib.types.float: accepts bare ints (15) as well as floats
(15.0) and rejects negative prices for free.
- Collapse the triple-sourced default: hive-c0re serve --model-prices
now defaults to "{}" so builtin_prices() is the single in-code
fallback. The nix option default still carries the full
opus/sonnet/haiku table to self-document prices for operators.
This commit is contained in:
parent
cc8f58fb24
commit
60caef73f9
2 changed files with 9 additions and 9 deletions
|
|
@ -88,11 +88,11 @@ enum Cmd {
|
|||
/// Keys are matched case-insensitively as a substring of the
|
||||
/// model id; models not covered fall back to the built-in
|
||||
/// estimate. Set via the `services.hyperhive.modelPrices` NixOS
|
||||
/// option.
|
||||
#[arg(
|
||||
long,
|
||||
default_value = r#"{"opus":{"input":15.0,"output":75.0,"cache_read":1.5,"cache_write":18.75},"sonnet":{"input":3.0,"output":15.0,"cache_read":0.3,"cache_write":3.75},"haiku":{"input":0.8,"output":4.0,"cache_read":0.08,"cache_write":1.0}}"#
|
||||
)]
|
||||
/// 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.
|
||||
#[arg(long, default_value = "{}")]
|
||||
model_prices: String,
|
||||
},
|
||||
/// Spawn a new agent container directly (`hive-agent-<name>`). Bypasses
|
||||
|
|
|
|||
|
|
@ -428,19 +428,19 @@ in
|
|||
lib.types.submodule {
|
||||
options = {
|
||||
input = lib.mkOption {
|
||||
type = lib.types.float;
|
||||
type = lib.types.numbers.nonnegative;
|
||||
description = "USD per million input tokens.";
|
||||
};
|
||||
output = lib.mkOption {
|
||||
type = lib.types.float;
|
||||
type = lib.types.numbers.nonnegative;
|
||||
description = "USD per million output tokens.";
|
||||
};
|
||||
cache_read = lib.mkOption {
|
||||
type = lib.types.float;
|
||||
type = lib.types.numbers.nonnegative;
|
||||
description = "USD per million cache-read tokens.";
|
||||
};
|
||||
cache_write = lib.mkOption {
|
||||
type = lib.types.float;
|
||||
type = lib.types.numbers.nonnegative;
|
||||
description = "USD per million cache-creation (write) tokens.";
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue