summaryrefslogtreecommitdiff
path: root/internal/domain
diff options
context:
space:
mode:
authorChia <Chia@93.nz>2026-08-06 15:58:57 +1200
committerChia <Chia@93.nz>2026-08-06 15:58:57 +1200
commit3f702084d20b3c3a3ea916f3110e99b22bda60b3 (patch)
tree517f76c51025ce1ee085ea4898c60f799e5c37ea /internal/domain
parent41e322c53d7b4b796eb377d0df9c29ecd10ba431 (diff)
feat: complete commercial developer workflowspublish-commercial-control-plane
Add tenant-safe usage observability, prepaid billing controls, API key lifecycle management, Embeddings metering, configurable billing alerts, and resilient provider health propagation. Harden Stripe failure handling, migrations, readiness, and the authenticated control-plane UI with end-to-end verification evidence.
Diffstat (limited to 'internal/domain')
-rw-r--r--internal/domain/types.go22
1 files changed, 19 insertions, 3 deletions
diff --git a/internal/domain/types.go b/internal/domain/types.go
index 81da8f2..c700123 100644
--- a/internal/domain/types.go
+++ b/internal/domain/types.go
@@ -5,9 +5,21 @@ import "time"
type Protocol string
const (
- ProtocolOpenAI Protocol = "openai"
- ProtocolOpenAIResponses Protocol = "openai_responses"
- ProtocolAnthropic Protocol = "anthropic"
+ ProtocolOpenAI Protocol = "openai"
+ ProtocolOpenAIResponses Protocol = "openai_responses"
+ ProtocolOpenAIEmbeddings Protocol = "openai_embeddings"
+ ProtocolAnthropic Protocol = "anthropic"
+)
+
+// MeteringUnit defines the physical quantity a price applies to. Token-priced
+// endpoints are implemented today; image and second keep future media pricing
+// explicit instead of overloading token counters.
+type MeteringUnit string
+
+const (
+ MeteringUnitToken MeteringUnit = "token"
+ MeteringUnitImage MeteringUnit = "image"
+ MeteringUnitSecond MeteringUnit = "second"
)
type Principal struct {
@@ -17,6 +29,9 @@ type Principal struct {
Scopes []string
AllowedModels map[string]struct{}
MonthlySpendMicros int64
+ DailySpendMicros int64
+ RequestsPerMinute int64
+ TokensPerMinute int64
ExpiresAt *time.Time
}
@@ -126,6 +141,7 @@ type UsageEvent struct {
Attempts int `json:"attempts"`
StartedAt time.Time `json:"started_at"`
DurationMS int64 `json:"duration_ms"`
+ TTFTMS int64 `json:"ttft_ms,omitempty"`
Usage Usage `json:"usage"`
UsageReported bool `json:"usage_reported"`
}