计费管理/创建计费规则
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
请求语法
POST /api/v1/modelRouter/open/billing/rules HTTP/1.1
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| body |
object |
否 |
计费规则创建请求 |
|
| modelId |
integer |
是 |
模型 ID |
1 |
| billingType |
string |
否 |
计费类型:configurable |
configurable |
| pricingConfig |
any |
否 |
pricingConfig 为 JSON 对象,其内部字段结构根据计费类型不同而变化。
|
{ "tiers":[ { "input_price":2.5, "cached_input_price":2.5, "max_tokens":32000, "output_price":10, "thinking_output_price":10, "thinking_input_price":2.5, "min_tokens":0 }, { "input_price":4, "cached_input_price":4, "max_tokens":128000, "output_price":16, "thinking_output_price":16, "thinking_input_price":4, "min_tokens":32000 }, { "input_price":7, "cached_input_price":7, "max_tokens":252000, "output_price":28, "thinking_output_price":28, "thinking_input_price":7, "min_tokens":128000 } ] } |
| effectiveTime |
string |
否 |
生效时间,RFC3339 格式 |
2024-01-01T00:00:00Z |
| expireTime |
string |
否 |
过期时间,RFC3339 格式 |
2025-01-01T00:00:00Z |
| version |
integer |
否 |
计费规则版本号 |
1 |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
OpenApiSingleResponse |
{ "success": true, "data": {"id": 1, "model_id": 1, "billing_type": "token_tiered"}, "requestId": "592A27EF-26D3-1434-98C1-97AD63337852" } |
|
| requestId |
string |
请求编号 |
xxxx-xxxx-xxxx-xxxxxxxx |
| success |
boolean |
是否成功 |
true |
| errCode |
string |
错误信息编码 |
UNKNOWN_ERROR |
| errMessage |
string |
错误信息 |
未知错误 |
| httpStatusCode |
integer |
http 状态码 |
200 |
| data |
object |
返回数据 |
|
| id |
integer |
规则 ID |
1 |
| modelId |
integer |
模型 ID |
1 |
| modelCode |
string |
模型标识 |
qwen-plus |
| modelName |
string |
模型名称 |
通义千问Plus |
| modelType |
string |
模型类型 |
chat |
| symbol |
string |
厂商标识 |
alibaba |
| billingType |
string |
计费类型 |
token_tiered |
| pricingConfig |
any |
计费配置 |
{} |
| effectiveTime |
string |
生效时间 |
2024-01-01T00:00:00Z |
| expireTime |
string |
过期时间 |
2025-01-01T00:00:00Z |
| version |
integer |
版本号 |
1 |
| deleteTag |
integer |
删除标记 |
0 |
| gmtCreate |
string |
创建时间 |
2024-01-01T00:00:00Z |
| gmtModified |
string |
修改时间 |
2024-01-01T00:00:00Z |
示例
正常返回示例
JSON格式
{
"requestId": "xxxx-xxxx-xxxx-xxxxxxxx",
"success": true,
"errCode": "UNKNOWN_ERROR",
"errMessage": "未知错误",
"httpStatusCode": 200,
"data": {
"id": 1,
"modelId": 1,
"modelCode": "qwen-plus",
"modelName": "通义千问Plus",
"modelType": "chat",
"symbol": "alibaba",
"billingType": "token_tiered",
"pricingConfig": "{}",
"effectiveTime": "2024-01-01T00:00:00Z",
"expireTime": "2025-01-01T00:00:00Z",
"version": 1,
"deleteTag": 0,
"gmtCreate": "2024-01-01T00:00:00Z",
"gmtModified": "2024-01-01T00:00:00Z"
}
}
错误码
|
HTTP status code |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
| 200 | B.Resource.NotFoundException | B.Resource.NotFoundException. | |
| 500 | Server.Internal.UnknownError | The request processing has failed due to some unknown error. | |
| 403 | B.Permission.OrgNoExistException | B.Permission .OrgNoExistException. | 鉴权失败-组织不存在 |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。