feat(platform): 模型管理与后台能力 - 新增逻辑模型路由和响应拦截

This commit is contained in:
ddCat
2026-08-18 20:42:25 +08:00
parent 0002cdd2cb
commit 8c5f56a551
89 changed files with 21451 additions and 1170 deletions

View File

@@ -11,6 +11,7 @@ export function CreditSymbol({ className, ...props }: ComponentProps<"span">) {
export type ModelCreditCost = {
model: string;
pricePolicy?: "channel" | "unified";
billingMode: "fixed_request" | "per_second" | "token";
unitPriceMicrocredits: number;
};
@@ -27,6 +28,8 @@ export function requestCreditCost(options: { channelMode: string; modelCosts?: M
if (options.channelMode !== "remote") return null;
const cost = modelCreditCost(options.modelCosts, options.model);
if (!cost) return null;
// 跟随供应价格的前台模型只有后端完成能力路由后才能确定价格,前端不展示误导性预估。
if (cost.pricePolicy === "channel") return null;
// Token 订单由服务端按请求体预授权并在 usage 返回后结算,前端不展示无依据的固定价格。
if (cost.billingMode === "token") return null;
const quantity = cost.billingMode === "per_second"