64 lines
1.9 KiB
Go
64 lines
1.9 KiB
Go
// Package collection 定义 CPA 用量观察及其采集服务。
|
|
package collection
|
|
|
|
import "time"
|
|
|
|
// Record 是当前请求明细功能保存的用量观察。
|
|
// 它不包含汇总结果,暂时拿不到的字段使用零值或 NULL。
|
|
type Record struct {
|
|
ManagedKeyID string
|
|
RequestID string
|
|
ExecutionID string
|
|
TraceID string
|
|
RequestedAt time.Time
|
|
APIKey string
|
|
KeyAlias string
|
|
AuthID string
|
|
AuthIndex string
|
|
AuthType string
|
|
Model string
|
|
ReasoningEffort string
|
|
ServiceTier string
|
|
Speed string
|
|
Failed bool
|
|
ExecutorType string
|
|
RequestType string
|
|
Endpoint string
|
|
InputTokens int64
|
|
OutputTokens int64
|
|
TotalTokens int64
|
|
CachedTokens int64
|
|
CacheReadTokens int64
|
|
CacheWriteTokens int64
|
|
ReasoningTokens int64
|
|
TTFT time.Duration
|
|
Latency time.Duration
|
|
CostMicros *int64
|
|
PriceTier string
|
|
FastRequested bool
|
|
FastPricingApplied bool
|
|
PriceMultiplierNumerator int64
|
|
PriceMultiplierDenominator int64
|
|
ClientIP string
|
|
Outcome string
|
|
StatusCode int
|
|
Error string
|
|
}
|
|
|
|
// RequestRecord 保存一次模型执行的终态,即使没有产生 Usage 也必须存在。
|
|
type RequestRecord struct {
|
|
ManagedKeyID string
|
|
RequestID string
|
|
TraceID string
|
|
RequestedAt time.Time
|
|
CompletedAt time.Time
|
|
Model string
|
|
RequestedModel string
|
|
SourceFormat string
|
|
Stream bool
|
|
Outcome string
|
|
StatusCode int
|
|
Error string
|
|
Endpoint string
|
|
}
|