summaryrefslogtreecommitdiff
path: root/internal/controlplane/types.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/controlplane/types.go')
-rw-r--r--internal/controlplane/types.go163
1 files changed, 145 insertions, 18 deletions
diff --git a/internal/controlplane/types.go b/internal/controlplane/types.go
index 24f2843..7dfb734 100644
--- a/internal/controlplane/types.go
+++ b/internal/controlplane/types.go
@@ -62,30 +62,38 @@ type Route struct {
}
type Model struct {
- ID string `json:"id"`
- PublicID string `json:"public_id"`
- OwnedBy string `json:"owned_by"`
- Enabled bool `json:"enabled"`
- Routes []Route `json:"routes"`
- CreatedAt time.Time `json:"created_at"`
+ ID string `json:"id"`
+ PublicID string `json:"public_id"`
+ OwnedBy string `json:"owned_by"`
+ InputPriceMicrosPerMillion int64 `json:"input_price_micros_per_million"`
+ OutputPriceMicrosPerMillion int64 `json:"output_price_micros_per_million"`
+ CacheReadPriceMicrosPerMillion int64 `json:"cache_read_price_micros_per_million"`
+ CacheWritePriceMicrosPerMillion int64 `json:"cache_write_price_micros_per_million"`
+ Enabled bool `json:"enabled"`
+ Routes []Route `json:"routes"`
+ CreatedAt time.Time `json:"created_at"`
}
type Overview struct {
- Generation int64 `json:"generation"`
- RuntimeGeneration int64 `json:"runtime_generation"`
- RedisConfigured bool `json:"redis_configured"`
- RedisConnected bool `json:"redis_connected"`
- Tenants int64 `json:"tenants"`
- Projects int64 `json:"projects"`
- APIKeys int64 `json:"api_keys"`
- Providers int64 `json:"providers"`
- Models int64 `json:"models"`
+ Generation int64 `json:"generation"`
+ RuntimeGeneration int64 `json:"runtime_generation"`
+ RedisConfigured bool `json:"redis_configured"`
+ RedisConnected bool `json:"redis_connected"`
+ Tenants int64 `json:"tenants"`
+ Projects int64 `json:"projects"`
+ APIKeys int64 `json:"api_keys"`
+ Providers int64 `json:"providers"`
+ Models int64 `json:"models"`
+ BillingEnabled bool `json:"billing_enabled"`
+ StripeEnabled bool `json:"stripe_enabled"`
+ BillingCurrency string `json:"billing_currency,omitempty"`
}
type Snapshot struct {
Generation int64
Models []domain.Model
APIKeys []auth.HashedKeyRecord
+ Limits []domain.LimitPolicy
}
type ChangeEvent struct {
@@ -132,7 +140,126 @@ type RouteInput struct {
}
type CreateModelInput struct {
- PublicID string `json:"public_id"`
- OwnedBy string `json:"owned_by"`
- Routes []RouteInput `json:"routes"`
+ PublicID string `json:"public_id"`
+ OwnedBy string `json:"owned_by"`
+ InputPriceMicrosPerMillion int64 `json:"input_price_micros_per_million"`
+ OutputPriceMicrosPerMillion int64 `json:"output_price_micros_per_million"`
+ CacheReadPriceMicrosPerMillion int64 `json:"cache_read_price_micros_per_million"`
+ CacheWritePriceMicrosPerMillion int64 `json:"cache_write_price_micros_per_million"`
+ Routes []RouteInput `json:"routes"`
+}
+
+type ConsoleActor struct {
+ ID string `json:"id,omitempty"`
+ TenantID string `json:"tenant_id,omitempty"`
+ Email string `json:"email"`
+ DisplayName string `json:"display_name"`
+ Role string `json:"role"`
+ Bootstrap bool `json:"bootstrap"`
+}
+
+type ConsoleUser struct {
+ ID string `json:"id"`
+ TenantID string `json:"tenant_id,omitempty"`
+ Email string `json:"email"`
+ DisplayName string `json:"display_name"`
+ Role string `json:"role"`
+ TokenPrefix string `json:"token_prefix"`
+ Status string `json:"status"`
+ LastUsedAt *time.Time `json:"last_used_at,omitempty"`
+ CreatedAt time.Time `json:"created_at"`
+}
+
+type CreatedConsoleUser struct {
+ ConsoleUser
+ Token string `json:"token"`
+}
+
+type CreateConsoleUserInput struct {
+ TenantID string `json:"tenant_id"`
+ Email string `json:"email"`
+ DisplayName string `json:"display_name"`
+ Role string `json:"role"`
+}
+
+type ProjectLimit struct {
+ domain.LimitPolicy
+ ProjectName string `json:"project_name"`
+ TenantName string `json:"tenant_name"`
+ UpdatedAt time.Time `json:"updated_at"`
+}
+
+type SetProjectLimitInput struct {
+ RequestsPerMinute int64 `json:"requests_per_minute"`
+ TokensPerMinute int64 `json:"tokens_per_minute"`
+ ConcurrentRequests int64 `json:"concurrent_requests"`
+ MonthlySpendMicros int64 `json:"monthly_spend_micros"`
+}
+
+type UsageRecord struct {
+ RequestID string `json:"request_id"`
+ TenantID string `json:"tenant_id"`
+ ProjectID string `json:"project_id"`
+ KeyID string `json:"key_id"`
+ PublicModel string `json:"public_model"`
+ ProviderID string `json:"provider_id,omitempty"`
+ UpstreamModel string `json:"upstream_model,omitempty"`
+ Protocol string `json:"protocol"`
+ Stream bool `json:"stream"`
+ StatusCode int `json:"status_code"`
+ Success bool `json:"success"`
+ ErrorType string `json:"error_type,omitempty"`
+ Attempts int `json:"attempts"`
+ StartedAt time.Time `json:"started_at"`
+ DurationMS int64 `json:"duration_ms"`
+ InputTokens int64 `json:"input_tokens"`
+ OutputTokens int64 `json:"output_tokens"`
+ TotalTokens int64 `json:"total_tokens"`
+ CacheCreationInputTokens int64 `json:"cache_creation_input_tokens"`
+ CacheReadInputTokens int64 `json:"cache_read_input_tokens"`
+ CostMicros int64 `json:"cost_micros"`
+ ChargedMicros int64 `json:"charged_micros"`
+ UncollectedMicros int64 `json:"uncollected_micros"`
+}
+
+type UsageSummary struct {
+ PeriodStart time.Time `json:"period_start"`
+ TenantID string `json:"tenant_id"`
+ ProjectID string `json:"project_id"`
+ ProjectName string `json:"project_name"`
+ RequestCount int64 `json:"request_count"`
+ SuccessfulRequests int64 `json:"successful_requests"`
+ InputTokens int64 `json:"input_tokens"`
+ OutputTokens int64 `json:"output_tokens"`
+ TotalTokens int64 `json:"total_tokens"`
+ CostMicros int64 `json:"cost_micros"`
+ ChargedMicros int64 `json:"charged_micros"`
+ UncollectedMicros int64 `json:"uncollected_micros"`
+}
+
+type AuditLog struct {
+ ID int64 `json:"id"`
+ ActorID string `json:"actor_id,omitempty"`
+ ActorType string `json:"actor_type"`
+ ActorRole string `json:"actor_role"`
+ TenantID string `json:"tenant_id,omitempty"`
+ RequestID string `json:"request_id"`
+ Method string `json:"method"`
+ Path string `json:"path"`
+ Action string `json:"action"`
+ StatusCode int `json:"status_code"`
+ RemoteIP string `json:"remote_ip,omitempty"`
+ UserAgent string `json:"user_agent,omitempty"`
+ CreatedAt time.Time `json:"created_at"`
+}
+
+type AuditInput struct {
+ Actor ConsoleActor
+ RequestID string
+ Method string
+ Path string
+ Action string
+ StatusCode int
+ RemoteIP string
+ UserAgent string
}