feat(billing): 统一计价与候选冻结估算

新增 effective-pricing-v2、9 位十进制定点计算、显式免费校验和结构化缺价错误。估价与生产预处理覆盖全部可用候选,并按最大候选费用冻结;规则优先级为平台模型、平台、基准模型。\n\n同步计价契约和 OpenAPI,补充 Token 参数别名、视频五秒向上取整及缺价回归测试。\n\n验证:go test ./...、pnpm openapi、Web 测试与构建通过。
This commit is contained in:
2026-07-20 23:22:45 +08:00
parent 01a013c809
commit 5114686c35
14 changed files with 1192 additions and 28 deletions
+49 -1
View File
@@ -6017,6 +6017,12 @@
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
},
"503": {
"description": "Service Unavailable",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
}
}
}
@@ -11227,6 +11233,14 @@
"httpapi.PricingEstimateResponse": {
"type": "object",
"properties": {
"candidateCount": {
"type": "integer",
"example": 2
},
"currency": {
"type": "string",
"example": "resource"
},
"items": {
"type": "array",
"items": {
@@ -11234,9 +11248,25 @@
"additionalProperties": true
}
},
"pricingVersion": {
"type": "string",
"example": "effective-pricing-v2"
},
"requestFingerprint": {
"type": "string",
"example": "76ef6a537de8e71bd1ca93acadc078dbdbfa9f17e45224e4f9df59f535d2886f"
},
"reservationAmount": {
"type": "number",
"example": 2.75
},
"resolver": {
"type": "string",
"example": "effective-pricing-v1"
"example": "effective-pricing-v2"
},
"totalAmount": {
"type": "number",
"example": 1.25
}
}
},
@@ -13966,6 +13996,12 @@
"type": "object",
"additionalProperties": {}
},
"effectiveFrom": {
"type": "string"
},
"effectiveTo": {
"type": "string"
},
"formulaConfig": {
"type": "object",
"additionalProperties": {}
@@ -13973,6 +14009,9 @@
"id": {
"type": "string"
},
"isFree": {
"type": "boolean"
},
"metadata": {
"type": "object",
"additionalProperties": {}
@@ -14033,10 +14072,19 @@
"type": "object",
"additionalProperties": {}
},
"effectiveFrom": {
"type": "string"
},
"effectiveTo": {
"type": "string"
},
"formulaConfig": {
"type": "object",
"additionalProperties": {}
},
"isFree": {
"type": "boolean"
},
"metadata": {
"type": "object",
"additionalProperties": {}
+36 -2
View File
@@ -610,14 +610,32 @@ definitions:
type: object
httpapi.PricingEstimateResponse:
properties:
candidateCount:
example: 2
type: integer
currency:
example: resource
type: string
items:
items:
additionalProperties: true
type: object
type: array
resolver:
example: effective-pricing-v1
pricingVersion:
example: effective-pricing-v2
type: string
requestFingerprint:
example: 76ef6a537de8e71bd1ca93acadc078dbdbfa9f17e45224e4f9df59f535d2886f
type: string
reservationAmount:
example: 2.75
type: number
resolver:
example: effective-pricing-v2
type: string
totalAmount:
example: 1.25
type: number
type: object
httpapi.PricingRuleListResponse:
properties:
@@ -2485,11 +2503,17 @@ definitions:
dynamicWeight:
additionalProperties: {}
type: object
effectiveFrom:
type: string
effectiveTo:
type: string
formulaConfig:
additionalProperties: {}
type: object
id:
type: string
isFree:
type: boolean
metadata:
additionalProperties: {}
type: object
@@ -2531,9 +2555,15 @@ definitions:
dynamicWeight:
additionalProperties: {}
type: object
effectiveFrom:
type: string
effectiveTo:
type: string
formulaConfig:
additionalProperties: {}
type: object
isFree:
type: boolean
metadata:
additionalProperties: {}
type: object
@@ -6841,6 +6871,10 @@ paths:
description: Internal Server Error
schema:
$ref: '#/definitions/httpapi.ErrorEnvelope'
"503":
description: Service Unavailable
schema:
$ref: '#/definitions/httpapi.ErrorEnvelope'
security:
- BearerAuth: []
summary: 估算请求价格