AdminModelService

POST /v1/admin/models/pricing/estimate

Changed on

EstimateModelPricing 计费表达式 dry-run: 前端 Token 估算器实时预览。

语义: 用与生产结算完全一致的 billingexpr 引擎, 按传入 token 参数跑一次 表达式, 返回 cost + matched_tier。不落任何数据、不触发缓存, 纯计算。

权限: 与 UpdateModel 同门槛 (models:update), 避免非管理员探测定价规则。

请求侧不校验表达式一定要属于某个已存在模型——同一表达式可以在多个模型 之间复制粘贴调试。表达式不合法/负数返回 400。

Request

Request body

ainumber double
aonumber double
cnumber double
ccnumber double
cc1hnumber double
crnumber double
exprstring
hasVideoInnumber double

多模态维度 (model-config-billing-types-v2), 不参与 token 扣减/len 重算:

  • has_video_in: 请求是否含视频输入, 0/1 (>0 视为含)
  • img_n / img_o_n: 输入/输出图片张数
  • img_res: 图片分辨率桶, "1k"/"1.5k"/"2k"; 空串=未知 (表达式走兜底分支)
imgnumber double
imgCrnumber double

缓存命中图片输入 token,是 img(图片输入总量)的子集。

imgNnumber double
imgOnumber double
imgONnumber double
imgResstring
lennumber double
modestring
pnumber double

Response

OK

costMicrosstring

cost_micros 单位 micros CRD (int64). 命名带 _micros 强制提醒对端: proto JSON 序列化会成 string (Go int64 保护), 前端要按字符串解析。

matchedTierstring

Changes

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status