mirror of
https://github.com/EZ-Api/ez-api.git
synced 2026-01-13 17:47:51 +00:00
44 lines
1.5 KiB
Go
44 lines
1.5 KiB
Go
package model
|
|
|
|
import (
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type User struct {
|
|
gorm.Model
|
|
Username string `gorm:"uniqueIndex;not null" json:"username"`
|
|
Quota int64 `gorm:"default:0" json:"quota"`
|
|
Role string `gorm:"default:'user'" json:"role"` // admin, user
|
|
}
|
|
|
|
type Provider struct {
|
|
gorm.Model
|
|
Name string `gorm:"not null" json:"name"`
|
|
Type string `gorm:"not null" json:"type"` // openai, anthropic, etc.
|
|
BaseURL string `json:"base_url"`
|
|
APIKey string `json:"api_key"`
|
|
Group string `gorm:"default:'default'" json:"group"` // routing group/tier
|
|
Models string `json:"models"` // comma-separated list of supported models (e.g. "gpt-4,gpt-3.5-turbo")
|
|
}
|
|
|
|
type Key struct {
|
|
gorm.Model
|
|
KeySecret string `gorm:"not null" json:"key_secret"`
|
|
Group string `gorm:"default:'default'" json:"group"` // routing group/tier
|
|
Balance float64 `json:"balance"`
|
|
Status string `gorm:"default:'active'" json:"status"` // active, suspended
|
|
Weight int `gorm:"default:10" json:"weight"`
|
|
}
|
|
|
|
type Model struct {
|
|
gorm.Model
|
|
Name string `gorm:"uniqueIndex;not null" json:"name"`
|
|
ContextWindow int `json:"context_window"`
|
|
CostPerToken float64 `json:"cost_per_token"`
|
|
SupportsVision bool `json:"supports_vision"`
|
|
SupportsFunctions bool `json:"supports_functions"`
|
|
SupportsToolChoice bool `json:"supports_tool_choice"`
|
|
SupportsFIM bool `json:"supports_fim"`
|
|
MaxOutputTokens int `json:"max_output_tokens"`
|
|
}
|