diff options
Diffstat (limited to 'internal/domain')
| -rw-r--r-- | internal/domain/types.go | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/internal/domain/types.go b/internal/domain/types.go new file mode 100644 index 0000000..e2586ea --- /dev/null +++ b/internal/domain/types.go @@ -0,0 +1,64 @@ +package domain + +import "time" + +type Protocol string + +const ( + ProtocolOpenAI Protocol = "openai" + ProtocolAnthropic Protocol = "anthropic" +) + +type Principal struct { + KeyID string + TenantID string + ProjectID string + Scopes []string +} + +type Provider struct { + ID string + Protocol Protocol + BaseURL string + APIKey string +} + +type Route struct { + Provider Provider + UpstreamModel string + Priority int + Weight int +} + +type Model struct { + ID string + OwnedBy string + Routes []Route +} + +type Usage struct { + InputTokens int64 `json:"input_tokens,omitempty"` + OutputTokens int64 `json:"output_tokens,omitempty"` + TotalTokens int64 `json:"total_tokens,omitempty"` + CacheCreationInputTokens int64 `json:"cache_creation_input_tokens,omitempty"` + CacheReadInputTokens int64 `json:"cache_read_input_tokens,omitempty"` +} + +type UsageEvent struct { + RequestID string `json:"request_id"` + KeyID string `json:"key_id"` + TenantID string `json:"tenant_id"` + ProjectID string `json:"project_id"` + PublicModel string `json:"public_model"` + ProviderID string `json:"provider_id,omitempty"` + UpstreamModel string `json:"upstream_model,omitempty"` + Protocol Protocol `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"` + Usage Usage `json:"usage"` +} |
