feat(models): 统一模型规格价格与路由
This commit is contained in:
@@ -31,12 +31,25 @@ export type PublicLogicalModel = {
|
||||
inputPriceMicrocredits: number;
|
||||
outputPriceMicrocredits: number;
|
||||
cachedPriceMicrocredits: number;
|
||||
priceTiers: PublicLogicalModelPriceTier[];
|
||||
legacyModelIds: string[];
|
||||
capabilitySpec: CapabilitySpec;
|
||||
capabilityProfiles: CapabilitySpec[];
|
||||
defaultOptions: Record<string, unknown>;
|
||||
available: boolean;
|
||||
};
|
||||
|
||||
export type PublicLogicalModelPriceTier = {
|
||||
selector: Record<string, string>;
|
||||
resolution: string;
|
||||
videoSeconds: number;
|
||||
billingMode: "fixed_request" | "per_second" | "token";
|
||||
unitPriceMicrocredits: number;
|
||||
inputTokenPriceMicrocredits: number;
|
||||
outputTokenPriceMicrocredits: number;
|
||||
cachedTokenPriceMicrocredits: number;
|
||||
};
|
||||
|
||||
export type AdminLogicalRoute = {
|
||||
id: string;
|
||||
channelModelId: string;
|
||||
@@ -73,6 +86,7 @@ export type LogicalModelMutation = {
|
||||
inputPriceMicrocredits: number;
|
||||
outputPriceMicrocredits: number;
|
||||
cachedPriceMicrocredits: number;
|
||||
legacyModelIds?: string[];
|
||||
capabilitySpec: CapabilitySpec;
|
||||
defaultOptions: Record<string, unknown>;
|
||||
routes: Array<{ channelModelId: string; enabled: boolean; priority: number; weight: number }>;
|
||||
@@ -83,6 +97,14 @@ export type RouteSimulationResult = {
|
||||
candidates: Array<{ routeId: string; channelModelId: string; channelModelKey: string; channelModelName: string; priority: number; weight: number; enabled: boolean; matched: boolean; blocked: boolean; inPool: boolean; reasons?: string[] }>;
|
||||
};
|
||||
|
||||
export type LogicalModelQuote = {
|
||||
logicalModelId: string;
|
||||
billingMode: PublicLogicalModel["billingMode"];
|
||||
quantity: number;
|
||||
amountMicrocredits: number;
|
||||
estimated: boolean;
|
||||
};
|
||||
|
||||
export function listLogicalModels() {
|
||||
return request<{ models: PublicLogicalModel[] }>(apiClient.get("/models"));
|
||||
}
|
||||
@@ -91,6 +113,10 @@ export function listAvailableLogicalModels(intent: ModelRequestIntent) {
|
||||
return request<{ models: PublicLogicalModel[] }>(apiClient.post("/models/available", intent));
|
||||
}
|
||||
|
||||
export function quoteLogicalModel(id: string, intent: ModelRequestIntent, signal?: AbortSignal) {
|
||||
return request<{ quote: LogicalModelQuote }>(apiClient.post(`/models/${encodeURIComponent(id)}/quote`, intent, { signal }));
|
||||
}
|
||||
|
||||
export function listAdminLogicalModels() {
|
||||
return request<{ models: AdminLogicalModel[] }>(apiClient.get("/admin/logical-models"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user