diff options
Diffstat (limited to '')
| -rw-r--r-- | internal/domain/types.go | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/internal/domain/types.go b/internal/domain/types.go index b1decc9..94e56c1 100644 --- a/internal/domain/types.go +++ b/internal/domain/types.go @@ -32,7 +32,27 @@ type Route struct { type Model struct { ID string + DisplayName string + Description string OwnedBy string + InputModalities []string + OutputModalities []string + ContextWindow int64 + MaxOutputTokens int64 + Capabilities []string + Regions []string + Lifecycle string + ReleasedAt *time.Time + DeprecatedAt *time.Time + RetiredAt *time.Time + ReplacementModel string + Aliases []string + AllowedTenantIDs map[string]struct{} + AllowedKeyIDs map[string]struct{} + PriceVersionID string + PriceVersion int + PriceCurrency string + PriceEffectiveFrom time.Time InputPriceMicrosPerMillion int64 OutputPriceMicrosPerMillion int64 CacheReadPriceMicrosPerMillion int64 @@ -40,6 +60,20 @@ type Model struct { Routes []Route } +func (m Model) Allows(principal Principal) bool { + if len(m.AllowedTenantIDs) > 0 { + if _, ok := m.AllowedTenantIDs[principal.TenantID]; !ok { + return false + } + } + if len(m.AllowedKeyIDs) > 0 { + if _, ok := m.AllowedKeyIDs[principal.KeyID]; !ok { + return false + } + } + return true +} + type Usage struct { InputTokens int64 `json:"input_tokens,omitempty"` OutputTokens int64 `json:"output_tokens,omitempty"` @@ -65,6 +99,7 @@ type UsageEvent struct { StartedAt time.Time `json:"started_at"` DurationMS int64 `json:"duration_ms"` Usage Usage `json:"usage"` + UsageReported bool `json:"usage_reported"` } // LimitPolicy is the immutable runtime view of a project's commercial limits. |
