mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-10-28 08:35:33 +08:00
Before billing, the gateway walked the whole decoded request of a task plugin and rejected duration, seconds and count members that were out of range at any depth, including vendor parameters passed through metadata. A plugin had to declare duration-auto@1 for the gateway to let a duration of -1 through. The gateway no longer reads billing quantities from the request. It still bounds every usage fact a plugin returns before quota is calculated: second facts at most 3600, count facts at most 128, token and credit facts saturated at the quota limit. Each plugin validates its own request and derives its facts from the request it sends upstream. duration-auto@1 is still accepted and has no effect. Kling now bills the duration it sends. metadata.duration, which is the whole body on native routes, overrides the top-level duration and must be a whole number of seconds from 1 to 3600. Before, a metadata duration of 10 was sent upstream while 5 seconds were billed.