Documentation
¶
Index ¶
- func LoadFromJsonString[K comparable, V any](m *RWMap[K, V], jsonStr string) error
- func LoadFromJsonStringWithCallback[K comparable, V any](m *RWMap[K, V], jsonStr string, onSuccess func()) error
- type GroupRatioInfo
- type PriceData
- func (p *PriceData) AddOtherRatio(key string, ratio float64)
- func (p *PriceData) ApplyOtherRatiosToDecimal(value decimal.Decimal) decimal.Decimal
- func (p *PriceData) ApplyOtherRatiosToFloat(value float64) float64
- func (p *PriceData) CapturePreConsumeTokens(tokens int) error
- func (p *PriceData) CaptureQuotaUnit(unit float64) error
- func (p *PriceData) CaptureToolPrices(prices map[string]float64) error
- func (p *PriceData) HasOtherRatio(key string) bool
- func (p *PriceData) OtherRatioMultiplier() float64
- func (p *PriceData) OtherRatios() map[string]float64
- func (p *PriceData) QuotedPreConsumeTokens() (tokens int, groupRatio float64, captured bool)
- func (p *PriceData) QuotedQuotaUnit(legacyUnit float64) float64
- func (p *PriceData) QuotedToolPrice(name string) (float64, bool)
- func (p *PriceData) RemoveOtherRatiosFromFloat(value float64) float64
- func (p *PriceData) ReplaceOtherRatios(ratios map[string]float64) bool
- func (p *PriceData) ToSetting() string
- type RWMap
- func (m *RWMap[K, V]) AddAll(other map[K]V)
- func (m *RWMap[K, V]) Clear()
- func (m *RWMap[K, V]) Get(key K) (V, bool)
- func (m *RWMap[K, V]) Len() int
- func (m *RWMap[K, V]) MarshalJSON() ([]byte, error)
- func (m *RWMap[K, V]) MarshalJSONString() string
- func (m *RWMap[K, V]) ReadAll() map[K]V
- func (m *RWMap[K, V]) Set(key K, value V)
- func (m *RWMap[K, V]) UnmarshalJSON(b []byte) error
- type RealtimeUsageCheckpoint
- type Set
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadFromJsonString ¶
func LoadFromJsonString[K comparable, V any](m *RWMap[K, V], jsonStr string) error
func LoadFromJsonStringWithCallback ¶
func LoadFromJsonStringWithCallback[K comparable, V any](m *RWMap[K, V], jsonStr string, onSuccess func()) error
Types ¶
type GroupRatioInfo ¶
type PriceData ¶
type PriceData struct {
FreeModel bool
ModelPrice float64
ModelRatio float64
CompletionRatio float64
CacheRatio float64
CacheCreationRatio float64
CacheCreation5mRatio float64
CacheCreation1hRatio float64
ImageRatio float64
AudioRatio float64
AudioCompletionRatio float64
UsePrice bool
Quota int // 按次计费的最终额度(MJ / Task)
QuotaToPreConsume int // 按量计费的预消耗额度
GroupRatioInfo GroupRatioInfo
// contains filtered or unexported fields
}
func (*PriceData) AddOtherRatio ¶
func (*PriceData) ApplyOtherRatiosToDecimal ¶
func (*PriceData) ApplyOtherRatiosToFloat ¶
func (*PriceData) CapturePreConsumeTokens ¶
CapturePreConsumeTokens freezes the non-tiered estimate and its initial group. Retries can reprice that estimate without reading live token defaults or model prices, including when the first group's ratio was zero.
func (*PriceData) CaptureQuotaUnit ¶
CaptureQuotaUnit seals the currency conversion for this request. The field is private so invalid/untrusted PriceData cannot assign a snapshot directly.
func (*PriceData) CaptureToolPrices ¶
func (*PriceData) HasOtherRatio ¶
func (*PriceData) OtherRatioMultiplier ¶
func (*PriceData) OtherRatios ¶
func (*PriceData) QuotedPreConsumeTokens ¶
func (*PriceData) QuotedQuotaUnit ¶
QuotedQuotaUnit preserves old internal callers without a captured unit; quote helpers always capture one before returning a request PriceData.
func (*PriceData) QuotedToolPrice ¶
The bool reports whether the entire price generation was captured, not whether this tool exists. Absent tools in a captured generation cost zero.
func (*PriceData) RemoveOtherRatiosFromFloat ¶
func (*PriceData) ReplaceOtherRatios ¶
type RWMap ¶
type RWMap[K comparable, V any] struct { // contains filtered or unexported fields }
func NewRWMap ¶
func NewRWMap[K comparable, V any]() *RWMap[K, V]
func (*RWMap[K, V]) MarshalJSON ¶
func (*RWMap[K, V]) MarshalJSONString ¶
func (*RWMap[K, V]) UnmarshalJSON ¶
type RealtimeUsageCheckpoint ¶
type RealtimeUsageCheckpoint struct {
Responses int `json:"responses"`
Quota int `json:"quota"`
Input int `json:"input_tokens"`
Output int `json:"output_tokens"`
Total int `json:"total_tokens"`
InputText int `json:"input_text_tokens"`
InputAudio int `json:"input_audio_tokens"`
InputImage int `json:"input_image_tokens"`
OutputText int `json:"output_text_tokens"`
OutputAudio int `json:"output_audio_tokens"`
OutputImage int `json:"output_image_tokens"`
}
RealtimeUsageCheckpoint stores bounded confirmed totals, not response bodies or history. Cache and reasoning are already included in their parent counts.
type Set ¶
type Set[T comparable] struct { // contains filtered or unexported fields }
func NewSet ¶
func NewSet[T comparable]() *Set[T]