Files

81 lines
4.6 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package v1
import "github.com/gogf/gf/v2/frame/g"
// TenantAvailableModelsReq 租户可用模型列表请求
type TenantAvailableModelsReq struct {
g.Meta `path:"/models" method:"get" mime:"json" tags:"租户控制台-模型" summary:"租户可用模型列表"`
Category string `json:"category" dc:"模型分类筛选:chat/embedding/image/audio/rerank"`
Vendor string `json:"vendor" dc:"研发厂商筛选(openai/anthropic/alibaba等),空=不过滤"`
Search string `json:"search" dc:"搜索关键词(模型名或显示名)"`
// ApiKeyID 按指定 API Key 的模型范围过滤(可选;不传或为 0 时返回租户全部可用模型)
ApiKeyID int64 `json:"api_key_id" dc:"API Key ID(可选,传入时按该 Key 的模型范围过滤)"`
}
type TenantAvailableModelsRes struct {
List []TenantAvailableModelItem `json:"list"`
}
// PricingTierItem 阶梯定价项
type PricingTierItem struct {
MinTokens int64 `json:"min_tokens"`
MaxTokens *int64 `json:"max_tokens"`
InputPrice float64 `json:"input_price"`
OutputPrice float64 `json:"output_price"`
}
// TimePriceItem 时段价目项(后端按「租户有效价 × 时段乘数」换算好的展示价,前端直接渲染)。
// tiered 模型 InputPrice/OutputPrice 为首档换算价(起价);per_request 模型填 PerRequestPrice。
type TimePriceItem struct {
Name string `json:"name"` // 时段名
Days []int `json:"days,omitempty"` // 适用星期 1=周一..7=周日;空=每天
StartTime string `json:"start_time,omitempty"` // 空=全天
EndTime string `json:"end_time,omitempty"`
ValidFrom string `json:"valid_from,omitempty"` // 促销/定时调价窗口(空=长期)
ValidTo string `json:"valid_to,omitempty"`
Multiplier float64 `json:"multiplier"`
InputPrice *float64 `json:"input_price"`
OutputPrice *float64 `json:"output_price"`
PerRequestPrice *float64 `json:"per_request_price"`
// per_second 模型填 PerSecondPrice(兜底档 "*" 的换算价,无 "*" 取矩阵最低档)
PerSecondPrice *float64 `json:"per_second_price"`
}
// TenantAvailableModelItem 租户可用模型信息
type TenantAvailableModelItem struct {
ID int64 `json:"id"`
ModelId string `json:"model_id"`
ModelName string `json:"model_name"`
Category string `json:"category"`
Vendor string `json:"vendor"` // 研发厂商(空=未分类)
MaxContext int `json:"max_context_tokens"`
MaxOutput int `json:"max_output_tokens"`
Description string `json:"description"`
Tags string `json:"tags"`
Capabilities string `json:"capabilities"`
BillingMode *string `json:"billing_mode"`
PerRequestPrice *float64 `json:"per_request_price"`
DiscountRatio *float64 `json:"discount_ratio"`
MaxConcurrency *int `json:"max_concurrency"`
InputPrice *float64 `json:"input_price"`
OutputPrice *float64 `json:"output_price"`
CacheReadPrice *float64 `json:"cache_read_price"`
CacheCreationPrice *float64 `json:"cache_creation_price"`
PricingTiers []PricingTierItem `json:"pricing_tiers"`
// PerSecondPrices 按秒计费矩阵(billing_mode=per_second):分辨率规格 → 每秒单价(本位币),
// "*" 为兜底价。租户倍率/折扣在计费时作用,展示为平台原价。
PerSecondPrices map[string]float64 `json:"per_second_prices,omitempty"`
// TimePrices 时段价目(平台配置了时段定价的模型才有;价格为换算后的展示价)
TimePrices []TimePriceItem `json:"time_prices"`
// DiscountLabel 折扣标签(平台定价锚点行配置的营销展示文案,如"7折起";NULL=不展示)
DiscountLabel *string `json:"discount_label"`
// PriceChangeNote 价格调整说明(对外提示价格有变动;NULL=不展示)
PriceChangeNote *string `json:"price_change_note"`
// AsyncImage 图片模型异步端点是否可用(提交 /v1/images/generations/async 后轮询取图)。
// 仅图片分类模型有意义;真异步厂商,或同步厂商且「同步图片异步化」开关开启时为 true。
AsyncImage bool `json:"async_image"`
// ImageSyncSupported 图片模型同步端点(/v1/images/generations,阻塞一次性返回)是否可用。
// 仅图片分类模型有意义;「仅异步」厂商(阿里 image-synthesis 等)为 false,其余为 true。
ImageSyncSupported bool `json:"image_sync_supported"`
}