package model import ( "gorm.io/gorm" ) type User struct { gorm.Model Username string `gorm:"uniqueIndex;not null"` Quota int64 `gorm:"default:0"` Role string `gorm:"default:'user'"` // admin, user } type Provider struct { gorm.Model Name string `gorm:"not null"` Type string `gorm:"not null"` // openai, anthropic, etc. BaseURL string APIKey string } type Key struct { gorm.Model ProviderID *uint Provider *Provider KeySecret string `gorm:"not null"` Balance float64 Status string `gorm:"default:'active'"` // active, suspended Weight int `gorm:"default:10"` } type Model struct { gorm.Model Name string `gorm:"uniqueIndex;not null"` ContextWindow int CostPerToken float64 }