mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 01:10:23 +08:00
feat(billing): add image quality pricing and usage tracking
This commit is contained in:
@@ -913,7 +913,7 @@ fn build_openai_image_provider_body_from_openai_chat_body(
|
||||
"operation".to_string(),
|
||||
Value::String(operation.to_string()),
|
||||
);
|
||||
for key in ["output_format", "partial_images"] {
|
||||
for key in ["output_format", "partial_images", "size", "quality"] {
|
||||
if let Some(value) = tool.get(key) {
|
||||
summary.insert(key.to_string(), value.clone());
|
||||
}
|
||||
@@ -943,6 +943,12 @@ fn build_chatgpt_web_image_provider_body_from_openai_chat_body(
|
||||
.map(str::trim)
|
||||
.filter(|value| !value.is_empty())
|
||||
.unwrap_or("png");
|
||||
let quality = body_json
|
||||
.get("quality")
|
||||
.and_then(Value::as_str)
|
||||
.map(str::trim)
|
||||
.filter(|value| !value.is_empty())
|
||||
.unwrap_or("medium");
|
||||
let model = body_json
|
||||
.get("model")
|
||||
.and_then(Value::as_str)
|
||||
@@ -970,6 +976,8 @@ fn build_chatgpt_web_image_provider_body_from_openai_chat_body(
|
||||
let summary = json!({
|
||||
"operation": operation,
|
||||
"output_format": output_format,
|
||||
"size": size,
|
||||
"quality": quality,
|
||||
});
|
||||
Some((body, summary))
|
||||
}
|
||||
|
||||
@@ -821,6 +821,7 @@ fn build_chatgpt_web_image_provider_body_from_openai_responses_body(
|
||||
let size = image_option_string(tool.as_ref(), object, "size").unwrap_or("1024x1024");
|
||||
let output_format =
|
||||
image_option_string(tool.as_ref(), object, "output_format").unwrap_or("png");
|
||||
let quality = image_option_string(tool.as_ref(), object, "quality").unwrap_or("medium");
|
||||
let model = object
|
||||
.get("model")
|
||||
.and_then(Value::as_str)
|
||||
@@ -845,6 +846,8 @@ fn build_chatgpt_web_image_provider_body_from_openai_responses_body(
|
||||
let summary = json!({
|
||||
"operation": operation,
|
||||
"output_format": output_format,
|
||||
"size": size,
|
||||
"quality": quality,
|
||||
});
|
||||
Some((body, summary))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user