openai_image.go
4.7 KB
-
fix: move image count n to OtherRatio to prevent double-counting · ab99c308
The previous commit commented out AddOtherRatio("n") in the Ali adaptor to fix double-counting but this could cause billing evasion when n is specified via extra["parameters"] instead of request.N. Root cause: ImagePriceRatio in GetTokenCountMeta() already included n, AND channel adaptors added OtherRatio("n"), resulting in n² billing. Proper fix: - Remove n from ImagePriceRatio (keep sizeRatio * qualityRatio only) - In ImageHelper, add default OtherRatio("n") when adaptor hasn't set one; set fallback tokens to 1 (base unit) - Restore Ali adaptor's AddOtherRatio("n") — it uses actual upstream parameters/response count, preventing billing evasionCaIon committed