Commit Graph

31 Commits

Author SHA1 Message Date
CaIon
8374a83084 feat(task): add adaptor billing interface and async settlement framework
Add three billing lifecycle methods to the TaskAdaptor interface:
- EstimateBilling: compute OtherRatios from user request before pricing
- AdjustBillingOnSubmit: adjust ratios from upstream submit response
- AdjustBillingOnComplete: determine final quota at task terminal state

Introduce BaseBilling as embeddable no-op default for adaptors without
custom billing. Move Sora/Ali OtherRatios logic from shared validation
into per-adaptor EstimateBilling implementations.

Add TaskBillingContext to persist pricing params (model_price, group_ratio,
other_ratios) in task private data for async polling settlement.

Extract RecalculateTaskQuota as a general-purpose delta settlement
function and unify polling billing via settleTaskBillingOnComplete
(adaptor-first, then token-based fallback).
2026-02-22 16:00:27 +08:00
Seefs
b827d1f778 Revert "Gemini Image系列支持图像编辑" 2025-11-30 18:45:54 +08:00
IcedTangerine
4960ffb05e Fix defer placement for image file closure 2025-11-27 18:01:34 +08:00
IcedTangerine
365133ccf2 Fix error message formatting in relay_utils.go 2025-11-27 17:59:38 +08:00
IcedTangerine
5ea40e1db8 Use defer to close image file after opening
Ensure image file is closed using defer after opening.
2025-11-27 17:56:59 +08:00
feitianbubu
fb55d56089 feat: gemini image support edit 2025-11-27 16:04:04 +08:00
feitianbubu
d0f13fab1c feat: vidu specify reference2video via metadata action 2025-11-10 16:37:26 +08:00
CaIon
e705cff403 feat: enhance Ali video request handling and validation 2025-10-31 22:26:56 +08:00
Seefs
a98e207ef7 feat: add ali wan video (#2141)
* feat: add ali wan video

* refactor: use same UnmarshalBodyReusable

* feat: enhance request body metadata

* feat: opt wan convertToOpenAIVideo

* feat: add wan support other param via json metadata

* refactor: remove unused code

* fix ali

---------

Co-authored-by: feitianbubu <feitianbubu@qq.com>
2025-10-31 16:51:05 +08:00
Seefs
5010f2d004 format: package name -> github.com/QuantumNous/new-api (#2017) 2025-10-11 15:30:09 +08:00
CaIon
59c5f42505 feat: add logging for model details and enhance action assignment in relay tasks 2025-10-11 11:56:44 +08:00
CaIon
d540020c3d feat: enhance multipart validation with additional fields for model, seconds, and size 2025-10-11 11:33:59 +08:00
Calcium-Ion
32f748cd7b Merge pull request #2006 from xyfacai/feat/sora-price
feat: sora 增加参数校验与计费
2025-10-11 11:22:08 +08:00
feitianbubu
06ae3efa19 feat: add openai sdk create 2025-10-11 02:44:01 +08:00
Xyfacai
09495c8ef6 feat: sora 增加参数校验与计费 2025-10-10 23:56:36 +08:00
feitianbubu
1d1759aaae feat: add sora video submit task 2025-10-09 15:00:02 +08:00
feitianbubu
b183f2f663 feat: vidu video add starEnd and reference gen video 2025-09-19 18:54:45 +08:00
feitianbubu
22db389fac feat: vidu video support multi images 2025-09-19 18:54:40 +08:00
feitianbubu
4db3aebb64 feat: jimeng video add images 2025-09-12 22:43:08 +08:00
feitianbubu
e55c84f599 refactor: use common taskSubmitReq 2025-09-12 22:43:03 +08:00
CaIon
1bbabda081 feat(monitor_setting): implement automatic channel testing configuration 2025-09-03 14:00:52 +08:00
CaIon
f14f4eaf1a feat: refactor environment variable initialization and introduce new constant types for API and context keys 2025-07-03 13:10:25 +08:00
CalciumIon
246c3fa451 feat: add gemini tool_calls finish reason 2024-12-06 14:31:27 +08:00
CalciumIon
1d4ebe3921 feat: support cloudflare audio 2024-07-16 23:24:47 +08:00
CalciumIon
efd18779c2 fix: hunyuan 2024-07-08 23:42:16 +08:00
CaIon
a5088f5e23 fix: fix SensitiveWords error 2024-03-21 14:29:56 +08:00
CaIon
580f2894ac feat: 初步兼容生成内容检查 2024-03-20 19:00:51 +08:00
CaIon
124369073a fix: fix gemini 2024-03-08 20:29:04 +08:00
1808837298@qq.com
d703cccc8a fix: 修复流模式错误扣费的问题 (close #95) 2024-03-06 17:41:55 +08:00
1808837298@qq.com
436afe925e feat: 初步重构完成 2024-02-29 16:21:25 +08:00
1808837298@qq.com
1735981217 feat: 初步重构 2024-02-29 01:08:18 +08:00