feat(model-catalog): read output_cost_per_billable_unit in the rust registry check (#51365)

* feat(model-catalog): read output_cost_per_billable_unit in the rust registry check

* fix(model-catalog): add billable_unit to the flat key schema pattern

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
Kerry Lu 2026-11-12 07:59:03 -08:00 • committed by GitHub
parent 2c7a36abe9
commit 6d17f8bff5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 10 additions and 1 deletions

View file

@ -50,6 +50,7 @@ pub enum OutputUnit {
Pixel,
Second(Option<Resolution>),
VideoSecond,
BillableUnit,
}
/// `Explicit` is a cache the caller created ahead of time, spelled `explicit_cache_read_*`. `Implicit` is every other read

View file

@ -122,6 +122,7 @@ pub struct ModelInfoFields {
pub output_cost_per_second_4k: Option<f64>,
pub output_cost_per_video_per_second: Option<f64>,
pub output_cost_per_image: Option<f64>,
pub output_cost_per_billable_unit: Option<f64>,
pub output_cost_per_pixel: Option<f64>,
pub output_cost_per_image_token: Option<f64>,
pub output_cost_per_image_token_batches: Option<f64>,

View file

@ -64,7 +64,7 @@ struct RegistryDocument {
pub(crate) const FLAT_KEY_PATTERN: &str = concat!(
r"^(",
r"input_cost_per_((audio_|image_|video_)?token|character|image|pixel|query|request|second|text_message|audio_per_second|video_per_second(_above_\d+s_interval)?)",
r"|output_cost_per_((audio_|image_|video_|reasoning_)?token|character|image(_\d+(\.\d+)?K?)?|pixel|second(_\d+[pk])?|video_per_second)",
r"|output_cost_per_((audio_|image_|video_|reasoning_)?token|character|image(_\d+(\.\d+)?K?)?|pixel|second(_\d+[pk])?|video_per_second|billable_unit)",
r"|cache_read_input_(audio_|image_|video_)?token_cost",
r"|explicit_cache_read_input_token_cost",
r"|cache_creation_input_(audio_|image_|video_)?token_cost(_above_1hr|_above_12hr)?",
@ -202,6 +202,8 @@ mod tests {
#[case::feature_batch("annotation_cost_per_page_batches")]
#[case::video_interval("input_cost_per_video_per_second_above_8s_interval")]
#[case::explicit_cache_read("explicit_cache_read_input_token_cost")]
#[case::billable_unit("output_cost_per_billable_unit")]
#[case::billable_unit_is_output_only("input_cost_per_billable_unit")]
#[case::wall_clock("cost_per_second")]
#[case::unused_meter("cost_per_token")]
#[case::other_currency("input_dbu_cost_per_token")]

View file

@ -210,6 +210,7 @@ fn output_unit(unit: &str) -> Option<OutputUnit> {
"pixel" => Some(OutputUnit::Pixel),
"second" => Some(OutputUnit::Second(None)),
"video_per_second" => Some(OutputUnit::VideoSecond),
"billable_unit" => Some(OutputUnit::BillableUnit),
_ => None,
}
}
@ -285,6 +286,10 @@ mod tests {
None
)
)]
#[case::billable_unit(
"output_cost_per_billable_unit",
key(Meter::Output(OutputUnit::BillableUnit), Band::Base, None)
)]
#[case::image_token_is_a_token(
"output_cost_per_image_token",
key(Meter::Output(OutputUnit::Token(TokenKind::Image)), Band::Base, None)