Documentation
¶
Overview ¶
Package record owns GORM persistence structs. Wire types live in internal/models. Converters stay in services and remain explicit.
Index ¶
- type Credential
- type CredentialHealth
- type CredentialPark
- type DashboardPassword
- type EventKey
- type EventRecord
- type InstanceSetting
- type MessageBatch
- type MessageBatchEntry
- type MessageBatchResult
- type MetricBucket
- type MetricBucketErrorType
- type MetricBucketModel
- type MetricBucketProvider
- type MetricBucketToken
- type ModelInfo
- type ModelInfoCapability
- type ModelInfoEndpoint
- type ModelInfoModality
- type ModelInfoSnapshot
- type ModelOverride
- type ModelOverrideCapability
- type ModelOverrideModality
- type Plugin
- type PluginAllowHost
- type PluginRepository
- type PluginStorage
- type PluginVersion
- type ProviderInstance
- type ProxyPool
- type ProxyPoolEntry
- type ProxyState
- type ResponseRecord
- type RouterToken
- type Session
- type TokenAllowedCredential
- type TokenAllowedModel
- type TokenAllowedProvider
- type TokenCredentialScope
- type TokenScopeCredential
- type VideoJob
- type VirtualModel
- type VirtualModelMember
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Credential ¶
type Credential struct {
ID string `gorm:"primaryKey"`
ProviderID string `gorm:"not null;index"`
Provider ProviderInstance `gorm:"foreignKey:ProviderID;references:ID;belongsTo;constraint:OnDelete:CASCADE"`
Label string `gorm:"not null"`
// Data is sealed at rest by the credentialcipher serializer
// (AES-256-GCM); the column holds "llmr-enc:v1:<base64>" text.
Data map[string]any `gorm:"serializer:credential_cipher"`
ExpiresAt *time.Time `gorm:"index"`
LastUsedAt *time.Time `gorm:""`
RequestCount int64 `gorm:"not null"`
SuccessCount int64 `gorm:"not null"`
FailureCount int64 `gorm:"not null"`
Disabled bool `gorm:"not null"`
DisabledBy string `gorm:"not null"`
DisabledReason string `gorm:"not null"`
DisabledAt *time.Time `gorm:""`
SortOrder int `gorm:"not null"`
CreatedAt time.Time `gorm:"not null"`
UpdatedAt time.Time `gorm:"not null"`
}
Credential holds one provider authentication row. Data is a JSON object (the shape is plugin-owned through the credential schema), encrypted at rest.
func (Credential) TableName ¶
func (Credential) TableName() string
TableName pins the credentials table name.
type CredentialHealth ¶
type CredentialHealth struct {
CredentialID string `gorm:"primaryKey"`
Credential Credential `gorm:"foreignKey:CredentialID;references:ID;belongsTo;constraint:OnDelete:CASCADE"`
LastCheckAt time.Time `gorm:"not null"`
LastStatus string `gorm:"not null"`
}
CredentialHealth stamps the last detached health-check verdict.
func (CredentialHealth) TableName ¶
func (CredentialHealth) TableName() string
TableName pins the credential health table name.
type CredentialPark ¶
type CredentialPark struct {
CredentialID string `gorm:"primaryKey"`
Credential Credential `gorm:"foreignKey:CredentialID;references:ID;belongsTo;constraint:OnDelete:CASCADE"`
Reason string `gorm:"not null"`
Until time.Time `gorm:"not null;index"`
ParkedAt time.Time `gorm:"not null"`
}
CredentialPark is one transient cooldown park. Expired rows read as missing; cleanup removes them through the Until index.
func (CredentialPark) TableName ¶
func (CredentialPark) TableName() string
TableName pins the credential parks table name.
type DashboardPassword ¶ added in v0.8.1
type DashboardPassword struct {
ID int64 `gorm:"primaryKey;check:id = 1"`
PasswordHash string `gorm:"not null"`
UpdatedAt time.Time `gorm:"not null"`
}
DashboardPassword is the single dashboard password row. The identifier is always 1. The dashboard has one operator, so there are no accounts.
func (DashboardPassword) TableName ¶ added in v0.8.1
func (DashboardPassword) TableName() string
TableName pins the dashboard password table name.
type EventKey ¶
type EventKey struct {
RecordID int64 `gorm:"primaryKey"`
Record EventRecord `gorm:"foreignKey:RecordID;references:ID;belongsTo;constraint:OnDelete:CASCADE"`
Key string `gorm:"primaryKey;index:idx_event_keys_key_value,priority:1"`
Value *string `gorm:"index:idx_event_keys_key_value,priority:2"`
}
EventKey is one metadata entry on an event record. Value is nullable: a null value marks key existence without a value check.
type EventRecord ¶
type EventRecord struct {
ID int64 `gorm:"primaryKey;autoIncrement"`
Timestamp time.Time `gorm:"not null;index:idx_event_records_timestamp"`
Severity int `gorm:"not null;index:idx_event_records_severity_timestamp"`
Message string `gorm:"not null"`
}
EventRecord is one persisted log event. Severity follows 0=DEBUG, 1=INFO, 2=WARN, 3=ERROR, 4=FATAL. Timestamp stores UTC.
func (EventRecord) TableName ¶
func (EventRecord) TableName() string
TableName pins the event records table name.
type InstanceSetting ¶
type InstanceSetting struct {
ID int64 `gorm:"primaryKey;check:id = 1"`
IsClusterNode bool `gorm:"not null"`
DisableTelemetry bool `gorm:"not null"`
ModelsFilter string `gorm:"not null;check:models_filter IN ('all','enabled','disabled')"`
ProxyMaxChecks int `gorm:"not null;default:0"`
// ProxyDisabled and ProxyPoolDisabled store the proxy switches inverted so
// that a zero row (fresh install, bootstrap) keeps the proxy subsystem on.
ProxyDisabled bool `gorm:"not null;default:false"`
ProxyPoolDisabled bool `gorm:"not null;default:false"`
UpdatedAt time.Time `gorm:"not null"`
}
InstanceSetting is the single instance row. The identifier is always 1.
func (InstanceSetting) TableName ¶
func (InstanceSetting) TableName() string
TableName pins the instance settings table name.
type MessageBatch ¶
type MessageBatch struct {
ID string `gorm:"primaryKey"`
Model string `gorm:"not null"`
Status string `gorm:"not null;index"`
CreatedAt time.Time `gorm:"not null"`
UpdatedAt time.Time `gorm:"not null"`
EndedAt *time.Time `gorm:""`
}
MessageBatch is one Anthropic message batch header.
func (MessageBatch) TableName ¶
func (MessageBatch) TableName() string
TableName pins the message batches table name.
type MessageBatchEntry ¶
type MessageBatchEntry struct {
BatchID string `gorm:"primaryKey"`
Batch MessageBatch `gorm:"foreignKey:BatchID;references:ID;belongsTo;constraint:OnDelete:CASCADE"`
Position int `gorm:"primaryKey"`
CustomID string `gorm:"not null"`
Params []byte `gorm:"not null"`
}
MessageBatchEntry is one ordered request inside a batch.
func (MessageBatchEntry) TableName ¶
func (MessageBatchEntry) TableName() string
TableName pins the message batch entries table name.
type MessageBatchResult ¶
type MessageBatchResult struct {
BatchID string `gorm:"primaryKey"`
Batch MessageBatch `gorm:"foreignKey:BatchID;references:ID;belongsTo;constraint:OnDelete:CASCADE"`
Position int `gorm:"primaryKey"`
CustomID string `gorm:"not null"`
Result []byte `gorm:"not null"`
}
MessageBatchResult is one ordered result inside a batch.
func (MessageBatchResult) TableName ¶
func (MessageBatchResult) TableName() string
TableName pins the message batch results table name.
type MetricBucket ¶
type MetricBucket struct {
Granularity string `gorm:"primaryKey"`
Timestamp time.Time `gorm:"primaryKey;index:idx_metric_buckets_timestamp"`
TotalRequests int64 `gorm:"not null"`
TotalErrors int64 `gorm:"not null"`
TokensInput int64 `gorm:"not null"`
TokensOutput int64 `gorm:"not null"`
PeakRequests int64 `gorm:"not null"`
PeakInputTokens int64 `gorm:"not null"`
PeakOutputTokens int64 `gorm:"not null"`
DurationSumMicroseconds int64 `gorm:"not null"`
DurationCount int64 `gorm:"not null"`
}
MetricBucket is one aggregated time window. Dimension child tables share this header through a composite foreign key. Usage history outlives providers, models, and tokens, so children carry no foreign keys to those rows: deleting the parent bucket cascades, deleting a provider never erases history.
func (MetricBucket) TableName ¶
func (MetricBucket) TableName() string
TableName pins the metric buckets table name.
type MetricBucketErrorType ¶
type MetricBucketErrorType struct {
Granularity string `gorm:"primaryKey"`
Timestamp time.Time `gorm:"primaryKey"`
Bucket MetricBucket `gorm:"foreignKey:Granularity,Timestamp;references:Granularity,Timestamp;belongsTo;constraint:OnDelete:CASCADE"`
ErrorType string `gorm:"primaryKey"`
Count int64 `gorm:"not null"`
}
MetricBucketErrorType is one error-type dimension row.
func (MetricBucketErrorType) TableName ¶
func (MetricBucketErrorType) TableName() string
TableName pins the metric bucket error types table name.
type MetricBucketModel ¶
type MetricBucketModel struct {
Granularity string `gorm:"primaryKey"`
Timestamp time.Time `gorm:"primaryKey"`
Bucket MetricBucket `gorm:"foreignKey:Granularity,Timestamp;references:Granularity,Timestamp;belongsTo;constraint:OnDelete:CASCADE"`
ModelID string `gorm:"primaryKey"`
Requests int64 `gorm:"not null"`
Errors int64 `gorm:"not null"`
TokensInput int64 `gorm:"not null"`
TokensOutput int64 `gorm:"not null"`
PeakRequests int64 `gorm:"not null"`
PeakInputTokens int64 `gorm:"not null"`
PeakOutputTokens int64 `gorm:"not null"`
}
MetricBucketModel is one model dimension row.
func (MetricBucketModel) TableName ¶
func (MetricBucketModel) TableName() string
TableName pins the metric bucket models table name.
type MetricBucketProvider ¶
type MetricBucketProvider struct {
Granularity string `gorm:"primaryKey"`
Timestamp time.Time `gorm:"primaryKey"`
Bucket MetricBucket `gorm:"foreignKey:Granularity,Timestamp;references:Granularity,Timestamp;belongsTo;constraint:OnDelete:CASCADE"`
Dimension string `gorm:"primaryKey;check:dimension IN ('provider_id','provider_type')"`
Key string `gorm:"primaryKey"`
Requests int64 `gorm:"not null"`
Errors int64 `gorm:"not null"`
TokensInput int64 `gorm:"not null"`
TokensOutput int64 `gorm:"not null"`
PeakRequests int64 `gorm:"not null"`
PeakInputTokens int64 `gorm:"not null"`
PeakOutputTokens int64 `gorm:"not null"`
}
MetricBucketProvider is one provider dimension row. Dimension reads provider_id or provider_type; both share this table.
func (MetricBucketProvider) TableName ¶
func (MetricBucketProvider) TableName() string
TableName pins the metric bucket providers table name.
type MetricBucketToken ¶
type MetricBucketToken struct {
Granularity string `gorm:"primaryKey"`
Timestamp time.Time `gorm:"primaryKey"`
Bucket MetricBucket `gorm:"foreignKey:Granularity,Timestamp;references:Granularity,Timestamp;belongsTo;constraint:OnDelete:CASCADE"`
TokenID string `gorm:"primaryKey"`
Requests int64 `gorm:"not null"`
Errors int64 `gorm:"not null"`
TokensInput int64 `gorm:"not null"`
TokensOutput int64 `gorm:"not null"`
PeakRequests int64 `gorm:"not null"`
PeakInputTokens int64 `gorm:"not null"`
PeakOutputTokens int64 `gorm:"not null"`
LastUsed *time.Time `gorm:""`
}
MetricBucketToken is one token dimension row.
func (MetricBucketToken) TableName ¶
func (MetricBucketToken) TableName() string
TableName pins the metric bucket tokens table name.
type ModelInfo ¶
type ModelInfo struct {
ProviderID string `gorm:"primaryKey"`
Snapshot ModelInfoSnapshot `gorm:"foreignKey:ProviderID;references:ProviderID;belongsTo;constraint:OnDelete:CASCADE"`
ModelName string `gorm:"primaryKey"`
DisplayName string `gorm:"not null"`
Description string `gorm:"not null"`
RequestsPerMinute int64 `gorm:"not null"`
TokensPerMinute int64 `gorm:"not null"`
RequestsPerDay int64 `gorm:"not null"`
ContextWindow int64 `gorm:"not null"`
MaxTokens int64 `gorm:"not null"`
SupportedParameters []string `gorm:"serializer:json"`
Reasoning []byte `gorm:""`
}
ModelInfo is one cached upstream model row. SupportedParameters and Reasoning stay JSON because the vocabulary is upstream-defined.
type ModelInfoCapability ¶
type ModelInfoCapability struct {
ProviderID string `gorm:"primaryKey"`
ModelName string `gorm:"primaryKey"`
Model ModelInfo `gorm:"foreignKey:ProviderID,ModelName;references:ProviderID,ModelName;belongsTo;constraint:OnDelete:CASCADE"`
Capability string `gorm:"primaryKey"`
}
ModelInfoCapability is one capability chip on a cached model.
func (ModelInfoCapability) TableName ¶
func (ModelInfoCapability) TableName() string
TableName pins the model info capabilities table name.
type ModelInfoEndpoint ¶
type ModelInfoEndpoint struct {
ProviderID string `gorm:"primaryKey"`
ModelName string `gorm:"primaryKey"`
Model ModelInfo `gorm:"foreignKey:ProviderID,ModelName;references:ProviderID,ModelName;belongsTo;constraint:OnDelete:CASCADE"`
Endpoint string `gorm:"primaryKey"`
}
ModelInfoEndpoint is one served endpoint on a cached model.
func (ModelInfoEndpoint) TableName ¶
func (ModelInfoEndpoint) TableName() string
TableName pins the model info endpoints table name.
type ModelInfoModality ¶
type ModelInfoModality struct {
ProviderID string `gorm:"primaryKey"`
ModelName string `gorm:"primaryKey"`
Model ModelInfo `gorm:"foreignKey:ProviderID,ModelName;references:ProviderID,ModelName;belongsTo;constraint:OnDelete:CASCADE"`
Direction string `gorm:"primaryKey;check:direction IN ('input','output')"`
Modality string `gorm:"primaryKey"`
}
ModelInfoModality is one modality on a cached model.
func (ModelInfoModality) TableName ¶
func (ModelInfoModality) TableName() string
TableName pins the model info modalities table name.
type ModelInfoSnapshot ¶
type ModelInfoSnapshot struct {
ProviderID string `gorm:"primaryKey"`
Provider ProviderInstance `gorm:"foreignKey:ProviderID;references:ID;belongsTo;constraint:OnDelete:CASCADE"`
CachedAt time.Time `gorm:"not null"`
}
ModelInfoSnapshot is one provider's model metadata cache header.
func (ModelInfoSnapshot) TableName ¶
func (ModelInfoSnapshot) TableName() string
TableName pins the model info snapshots table name.
type ModelOverride ¶
type ModelOverride struct {
ProviderID string `gorm:"primaryKey"`
Provider ProviderInstance `gorm:"foreignKey:ProviderID;references:ID;belongsTo;constraint:OnDelete:CASCADE"`
ModelName string `gorm:"primaryKey"`
Disabled bool `gorm:"not null"`
Custom bool `gorm:"not null"`
DisplayName string `gorm:"not null"`
}
ModelOverride is the per-provider admin override for one model: disabled from routing, registered as custom, or display-adjusted. Lists normalize into child rows because the router filters on them.
func (ModelOverride) TableName ¶
func (ModelOverride) TableName() string
TableName pins the model overrides table name.
type ModelOverrideCapability ¶
type ModelOverrideCapability struct {
ProviderID string `gorm:"primaryKey"`
ModelName string `gorm:"primaryKey"`
Override ModelOverride `gorm:"foreignKey:ProviderID,ModelName;references:ProviderID,ModelName;belongsTo;constraint:OnDelete:CASCADE"`
Capability string `gorm:"primaryKey"`
}
ModelOverrideCapability is one capability chip on an override.
func (ModelOverrideCapability) TableName ¶
func (ModelOverrideCapability) TableName() string
TableName pins the model override capabilities table name.
type ModelOverrideModality ¶
type ModelOverrideModality struct {
ProviderID string `gorm:"primaryKey"`
ModelName string `gorm:"primaryKey"`
Override ModelOverride `gorm:"foreignKey:ProviderID,ModelName;references:ProviderID,ModelName;belongsTo;constraint:OnDelete:CASCADE"`
Direction string `gorm:"primaryKey;check:direction IN ('input','output')"`
Modality string `gorm:"primaryKey"`
}
ModelOverrideModality is one verified modality on an override.
func (ModelOverrideModality) TableName ¶
func (ModelOverrideModality) TableName() string
TableName pins the model override modalities table name.
type Plugin ¶
type Plugin struct {
ID string `gorm:"primaryKey"`
DisplayName string `gorm:"not null"`
Author string `gorm:"not null"`
Version string `gorm:"not null"`
PluginAPIVersion string `gorm:"not null"`
Description string `gorm:"not null"`
License string `gorm:"not null"`
Unsafe bool `gorm:"not null"`
Disabled bool `gorm:"not null"`
OriginRepositoryID *string `gorm:""`
OriginRepository *PluginRepository `gorm:"foreignKey:OriginRepositoryID;references:ID;belongsTo;constraint:OnDelete:SET NULL"`
OriginPath string `gorm:"not null"`
OriginManual bool `gorm:"not null"`
Declarations map[string]any `gorm:"serializer:json"`
Source []byte `gorm:"not null"`
InstalledAt time.Time `gorm:"not null"`
UpdatedAt time.Time `gorm:"not null"`
}
Plugin is one installed provider backend. Declarations stay JSON because the shape is plugin-owned: type keys, handlers, icons, recursive UI schema trees, jobs, model specifications, health cooldowns, proxy source keys. Source lands in a BLOB column, without base64 overhead.
type PluginAllowHost ¶
type PluginAllowHost struct {
PluginID string `gorm:"primaryKey"`
Plugin Plugin `gorm:"foreignKey:PluginID;references:ID;belongsTo;constraint:OnDelete:CASCADE"`
Host string `gorm:"primaryKey"`
}
PluginAllowHost is one router-enforced allow-list entry.
func (PluginAllowHost) TableName ¶
func (PluginAllowHost) TableName() string
TableName pins the plugin allow hosts table name.
type PluginRepository ¶
type PluginRepository struct {
ID string `gorm:"primaryKey"`
Kind string `gorm:"not null"`
IndexURL string `gorm:"not null;uniqueIndex"`
SourceURL string `gorm:"not null"`
Title string `gorm:"not null"`
Description string `gorm:"not null"`
Builtin bool `gorm:"not null"`
AddedAt time.Time `gorm:"not null"`
}
PluginRepository is one added plugin store: a single-URL index repo. Built-in repos seed on startup and reject removal in the service.
func (PluginRepository) TableName ¶
func (PluginRepository) TableName() string
TableName pins the plugin repositories table name.
type PluginStorage ¶
type PluginStorage struct {
PluginID string `gorm:"primaryKey"`
Plugin Plugin `gorm:"foreignKey:PluginID;references:ID;belongsTo;constraint:OnDelete:CASCADE"`
Scope string `gorm:"primaryKey"`
Key string `gorm:"primaryKey"`
Value []byte `gorm:"not null"`
ExpiresAt *time.Time `gorm:"index"`
}
PluginStorage is one llm_router.storage entry. The composite primary key replaces the NUL-separated bucket string. Value stays JSON because the shape is plugin-owned; expiry is an indexed column.
func (PluginStorage) TableName ¶
func (PluginStorage) TableName() string
TableName pins the plugin storage table name.
type PluginVersion ¶
type PluginVersion struct {
ID string `gorm:"primaryKey"`
PluginID string `gorm:"not null;index"`
Plugin Plugin `gorm:"foreignKey:PluginID;references:ID;belongsTo;constraint:OnDelete:CASCADE"`
Version string `gorm:"not null"`
Source []byte `gorm:"not null"`
Declarations map[string]any `gorm:"serializer:json"`
CreatedAt time.Time `gorm:"not null"`
}
PluginVersion is one rollback history entry. Retention follows the luaplugin cap: ten full-source snapshots per plugin.
func (PluginVersion) TableName ¶
func (PluginVersion) TableName() string
TableName pins the plugin versions table name.
type ProviderInstance ¶
type ProviderInstance struct {
ID string `gorm:"primaryKey"`
Name string `gorm:"not null"`
TypeKey string `gorm:"not null;index"`
BaseURL *string `gorm:""`
ProxyPoolID *string `gorm:""`
ProxyPool *ProxyPool `gorm:"foreignKey:ProxyPoolID;references:ID;belongsTo;constraint:OnDelete:RESTRICT"`
DisableFailedCredentials bool `gorm:"not null"`
Disabled bool `gorm:"not null"`
DisabledBy string `gorm:"not null"`
DisabledReason string `gorm:"not null"`
DisabledAt *time.Time `gorm:""`
IsUIReadonly bool `gorm:"not null"`
IsUIHidden bool `gorm:"not null"`
IconURL string `gorm:"not null"`
Settings map[string]any `gorm:"serializer:json"`
CreatedAt time.Time `gorm:"not null"`
UpdatedAt time.Time `gorm:"not null"`
}
ProviderInstance is the single persisted provider row for every type: lua-plugin type keys plus built-in custom and virtual.
func (ProviderInstance) TableName ¶
func (ProviderInstance) TableName() string
TableName pins the provider instances table name.
type ProxyPool ¶
type ProxyPool struct {
ID string `gorm:"primaryKey"`
Name string `gorm:"not null"`
Builtin bool `gorm:"not null"`
CreatedAt time.Time `gorm:"not null"`
UpdatedAt time.Time `gorm:"not null"`
}
ProxyPool is one named proxy pool. The router seeds the built-in pool auto.
type ProxyPoolEntry ¶
type ProxyPoolEntry struct {
PoolID string `gorm:"primaryKey"`
Pool ProxyPool `gorm:"foreignKey:PoolID;references:ID;belongsTo;constraint:OnDelete:CASCADE"`
Position int `gorm:"primaryKey"`
URL string `gorm:"not null"`
Country string `gorm:"not null"`
}
ProxyPoolEntry is one manual entry in a custom pool. Position preserves order.
func (ProxyPoolEntry) TableName ¶
func (ProxyPoolEntry) TableName() string
TableName pins the proxy pool entries table name.
type ProxyState ¶
type ProxyState struct {
URL string `gorm:"primaryKey"`
IP string `gorm:"not null"`
Port int `gorm:"not null"`
Location string `gorm:"not null"`
IsDead bool `gorm:"not null;index"`
Source string `gorm:"not null"`
FailReason string `` /* 129-byte string literal not displayed */
SoftFails int `gorm:"not null"`
Suspect bool `gorm:"not null"`
LastSeenInSource time.Time `gorm:"not null"`
Penalty float64 `gorm:"not null"`
Score float64 `gorm:"not null"`
ReviveAt time.Time `gorm:"not null"`
LastCheckedAt time.Time `gorm:"not null;index"`
LatencyNanoseconds int64 `gorm:"not null"`
Metadata map[string]string `gorm:"serializer:json"`
}
ProxyState is one cached free-pool proxy keyed by canonical URL. Metadata stays JSON because the shape is user free-form.
func (ProxyState) TableName ¶
func (ProxyState) TableName() string
TableName pins the proxy states table name.
type ResponseRecord ¶
type ResponseRecord struct {
ID string `gorm:"primaryKey"`
Kind string `gorm:"not null;index"`
Model string `gorm:"not null"`
Status string `gorm:"not null"`
ParentID *string `gorm:"index"`
RefID string `gorm:"not null"`
Payload []byte `gorm:"not null"`
Input []byte `gorm:"not null"`
CreatedAt time.Time `gorm:"not null"`
UpdatedAt time.Time `gorm:"not null"`
}
ResponseRecord is one async compat object: response, conversation, assistant, thread, message, or run. Payload and Input stay raw JSON because the bodies are client-owned. ParentID is a soft self-reference.
func (ResponseRecord) TableName ¶
func (ResponseRecord) TableName() string
TableName pins the response records table name.
type RouterToken ¶
type RouterToken struct {
ID string `gorm:"primaryKey"`
Name string `gorm:"not null"`
TokenHash string `gorm:"not null;uniqueIndex"`
AllowAllProviders bool `gorm:"not null"`
AllowAllModels bool `gorm:"not null"`
AllowAllCredentials bool `gorm:"not null"`
CreatedAt time.Time `gorm:"not null"`
}
RouterToken is one issued bearer token. Rules normalize into child rows.
func (RouterToken) TableName ¶
func (RouterToken) TableName() string
TableName pins the router tokens table name.
type Session ¶
type Session struct {
TokenHash string `gorm:"primaryKey"`
CreatedAt time.Time `gorm:"not null"`
ExpiresAt time.Time `gorm:"not null;index"`
RememberMe bool `gorm:"not null"`
}
Session is one dashboard session. The token hash is the primary key so the plaintext token never lands in storage.
type TokenAllowedCredential ¶
type TokenAllowedCredential struct {
TokenID string `gorm:"primaryKey"`
Token RouterToken `gorm:"foreignKey:TokenID;references:ID;belongsTo;constraint:OnDelete:CASCADE"`
CredentialID string `gorm:"primaryKey"`
Credential Credential `gorm:"foreignKey:CredentialID;references:ID;belongsTo;constraint:OnDelete:CASCADE"`
}
TokenAllowedCredential pins one credential on a token allow-list.
func (TokenAllowedCredential) TableName ¶
func (TokenAllowedCredential) TableName() string
TableName pins the token allowed credentials table name.
type TokenAllowedModel ¶
type TokenAllowedModel struct {
TokenID string `gorm:"primaryKey"`
Token RouterToken `gorm:"foreignKey:TokenID;references:ID;belongsTo;constraint:OnDelete:CASCADE"`
ModelID string `gorm:"primaryKey"`
}
TokenAllowedModel pins one provider/model on a token allow-list. The model identifier is a soft reference: provider/model strings outlive catalog rows, so no foreign key guards them.
func (TokenAllowedModel) TableName ¶
func (TokenAllowedModel) TableName() string
TableName pins the token allowed models table name.
type TokenAllowedProvider ¶
type TokenAllowedProvider struct {
TokenID string `gorm:"primaryKey"`
Token RouterToken `gorm:"foreignKey:TokenID;references:ID;belongsTo;constraint:OnDelete:CASCADE"`
ProviderID string `gorm:"primaryKey"`
Provider ProviderInstance `gorm:"foreignKey:ProviderID;references:ID;belongsTo;constraint:OnDelete:CASCADE"`
}
TokenAllowedProvider pins one provider on a token allow-list.
func (TokenAllowedProvider) TableName ¶
func (TokenAllowedProvider) TableName() string
TableName pins the token allowed providers table name.
type TokenCredentialScope ¶
type TokenCredentialScope struct {
ID string `gorm:"primaryKey"`
TokenID string `gorm:"not null;uniqueIndex:idx_token_scopes_provider"`
Token RouterToken `gorm:"foreignKey:TokenID;references:ID;belongsTo;constraint:OnDelete:CASCADE"`
ProviderID string `gorm:"not null;uniqueIndex:idx_token_scopes_provider"`
Provider ProviderInstance `gorm:"foreignKey:ProviderID;references:ID;belongsTo;constraint:OnDelete:CASCADE"`
AllCredentials bool `gorm:"not null"`
}
TokenCredentialScope grants a token access to one provider's credentials: all of them when AllCredentials reads true, pinned ones otherwise.
func (TokenCredentialScope) TableName ¶
func (TokenCredentialScope) TableName() string
TableName pins the token credential scopes table name.
type TokenScopeCredential ¶
type TokenScopeCredential struct {
ScopeID string `gorm:"primaryKey"`
Scope TokenCredentialScope `gorm:"foreignKey:ScopeID;references:ID;belongsTo;constraint:OnDelete:CASCADE"`
CredentialID string `gorm:"primaryKey"`
Credential Credential `gorm:"foreignKey:CredentialID;references:ID;belongsTo;constraint:OnDelete:CASCADE"`
}
TokenScopeCredential pins one credential inside a scope.
func (TokenScopeCredential) TableName ¶
func (TokenScopeCredential) TableName() string
TableName pins the token scope credentials table name.
type VideoJob ¶
type VideoJob struct {
ID string `gorm:"primaryKey"`
Model string `gorm:"not null"`
BackendModel string `gorm:"not null"`
ProviderID string `gorm:"not null"`
TypeKey string `gorm:"not null"`
UpstreamJobID string `gorm:"not null"`
Status string `gorm:"not null;index"`
CreatedAt time.Time `gorm:"not null"`
UpdatedAt time.Time `gorm:"not null"`
}
VideoJob persists one router-side video generation job: the local ID handed to the client plus the upstream job it polls. The provider column is a soft history reference, deliberately without a foreign key.
type VirtualModel ¶
type VirtualModel struct {
ID string `gorm:"primaryKey"`
Name string `gorm:"not null"`
NameKey string `gorm:"not null;uniqueIndex"`
Description string `gorm:"not null"`
Instruction string `gorm:"not null"`
ManagedProviderID *string `gorm:""`
ManagedProvider *ProviderInstance `gorm:"foreignKey:ManagedProviderID;references:ID;belongsTo;constraint:OnDelete:CASCADE"`
ManagedEndpointSlug *string `gorm:""`
Disabled bool `gorm:"not null"`
Version int `gorm:"not null"`
CreatedAt time.Time `gorm:"not null"`
UpdatedAt time.Time `gorm:"not null"`
}
VirtualModel routes requests to its members in list order. ManagedBy splits into managed columns: provider-maintained rows resolve live.
func (VirtualModel) TableName ¶
func (VirtualModel) TableName() string
TableName pins the virtual models table name.
type VirtualModelMember ¶
type VirtualModelMember struct {
VirtualModelID string `gorm:"primaryKey"`
VirtualModel VirtualModel `gorm:"foreignKey:VirtualModelID;references:ID;belongsTo;constraint:OnDelete:CASCADE"`
Position int `gorm:"primaryKey"`
ProviderID string `gorm:"not null"`
Provider ProviderInstance `gorm:"foreignKey:ProviderID;references:ID;belongsTo;constraint:OnDelete:CASCADE"`
ModelName string `gorm:"not null"`
}
VirtualModelMember is one fall-through step. Position keeps the priority order. Members pointing at another virtual model use the virtual provider row, so every member references a provider instance.
func (VirtualModelMember) TableName ¶
func (VirtualModelMember) TableName() string
TableName pins the virtual model members table name.