mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-11 03:39:49 +08:00
feat(billing): add image quality pricing and usage tracking
This commit is contained in:
@@ -816,6 +816,11 @@ fn openai_image_stream_standardized_usage(
|
||||
.dimensions
|
||||
.insert("image_size".to_string(), serde_json::json!(size));
|
||||
}
|
||||
if let Some(quality) = image_request_quality(report_context) {
|
||||
standardized_usage
|
||||
.dimensions
|
||||
.insert("image_quality".to_string(), serde_json::json!(quality));
|
||||
}
|
||||
(standardized_usage.signal_score() > 0).then_some(standardized_usage)
|
||||
}
|
||||
|
||||
@@ -1049,6 +1054,16 @@ fn image_request_size(report_context: Option<&Value>) -> Option<String> {
|
||||
.map(ToOwned::to_owned)
|
||||
}
|
||||
|
||||
fn image_request_quality(report_context: Option<&Value>) -> Option<String> {
|
||||
report_context
|
||||
.and_then(|value| value.get("image_request"))
|
||||
.and_then(|value| value.get("quality"))
|
||||
.and_then(Value::as_str)
|
||||
.map(str::trim)
|
||||
.filter(|value| !value.is_empty())
|
||||
.map(ToOwned::to_owned)
|
||||
}
|
||||
|
||||
fn image_bridge_model(report_context: Option<&Value>) -> Option<String> {
|
||||
report_context.and_then(|context| {
|
||||
context
|
||||
|
||||
Reference in New Issue
Block a user