feat(channel): 模型价格自动填充 + 默认定价 API
- 新增 GET /admin/channels/model-pricing?model=xxx API - 从 BillingService 查询 LiteLLM/Fallback 默认定价 - 前端添加模型时自动查询并填充价格($/MTok) - 仅在所有价格字段为空时才自动填充,不覆盖手动配置
This commit is contained in:
@@ -128,5 +128,20 @@ export async function remove(id: number): Promise<void> {
|
||||
await apiClient.delete(`/admin/channels/${id}`)
|
||||
}
|
||||
|
||||
const channelsAPI = { list, getById, create, update, remove }
|
||||
export interface ModelDefaultPricing {
|
||||
found: boolean
|
||||
input_price?: number // per-token price
|
||||
output_price?: number
|
||||
cache_write_price?: number
|
||||
cache_read_price?: number
|
||||
}
|
||||
|
||||
export async function getModelDefaultPricing(model: string): Promise<ModelDefaultPricing> {
|
||||
const { data } = await apiClient.get<ModelDefaultPricing>('/admin/channels/model-pricing', {
|
||||
params: { model }
|
||||
})
|
||||
return data
|
||||
}
|
||||
|
||||
const channelsAPI = { list, getById, create, update, remove, getModelDefaultPricing }
|
||||
export default channelsAPI
|
||||
|
||||
Reference in New Issue
Block a user