1、增加调用 AI 视频生成能力和虚拟素材库管理的对外api
2、增加后台apikkey管理 3、增加apikey单独的模型定价 4、增加apikey调用情况 5、完善所有数据的注释增加
This commit is contained in:
@@ -390,6 +390,108 @@ export async function deleteCreditRatio(id: string): Promise<void> {
|
||||
await api.delete(`/admin/credit-ratios/${id}`);
|
||||
}
|
||||
|
||||
// === API 模型价格管理 ===
|
||||
|
||||
export async function getApiModelPricings(): Promise<any[]> {
|
||||
return api.get('/admin/api-model-pricings');
|
||||
}
|
||||
|
||||
export async function saveApiModelPricing(pricing: any): Promise<any> {
|
||||
if (pricing.id) return api.put(`/admin/api-model-pricings/${pricing.id}`, pricing);
|
||||
return api.post('/admin/api-model-pricings', pricing);
|
||||
}
|
||||
|
||||
export async function deleteApiModelPricing(id: string): Promise<void> {
|
||||
await api.delete(`/admin/api-model-pricings/${id}`);
|
||||
}
|
||||
|
||||
// === API Key 管理 ===
|
||||
|
||||
export async function getApiKeys(params?: {
|
||||
skip?: number;
|
||||
limit?: number;
|
||||
companyName?: string;
|
||||
isActive?: boolean;
|
||||
}): Promise<any> {
|
||||
const query = new URLSearchParams();
|
||||
if (params?.skip !== undefined) query.set('skip', String(params.skip));
|
||||
if (params?.limit !== undefined) query.set('limit', String(params.limit));
|
||||
if (params?.companyName) query.set('company_name', params.companyName);
|
||||
if (params?.isActive !== undefined) query.set('is_active', String(params.isActive));
|
||||
const qs = query.toString();
|
||||
return api.get(`/admin/api-keys${qs ? '?' + qs : ''}`);
|
||||
}
|
||||
|
||||
export async function getApiKeyDetail(id: string): Promise<any> {
|
||||
return api.get(`/admin/api-keys/${id}`);
|
||||
}
|
||||
|
||||
export async function createApiKey(data: any): Promise<any> {
|
||||
return api.post('/admin/api-keys', data);
|
||||
}
|
||||
|
||||
export async function updateApiKey(id: string, data: any): Promise<any> {
|
||||
return api.put(`/admin/api-keys/${id}`, data);
|
||||
}
|
||||
|
||||
export async function deleteApiKey(id: string): Promise<void> {
|
||||
await api.delete(`/admin/api-keys/${id}`);
|
||||
}
|
||||
|
||||
export async function getApiKeyUsage(id: string, days?: number): Promise<any> {
|
||||
const qs = days ? `?days=${days}` : '';
|
||||
return api.get(`/admin/api-keys/${id}/usage${qs}`);
|
||||
}
|
||||
|
||||
export async function getApiKeyUpscaleConfig(id: string): Promise<any> {
|
||||
return api.get(`/admin/api-keys/${id}/upscale`);
|
||||
}
|
||||
|
||||
export async function saveApiKeyUpscaleConfig(id: string, data: any): Promise<any> {
|
||||
return api.put(`/admin/api-keys/${id}/upscale`, data);
|
||||
}
|
||||
|
||||
// === V3 虚拟素材库配额 ===
|
||||
export async function getApiKeyVpV3Quota(id: string): Promise<any> {
|
||||
return api.get(`/admin/api-keys/${id}/vp-v3-quota`);
|
||||
}
|
||||
|
||||
export async function saveApiKeyVpV3Quota(id: string, data: { projectLimit: number; assetLimit: number; storageMbLimit: number; remark?: string | null }): Promise<any> {
|
||||
return api.post(`/admin/api-keys/${id}/vp-v3-quota`, {
|
||||
project_limit: data.projectLimit,
|
||||
asset_limit: data.assetLimit,
|
||||
storage_mb_limit: data.storageMbLimit,
|
||||
remark: data.remark,
|
||||
});
|
||||
}
|
||||
|
||||
export async function revealApiKey(id: string): Promise<any> {
|
||||
return api.get(`/admin/api-keys/${id}/reveal`);
|
||||
}
|
||||
|
||||
// === 整体消耗列表 ===
|
||||
|
||||
export async function getApiUsageAll(params?: {
|
||||
skip?: number;
|
||||
limit?: number;
|
||||
apiKeyId?: string;
|
||||
genType?: string;
|
||||
status?: string;
|
||||
startDate?: string;
|
||||
endDate?: string;
|
||||
}): Promise<any> {
|
||||
const query = new URLSearchParams();
|
||||
if (params?.skip !== undefined) query.set('skip', String(params.skip));
|
||||
if (params?.limit !== undefined) query.set('limit', String(params.limit));
|
||||
if (params?.apiKeyId) query.set('api_key_id', params.apiKeyId);
|
||||
if (params?.genType) query.set('gen_type', params.genType);
|
||||
if (params?.status) query.set('status', params.status);
|
||||
if (params?.startDate) query.set('start_date', params.startDate);
|
||||
if (params?.endDate) query.set('end_date', params.endDate);
|
||||
const qs = query.toString();
|
||||
return api.get(`/admin/api-keys/usage/all${qs ? '?' + qs : ''}`);
|
||||
}
|
||||
|
||||
export async function getPaymentConfigs(): Promise<any[]> {
|
||||
return api.get('/admin/payment-configs');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user