Pine
|
edca0dcfa7
|
P1/P2 计费体系修复:统一扣费回调+请求前预检+对账接口+折扣同步
P1-1 统一扣费回调:
- 新增 POST /api/compute/internal/deduct(COMPUTE_ADMIN_TOKEN鉴权,engine_log_id幂等)
- compute 扣费后异步回调,按引擎实际费用(微元)扣平台来源账本
- 删除 relay.py 中 _bill_usage/_bill_usage_anthropic 调用(改由compute回调记账)
- ComputeUsageRecord 加 engine_log_id 字段,alembic 0079 迁移
P1-2 请求前预检:
- _user_engine_pat 中查 compute 余额(5s缓存),余额<=0直接403
- 避免无余额请求仍转发到引擎
P2-1 对账接口:
- GET /admin/compute/reconcile 对比引擎used_quota vs 平台累计扣费
- 支持分页、only_mismatch过滤
P2-2 折扣统一:
- 用户级折扣设置/删除时异步同步等效系数到引擎users.discount
- compute /api/user/manage 支持 username 定位用户
- compute_client 新增 set_user_discount_by_username
|
2026-09-13 17:41:02 +08:00 |
|