configstore

package
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2025 License: Apache-2.0 Imports: 15 Imported by: 4

Documentation

Overview

Package configstore provides a persistent configuration store for Bifrost.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

Functions

func ParseDuration

func ParseDuration(duration string) (time.Duration, error)

Utility function to parse duration strings

Types

type ClientConfig

type ClientConfig struct {
	DropExcessRequests      bool     `json:"drop_excess_requests"`      // Drop excess requests if the provider queue is full
	InitialPoolSize         int      `json:"initial_pool_size"`         // The initial pool size for the bifrost client
	PrometheusLabels        []string `json:"prometheus_labels"`         // The labels to be used for prometheus metrics
	EnableLogging           bool     `json:"enable_logging"`            // Enable logging of requests and responses
	EnableGovernance        bool     `json:"enable_governance"`         // Enable governance on all requests
	EnforceGovernanceHeader bool     `json:"enforce_governance_header"` // Enforce governance on all requests
	AllowDirectKeys         bool     `json:"allow_direct_keys"`         // Allow direct keys to be used for requests
	AllowedOrigins          []string `json:"allowed_origins,omitempty"` // Additional allowed origins for CORS and WebSocket (localhost is always allowed)
	MaxRequestBodySizeMB    int      `json:"max_request_body_size_mb"`  // The maximum request body size in MB
}

ClientConfig represents the core configuration for Bifrost HTTP transport and the Bifrost Client. It includes settings for excess request handling, Prometheus metrics, and initial pool size.

type Config

type Config struct {
	Enabled bool            `json:"enabled"`
	Type    ConfigStoreType `json:"type"`
	Config  any             `json:"config"`
}

Config represents the configuration for the config store.

func (*Config) UnmarshalJSON

func (c *Config) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the config from JSON.

type ConfigMap

type ConfigMap map[schemas.ModelProvider]ProviderConfig

ConfigMap maps provider names to their configurations.

type ConfigStore

type ConfigStore interface {

	// Client config CRUD
	UpdateClientConfig(ctx context.Context, config *ClientConfig) error
	GetClientConfig(ctx context.Context) (*ClientConfig, error)

	// Provider config CRUD
	UpdateProvidersConfig(ctx context.Context, providers map[schemas.ModelProvider]ProviderConfig) error
	AddProvider(ctx context.Context, provider schemas.ModelProvider, config ProviderConfig, envKeys map[string][]EnvKeyInfo) error
	UpdateProvider(ctx context.Context, provider schemas.ModelProvider, config ProviderConfig, envKeys map[string][]EnvKeyInfo) error
	DeleteProvider(ctx context.Context, provider schemas.ModelProvider) error
	GetProvidersConfig(ctx context.Context) (map[schemas.ModelProvider]ProviderConfig, error)

	// MCP config CRUD
	UpdateMCPConfig(ctx context.Context, config *schemas.MCPConfig, envKeys map[string][]EnvKeyInfo) error
	GetMCPConfig(ctx context.Context) (*schemas.MCPConfig, error)

	// Vector store config CRUD
	UpdateVectorStoreConfig(ctx context.Context, config *vectorstore.Config) error
	GetVectorStoreConfig(ctx context.Context) (*vectorstore.Config, error)

	// Logs store config CRUD
	UpdateLogsStoreConfig(ctx context.Context, config *logstore.Config) error
	GetLogsStoreConfig(ctx context.Context) (*logstore.Config, error)

	// ENV keys CRUD
	UpdateEnvKeys(ctx context.Context, keys map[string][]EnvKeyInfo) error
	GetEnvKeys(ctx context.Context) (map[string][]EnvKeyInfo, error)

	// Config CRUD
	GetConfig(ctx context.Context, key string) (*TableConfig, error)
	UpdateConfig(ctx context.Context, config *TableConfig, tx ...*gorm.DB) error

	// Plugins CRUD
	GetPlugins(ctx context.Context) ([]TablePlugin, error)
	GetPlugin(ctx context.Context, name string) (*TablePlugin, error)
	CreatePlugin(ctx context.Context, plugin *TablePlugin, tx ...*gorm.DB) error
	UpdatePlugin(ctx context.Context, plugin *TablePlugin, tx ...*gorm.DB) error
	DeletePlugin(ctx context.Context, name string, tx ...*gorm.DB) error

	// Governance config CRUD
	GetVirtualKeys(ctx context.Context) ([]TableVirtualKey, error)
	GetVirtualKey(ctx context.Context, id string) (*TableVirtualKey, error)
	GetVirtualKeyByValue(ctx context.Context, value string) (*TableVirtualKey, error)
	CreateVirtualKey(ctx context.Context, virtualKey *TableVirtualKey, tx ...*gorm.DB) error
	UpdateVirtualKey(ctx context.Context, virtualKey *TableVirtualKey, tx ...*gorm.DB) error
	DeleteVirtualKey(ctx context.Context, id string) error

	// Virtual key provider config CRUD
	GetVirtualKeyProviderConfigs(ctx context.Context, virtualKeyID string) ([]TableVirtualKeyProviderConfig, error)
	CreateVirtualKeyProviderConfig(ctx context.Context, virtualKeyProviderConfig *TableVirtualKeyProviderConfig, tx ...*gorm.DB) error
	UpdateVirtualKeyProviderConfig(ctx context.Context, virtualKeyProviderConfig *TableVirtualKeyProviderConfig, tx ...*gorm.DB) error
	DeleteVirtualKeyProviderConfig(ctx context.Context, id uint, tx ...*gorm.DB) error

	// Team CRUD
	GetTeams(ctx context.Context, customerID string) ([]TableTeam, error)
	GetTeam(ctx context.Context, id string) (*TableTeam, error)
	CreateTeam(ctx context.Context, team *TableTeam, tx ...*gorm.DB) error
	UpdateTeam(ctx context.Context, team *TableTeam, tx ...*gorm.DB) error
	DeleteTeam(ctx context.Context, id string) error

	// Customer CRUD
	GetCustomers(ctx context.Context) ([]TableCustomer, error)
	GetCustomer(ctx context.Context, id string) (*TableCustomer, error)
	CreateCustomer(ctx context.Context, customer *TableCustomer, tx ...*gorm.DB) error
	UpdateCustomer(ctx context.Context, customer *TableCustomer, tx ...*gorm.DB) error
	DeleteCustomer(ctx context.Context, id string) error

	// Rate limit CRUD
	GetRateLimit(ctx context.Context, id string) (*TableRateLimit, error)
	CreateRateLimit(ctx context.Context, rateLimit *TableRateLimit, tx ...*gorm.DB) error
	UpdateRateLimit(ctx context.Context, rateLimit *TableRateLimit, tx ...*gorm.DB) error
	UpdateRateLimits(ctx context.Context, rateLimits []*TableRateLimit, tx ...*gorm.DB) error

	// Budget CRUD
	GetBudgets(ctx context.Context) ([]TableBudget, error)
	GetBudget(ctx context.Context, id string, tx ...*gorm.DB) (*TableBudget, error)
	CreateBudget(ctx context.Context, budget *TableBudget, tx ...*gorm.DB) error
	UpdateBudget(ctx context.Context, budget *TableBudget, tx ...*gorm.DB) error
	UpdateBudgets(ctx context.Context, budgets []*TableBudget, tx ...*gorm.DB) error

	GetGovernanceConfig(ctx context.Context) (*GovernanceConfig, error)

	// Model pricing CRUD
	GetModelPrices(ctx context.Context) ([]TableModelPricing, error)
	CreateModelPrices(ctx context.Context, pricing *TableModelPricing, tx ...*gorm.DB) error
	DeleteModelPrices(ctx context.Context, tx ...*gorm.DB) error

	// Key management
	GetKeysByIDs(ctx context.Context, ids []string) ([]TableKey, error)

	// Generic transaction manager
	ExecuteTransaction(ctx context.Context, fn func(tx *gorm.DB) error) error

	// Cleanup
	Close(ctx context.Context) error
}

ConfigStore is the interface for the config store.

func NewConfigStore

func NewConfigStore(ctx context.Context, config *Config, logger schemas.Logger) (ConfigStore, error)

NewConfigStore creates a new config store based on the configuration

type ConfigStoreType

type ConfigStoreType string

ConfigStoreType represents the type of config store.

const (
	ConfigStoreTypeSQLite   ConfigStoreType = "sqlite"
	ConfigStoreTypePostgres ConfigStoreType = "postgres"
)

ConfigStoreTypeSQLite is the type of config store for SQLite.

type EnvKeyInfo

type EnvKeyInfo struct {
	EnvVar     string                // The environment variable name (without env. prefix)
	Provider   schemas.ModelProvider // The provider this key belongs to (empty for core/mcp configs)
	KeyType    EnvKeyType            // Type of key (e.g., "api_key", "azure_config", "vertex_config", "bedrock_config", "connection_string")
	ConfigPath string                // Path in config where this env var is used
	KeyID      string                // The key ID this env var belongs to (empty for non-key configs like bedrock_config, connection_string)
}

EnvKeyInfo stores information about a key sourced from environment

type EnvKeyType

type EnvKeyType string
const (
	EnvKeyTypeAPIKey        EnvKeyType = "api_key"
	EnvKeyTypeAzureConfig   EnvKeyType = "azure_config"
	EnvKeyTypeVertexConfig  EnvKeyType = "vertex_config"
	EnvKeyTypeBedrockConfig EnvKeyType = "bedrock_config"
	EnvKeyTypeConnection    EnvKeyType = "connection_string"
)

type GovernanceConfig

type GovernanceConfig struct {
	VirtualKeys []TableVirtualKey `json:"virtual_keys"`
	Teams       []TableTeam       `json:"teams"`
	Customers   []TableCustomer   `json:"customers"`
	Budgets     []TableBudget     `json:"budgets"`
	RateLimits  []TableRateLimit  `json:"rate_limits"`
}

type PostgresConfig added in v1.1.0

type PostgresConfig struct {
	Host     string `json:"host"`
	Port     string `json:"port"`
	User     string `json:"user"`
	Password string `json:"password"`
	DBName   string `json:"db_name"`
	SSLMode  string `json:"ssl_mode"`
}

PostgresConfig represents the configuration for a Postgres database.

type ProviderConfig

type ProviderConfig struct {
	Keys                     []schemas.Key                     `json:"keys"`                                  // API keys for the provider with UUIDs
	NetworkConfig            *schemas.NetworkConfig            `json:"network_config,omitempty"`              // Network-related settings
	ConcurrencyAndBufferSize *schemas.ConcurrencyAndBufferSize `json:"concurrency_and_buffer_size,omitempty"` // Concurrency settings
	ProxyConfig              *schemas.ProxyConfig              `json:"proxy_config,omitempty"`                // Proxy configuration
	SendBackRawResponse      bool                              `json:"send_back_raw_response"`                // Include raw response in BifrostResponse
	CustomProviderConfig     *schemas.CustomProviderConfig     `json:"custom_provider_config,omitempty"`      // Custom provider configuration
}

ProviderConfig represents the configuration for a specific AI model provider. It includes API keys, network settings, and concurrency settings.

type RDBConfigStore added in v1.1.0

type RDBConfigStore struct {
	// contains filtered or unexported fields
}

RDBConfigStore represents a configuration store that uses a relational database.

func (*RDBConfigStore) AddProvider added in v1.1.0

func (s *RDBConfigStore) AddProvider(ctx context.Context, provider schemas.ModelProvider, config ProviderConfig, envKeys map[string][]EnvKeyInfo) error

AddProvider creates a new provider configuration in the database.

func (*RDBConfigStore) Close added in v1.1.0

func (s *RDBConfigStore) Close(ctx context.Context) error

Close closes the SQLite config store.

func (*RDBConfigStore) CreateBudget added in v1.1.0

func (s *RDBConfigStore) CreateBudget(ctx context.Context, budget *TableBudget, tx ...*gorm.DB) error

CreateBudget creates a new budget in the database.

func (*RDBConfigStore) CreateCustomer added in v1.1.0

func (s *RDBConfigStore) CreateCustomer(ctx context.Context, customer *TableCustomer, tx ...*gorm.DB) error

CreateCustomer creates a new customer in the database.

func (*RDBConfigStore) CreateModelPrices added in v1.1.0

func (s *RDBConfigStore) CreateModelPrices(ctx context.Context, pricing *TableModelPricing, tx ...*gorm.DB) error

CreateModelPrices creates a new model pricing record in the database.

func (*RDBConfigStore) CreatePlugin added in v1.1.0

func (s *RDBConfigStore) CreatePlugin(ctx context.Context, plugin *TablePlugin, tx ...*gorm.DB) error

func (*RDBConfigStore) CreateRateLimit added in v1.1.0

func (s *RDBConfigStore) CreateRateLimit(ctx context.Context, rateLimit *TableRateLimit, tx ...*gorm.DB) error

CreateRateLimit creates a new rate limit in the database.

func (*RDBConfigStore) CreateTeam added in v1.1.0

func (s *RDBConfigStore) CreateTeam(ctx context.Context, team *TableTeam, tx ...*gorm.DB) error

CreateTeam creates a new team in the database.

func (*RDBConfigStore) CreateVirtualKey added in v1.1.0

func (s *RDBConfigStore) CreateVirtualKey(ctx context.Context, virtualKey *TableVirtualKey, tx ...*gorm.DB) error

func (*RDBConfigStore) CreateVirtualKeyProviderConfig added in v1.1.0

func (s *RDBConfigStore) CreateVirtualKeyProviderConfig(ctx context.Context, virtualKeyProviderConfig *TableVirtualKeyProviderConfig, tx ...*gorm.DB) error

CreateVirtualKeyProviderConfig creates a new virtual key provider config in the database.

func (*RDBConfigStore) DeleteCustomer added in v1.1.0

func (s *RDBConfigStore) DeleteCustomer(ctx context.Context, id string) error

DeleteCustomer deletes a customer from the database.

func (*RDBConfigStore) DeleteModelPrices added in v1.1.0

func (s *RDBConfigStore) DeleteModelPrices(ctx context.Context, tx ...*gorm.DB) error

DeleteModelPrices deletes all model pricing records from the database.

func (*RDBConfigStore) DeletePlugin added in v1.1.0

func (s *RDBConfigStore) DeletePlugin(ctx context.Context, name string, tx ...*gorm.DB) error

func (*RDBConfigStore) DeleteProvider added in v1.1.0

func (s *RDBConfigStore) DeleteProvider(ctx context.Context, provider schemas.ModelProvider) error

DeleteProvider deletes a single provider and all its associated keys from the database.

func (*RDBConfigStore) DeleteTeam added in v1.1.0

func (s *RDBConfigStore) DeleteTeam(ctx context.Context, id string) error

DeleteTeam deletes a team from the database.

func (*RDBConfigStore) DeleteVirtualKey added in v1.1.0

func (s *RDBConfigStore) DeleteVirtualKey(ctx context.Context, id string) error

DeleteVirtualKey deletes a virtual key from the database.

func (*RDBConfigStore) DeleteVirtualKeyProviderConfig added in v1.1.0

func (s *RDBConfigStore) DeleteVirtualKeyProviderConfig(ctx context.Context, id uint, tx ...*gorm.DB) error

DeleteVirtualKeyProviderConfig deletes a virtual key provider config from the database.

func (*RDBConfigStore) ExecuteTransaction added in v1.1.0

func (s *RDBConfigStore) ExecuteTransaction(ctx context.Context, fn func(tx *gorm.DB) error) error

ExecuteTransaction executes a transaction.

func (*RDBConfigStore) GetBudget added in v1.1.0

func (s *RDBConfigStore) GetBudget(ctx context.Context, id string, tx ...*gorm.DB) (*TableBudget, error)

GetBudget retrieves a specific budget from the database.

func (*RDBConfigStore) GetBudgets added in v1.1.0

func (s *RDBConfigStore) GetBudgets(ctx context.Context) ([]TableBudget, error)

GetBudgets retrieves all budgets from the database.

func (*RDBConfigStore) GetClientConfig added in v1.1.0

func (s *RDBConfigStore) GetClientConfig(ctx context.Context) (*ClientConfig, error)

GetClientConfig retrieves the client configuration from the database.

func (*RDBConfigStore) GetConfig added in v1.1.0

func (s *RDBConfigStore) GetConfig(ctx context.Context, key string) (*TableConfig, error)

GetConfig retrieves a specific config from the database.

func (*RDBConfigStore) GetCustomer added in v1.1.0

func (s *RDBConfigStore) GetCustomer(ctx context.Context, id string) (*TableCustomer, error)

GetCustomer retrieves a specific customer from the database.

func (*RDBConfigStore) GetCustomers added in v1.1.0

func (s *RDBConfigStore) GetCustomers(ctx context.Context) ([]TableCustomer, error)

GetCustomers retrieves all customers from the database.

func (*RDBConfigStore) GetEnvKeys added in v1.1.0

func (s *RDBConfigStore) GetEnvKeys(ctx context.Context) (map[string][]EnvKeyInfo, error)

GetEnvKeys retrieves the environment keys from the database.

func (*RDBConfigStore) GetGovernanceConfig added in v1.1.0

func (s *RDBConfigStore) GetGovernanceConfig(ctx context.Context) (*GovernanceConfig, error)

GetGovernanceConfig retrieves the governance configuration from the database.

func (*RDBConfigStore) GetKeysByIDs added in v1.1.0

func (s *RDBConfigStore) GetKeysByIDs(ctx context.Context, ids []string) ([]TableKey, error)

GetKeysByIDs retrieves multiple keys by their IDs

func (*RDBConfigStore) GetLogsStoreConfig added in v1.1.0

func (s *RDBConfigStore) GetLogsStoreConfig(ctx context.Context) (*logstore.Config, error)

GetLogsStoreConfig retrieves the logs store configuration from the database.

func (*RDBConfigStore) GetMCPConfig added in v1.1.0

func (s *RDBConfigStore) GetMCPConfig(ctx context.Context) (*schemas.MCPConfig, error)

GetMCPConfig retrieves the MCP configuration from the database.

func (*RDBConfigStore) GetModelPrices added in v1.1.0

func (s *RDBConfigStore) GetModelPrices(ctx context.Context) ([]TableModelPricing, error)

GetModelPrices retrieves all model pricing records from the database.

func (*RDBConfigStore) GetPlugin added in v1.1.0

func (s *RDBConfigStore) GetPlugin(ctx context.Context, name string) (*TablePlugin, error)

func (*RDBConfigStore) GetPlugins added in v1.1.0

func (s *RDBConfigStore) GetPlugins(ctx context.Context) ([]TablePlugin, error)

func (*RDBConfigStore) GetProvidersConfig added in v1.1.0

func (s *RDBConfigStore) GetProvidersConfig(ctx context.Context) (map[schemas.ModelProvider]ProviderConfig, error)

GetProvidersConfig retrieves the provider configuration from the database.

func (*RDBConfigStore) GetRateLimit added in v1.1.0

func (s *RDBConfigStore) GetRateLimit(ctx context.Context, id string) (*TableRateLimit, error)

GetRateLimit retrieves a specific rate limit from the database.

func (*RDBConfigStore) GetTeam added in v1.1.0

func (s *RDBConfigStore) GetTeam(ctx context.Context, id string) (*TableTeam, error)

GetTeam retrieves a specific team from the database.

func (*RDBConfigStore) GetTeams added in v1.1.0

func (s *RDBConfigStore) GetTeams(ctx context.Context, customerID string) ([]TableTeam, error)

GetTeams retrieves all teams from the database.

func (*RDBConfigStore) GetVectorStoreConfig added in v1.1.0

func (s *RDBConfigStore) GetVectorStoreConfig(ctx context.Context) (*vectorstore.Config, error)

GetVectorStoreConfig retrieves the vector store configuration from the database.

func (*RDBConfigStore) GetVirtualKey added in v1.1.0

func (s *RDBConfigStore) GetVirtualKey(ctx context.Context, id string) (*TableVirtualKey, error)

GetVirtualKey retrieves a virtual key from the database.

func (*RDBConfigStore) GetVirtualKeyByValue added in v1.1.0

func (s *RDBConfigStore) GetVirtualKeyByValue(ctx context.Context, value string) (*TableVirtualKey, error)

GetVirtualKeyByValue retrieves a virtual key by its value

func (*RDBConfigStore) GetVirtualKeyProviderConfigs added in v1.1.0

func (s *RDBConfigStore) GetVirtualKeyProviderConfigs(ctx context.Context, virtualKeyID string) ([]TableVirtualKeyProviderConfig, error)

GetVirtualKeyProviderConfigs retrieves all virtual key provider configs from the database.

func (*RDBConfigStore) GetVirtualKeys added in v1.1.0

func (s *RDBConfigStore) GetVirtualKeys(ctx context.Context) ([]TableVirtualKey, error)

GetVirtualKeys retrieves all virtual keys from the database.

func (*RDBConfigStore) UpdateBudget added in v1.1.0

func (s *RDBConfigStore) UpdateBudget(ctx context.Context, budget *TableBudget, tx ...*gorm.DB) error

UpdateBudget updates a budget in the database.

func (*RDBConfigStore) UpdateBudgets added in v1.1.0

func (s *RDBConfigStore) UpdateBudgets(ctx context.Context, budgets []*TableBudget, tx ...*gorm.DB) error

UpdateBudgets updates multiple budgets in the database.

func (*RDBConfigStore) UpdateClientConfig added in v1.1.0

func (s *RDBConfigStore) UpdateClientConfig(ctx context.Context, config *ClientConfig) error

UpdateClientConfig updates the client configuration in the database.

func (*RDBConfigStore) UpdateConfig added in v1.1.0

func (s *RDBConfigStore) UpdateConfig(ctx context.Context, config *TableConfig, tx ...*gorm.DB) error

UpdateConfig updates a specific config in the database.

func (*RDBConfigStore) UpdateCustomer added in v1.1.0

func (s *RDBConfigStore) UpdateCustomer(ctx context.Context, customer *TableCustomer, tx ...*gorm.DB) error

UpdateCustomer updates an existing customer in the database.

func (*RDBConfigStore) UpdateEnvKeys added in v1.1.0

func (s *RDBConfigStore) UpdateEnvKeys(ctx context.Context, keys map[string][]EnvKeyInfo) error

UpdateEnvKeys updates the environment keys in the database.

func (*RDBConfigStore) UpdateLogsStoreConfig added in v1.1.0

func (s *RDBConfigStore) UpdateLogsStoreConfig(ctx context.Context, config *logstore.Config) error

UpdateLogsStoreConfig updates the logs store configuration in the database.

func (*RDBConfigStore) UpdateMCPConfig added in v1.1.0

func (s *RDBConfigStore) UpdateMCPConfig(ctx context.Context, config *schemas.MCPConfig, envKeys map[string][]EnvKeyInfo) error

UpdateMCPConfig updates the MCP configuration in the database.

func (*RDBConfigStore) UpdatePlugin added in v1.1.0

func (s *RDBConfigStore) UpdatePlugin(ctx context.Context, plugin *TablePlugin, tx ...*gorm.DB) error

func (*RDBConfigStore) UpdateProvider added in v1.1.0

func (s *RDBConfigStore) UpdateProvider(ctx context.Context, provider schemas.ModelProvider, config ProviderConfig, envKeys map[string][]EnvKeyInfo) error

UpdateProviderById updates a single provider configuration in the database without deleting/recreating.

func (*RDBConfigStore) UpdateProvidersConfig added in v1.1.0

func (s *RDBConfigStore) UpdateProvidersConfig(ctx context.Context, providers map[schemas.ModelProvider]ProviderConfig) error

UpdateProvidersConfig updates the client configuration in the database.

func (*RDBConfigStore) UpdateRateLimit added in v1.1.0

func (s *RDBConfigStore) UpdateRateLimit(ctx context.Context, rateLimit *TableRateLimit, tx ...*gorm.DB) error

UpdateRateLimit updates a rate limit in the database.

func (*RDBConfigStore) UpdateRateLimits added in v1.1.0

func (s *RDBConfigStore) UpdateRateLimits(ctx context.Context, rateLimits []*TableRateLimit, tx ...*gorm.DB) error

UpdateRateLimits updates multiple rate limits in the database.

func (*RDBConfigStore) UpdateTeam added in v1.1.0

func (s *RDBConfigStore) UpdateTeam(ctx context.Context, team *TableTeam, tx ...*gorm.DB) error

UpdateTeam updates an existing team in the database.

func (*RDBConfigStore) UpdateVectorStoreConfig added in v1.1.0

func (s *RDBConfigStore) UpdateVectorStoreConfig(ctx context.Context, config *vectorstore.Config) error

UpdateVectorStoreConfig updates the vector store configuration in the database.

func (*RDBConfigStore) UpdateVirtualKey added in v1.1.0

func (s *RDBConfigStore) UpdateVirtualKey(ctx context.Context, virtualKey *TableVirtualKey, tx ...*gorm.DB) error

func (*RDBConfigStore) UpdateVirtualKeyProviderConfig added in v1.1.0

func (s *RDBConfigStore) UpdateVirtualKeyProviderConfig(ctx context.Context, virtualKeyProviderConfig *TableVirtualKeyProviderConfig, tx ...*gorm.DB) error

UpdateVirtualKeyProviderConfig updates a virtual key provider config in the database.

type SQLiteConfig

type SQLiteConfig struct {
	Path string `json:"path"`
}

SQLiteConfig represents the configuration for a SQLite database.

type TableBudget

type TableBudget struct {
	ID            string    `gorm:"primaryKey;type:varchar(255)" json:"id"`
	MaxLimit      float64   `gorm:"not null" json:"max_limit"`                       // Maximum budget in dollars
	ResetDuration string    `gorm:"type:varchar(50);not null" json:"reset_duration"` // e.g., "30s", "5m", "1h", "1d", "1w", "1M", "1Y"
	LastReset     time.Time `gorm:"index" json:"last_reset"`                         // Last time budget was reset
	CurrentUsage  float64   `gorm:"default:0" json:"current_usage"`                  // Current usage in dollars

	CreatedAt time.Time `gorm:"index;not null" json:"created_at"`
	UpdatedAt time.Time `gorm:"index;not null" json:"updated_at"`
}

TableBudget defines spending limits with configurable reset periods

func (*TableBudget) BeforeSave

func (b *TableBudget) BeforeSave(tx *gorm.DB) error

BeforeSave hook for Budget to validate reset duration format and max limit

func (TableBudget) TableName

func (TableBudget) TableName() string

Table names

type TableClientConfig

type TableClientConfig struct {
	ID                      uint      `gorm:"primaryKey;autoIncrement" json:"id"`
	DropExcessRequests      bool      `gorm:"default:false" json:"drop_excess_requests"`
	PrometheusLabelsJSON    string    `gorm:"type:text" json:"-"` // JSON serialized []string
	AllowedOriginsJSON      string    `gorm:"type:text" json:"-"` // JSON serialized []string
	InitialPoolSize         int       `gorm:"default:300" json:"initial_pool_size"`
	EnableLogging           bool      `gorm:"" json:"enable_logging"`
	EnableGovernance        bool      `gorm:"" json:"enable_governance"`
	EnforceGovernanceHeader bool      `gorm:"" json:"enforce_governance_header"`
	AllowDirectKeys         bool      `gorm:"" json:"allow_direct_keys"`
	MaxRequestBodySizeMB    int       `gorm:"default:100" json:"max_request_body_size_mb"`
	CreatedAt               time.Time `gorm:"index;not null" json:"created_at"`
	UpdatedAt               time.Time `gorm:"index;not null" json:"updated_at"`

	// Virtual fields for runtime use (not stored in DB)
	PrometheusLabels []string `gorm:"-" json:"prometheus_labels"`
	AllowedOrigins   []string `gorm:"-" json:"allowed_origins,omitempty"`
}

TableClientConfig represents global client configuration in the database

func (*TableClientConfig) AfterFind

func (cc *TableClientConfig) AfterFind(tx *gorm.DB) error

func (*TableClientConfig) BeforeSave

func (cc *TableClientConfig) BeforeSave(tx *gorm.DB) error

func (TableClientConfig) TableName

func (TableClientConfig) TableName() string

type TableConfig

type TableConfig struct {
	Key   string `gorm:"primaryKey;type:varchar(255)" json:"key"`
	Value string `gorm:"type:text" json:"value"`
}

TableConfig represents generic configuration key-value pairs

func (TableConfig) TableName

func (TableConfig) TableName() string

type TableConfigHash

type TableConfigHash struct {
	ID        uint      `gorm:"primaryKey;autoIncrement" json:"id"`
	Hash      string    `gorm:"type:varchar(255);uniqueIndex;not null" json:"hash"`
	CreatedAt time.Time `gorm:"index;not null" json:"created_at"`
	UpdatedAt time.Time `gorm:"index;not null" json:"updated_at"`
}

func (TableConfigHash) TableName

func (TableConfigHash) TableName() string

TableName sets the table name for each model

type TableCustomer

type TableCustomer struct {
	ID       string  `gorm:"primaryKey;type:varchar(255)" json:"id"`
	Name     string  `gorm:"type:varchar(255);not null" json:"name"`
	BudgetID *string `gorm:"type:varchar(255);index" json:"budget_id,omitempty"`

	// Relationships
	Budget      *TableBudget      `gorm:"foreignKey:BudgetID" json:"budget,omitempty"`
	Teams       []TableTeam       `gorm:"foreignKey:CustomerID" json:"teams"`
	VirtualKeys []TableVirtualKey `gorm:"foreignKey:CustomerID" json:"virtual_keys"`

	CreatedAt time.Time `gorm:"index;not null" json:"created_at"`
	UpdatedAt time.Time `gorm:"index;not null" json:"updated_at"`
}

TableCustomer represents a customer entity with budget

func (TableCustomer) TableName

func (TableCustomer) TableName() string

type TableEnvKey

type TableEnvKey struct {
	ID         uint      `gorm:"primaryKey;autoIncrement" json:"id"`
	EnvVar     string    `gorm:"type:varchar(255);index;not null" json:"env_var"`
	Provider   string    `gorm:"type:varchar(50);index" json:"provider"`        // Empty for MCP/client configs
	KeyType    string    `gorm:"type:varchar(50);not null" json:"key_type"`     // "api_key", "azure_config", "vertex_config", "bedrock_config", "connection_string"
	ConfigPath string    `gorm:"type:varchar(500);not null" json:"config_path"` // Descriptive path of where this env var is used
	KeyID      string    `gorm:"type:varchar(255);index" json:"key_id"`         // Key UUID (empty for non-key configs)
	CreatedAt  time.Time `gorm:"index;not null" json:"created_at"`
}

TableEnvKey represents environment variable tracking in the database

func (TableEnvKey) TableName

func (TableEnvKey) TableName() string

type TableKey

type TableKey struct {
	ID         uint      `gorm:"primaryKey;autoIncrement" json:"id"`
	ProviderID uint      `gorm:"index;not null" json:"provider_id"`
	Provider   string    `gorm:"index;type:varchar(50)" json:"provider"`                          // ModelProvider as string
	KeyID      string    `gorm:"type:varchar(255);uniqueIndex:idx_key_id;not null" json:"key_id"` // UUID from schemas.Key
	Value      string    `gorm:"type:text;not null" json:"value"`
	ModelsJSON string    `gorm:"type:text" json:"-"` // JSON serialized []string
	Weight     float64   `gorm:"default:1.0" json:"weight"`
	CreatedAt  time.Time `gorm:"index;not null" json:"created_at"`
	UpdatedAt  time.Time `gorm:"index;not null" json:"updated_at"`

	// OpenAI config fields (embedded)
	OpenAIUseResponsesAPI *bool `gorm:"type:boolean" json:"openai_use_responses_api,omitempty"`

	// Azure config fields (embedded instead of separate table for simplicity)
	AzureEndpoint        *string `gorm:"type:text" json:"azure_endpoint,omitempty"`
	AzureAPIVersion      *string `gorm:"type:varchar(50)" json:"azure_api_version,omitempty"`
	AzureDeploymentsJSON *string `gorm:"type:text" json:"-"` // JSON serialized map[string]string

	// Vertex config fields (embedded)
	VertexProjectID       *string `gorm:"type:varchar(255)" json:"vertex_project_id,omitempty"`
	VertexRegion          *string `gorm:"type:varchar(100)" json:"vertex_region,omitempty"`
	VertexAuthCredentials *string `gorm:"type:text" json:"vertex_auth_credentials,omitempty"`

	// Bedrock config fields (embedded)
	BedrockAccessKey       *string `gorm:"type:varchar(255)" json:"bedrock_access_key,omitempty"`
	BedrockSecretKey       *string `gorm:"type:text" json:"bedrock_secret_key,omitempty"`
	BedrockSessionToken    *string `gorm:"type:text" json:"bedrock_session_token,omitempty"`
	BedrockRegion          *string `gorm:"type:varchar(100)" json:"bedrock_region,omitempty"`
	BedrockARN             *string `gorm:"type:text" json:"bedrock_arn,omitempty"`
	BedrockDeploymentsJSON *string `gorm:"type:text" json:"-"` // JSON serialized map[string]string

	// Virtual fields for runtime use (not stored in DB)
	Models           []string                  `gorm:"-" json:"models"`
	OpenAIKeyConfig  *schemas.OpenAIKeyConfig  `gorm:"-" json:"openai_key_config,omitempty"`
	AzureKeyConfig   *schemas.AzureKeyConfig   `gorm:"-" json:"azure_key_config,omitempty"`
	VertexKeyConfig  *schemas.VertexKeyConfig  `gorm:"-" json:"vertex_key_config,omitempty"`
	BedrockKeyConfig *schemas.BedrockKeyConfig `gorm:"-" json:"bedrock_key_config,omitempty"`
}

TableKey represents an API key configuration in the database

func (*TableKey) AfterFind

func (k *TableKey) AfterFind(tx *gorm.DB) error

func (*TableKey) BeforeSave

func (k *TableKey) BeforeSave(tx *gorm.DB) error

func (TableKey) TableName

func (TableKey) TableName() string

type TableLogStoreConfig

type TableLogStoreConfig struct {
	ID        uint      `gorm:"primaryKey;autoIncrement" json:"id"`
	Enabled   bool      `json:"enabled"`
	Type      string    `gorm:"type:varchar(50);not null" json:"type"` // "sqlite"
	Config    *string   `gorm:"type:text" json:"config"`               // JSON serialized logstore.Config
	CreatedAt time.Time `gorm:"index;not null" json:"created_at"`
	UpdatedAt time.Time `gorm:"index;not null" json:"updated_at"`
}

TableLogStoreConfig represents the configuration for the log store in the database

func (TableLogStoreConfig) TableName

func (TableLogStoreConfig) TableName() string

type TableMCPClient

type TableMCPClient struct {
	ID                 uint      `gorm:"primaryKey;autoIncrement" json:"id"`
	Name               string    `gorm:"type:varchar(255);uniqueIndex;not null" json:"name"`
	ConnectionType     string    `gorm:"type:varchar(20);not null" json:"connection_type"` // schemas.MCPConnectionType
	ConnectionString   *string   `gorm:"type:text" json:"connection_string,omitempty"`
	StdioConfigJSON    *string   `gorm:"type:text" json:"-"` // JSON serialized schemas.MCPStdioConfig
	ToolsToExecuteJSON string    `gorm:"type:text" json:"-"` // JSON serialized []string
	ToolsToSkipJSON    string    `gorm:"type:text" json:"-"` // JSON serialized []string
	CreatedAt          time.Time `gorm:"index;not null" json:"created_at"`
	UpdatedAt          time.Time `gorm:"index;not null" json:"updated_at"`

	// Virtual fields for runtime use (not stored in DB)
	StdioConfig    *schemas.MCPStdioConfig `gorm:"-" json:"stdio_config,omitempty"`
	ToolsToExecute []string                `gorm:"-" json:"tools_to_execute"`
	ToolsToSkip    []string                `gorm:"-" json:"tools_to_skip"`
}

TableMCPClient represents an MCP client configuration in the database

func (*TableMCPClient) AfterFind

func (c *TableMCPClient) AfterFind(tx *gorm.DB) error

func (*TableMCPClient) BeforeSave

func (c *TableMCPClient) BeforeSave(tx *gorm.DB) error

func (TableMCPClient) TableName

func (TableMCPClient) TableName() string

type TableModel

type TableModel struct {
	ID         string    `gorm:"primaryKey" json:"id"`
	ProviderID uint      `gorm:"index;not null;uniqueIndex:idx_provider_name" json:"provider_id"`
	Name       string    `gorm:"uniqueIndex:idx_provider_name" json:"name"`
	CreatedAt  time.Time `json:"created_at"`
	UpdatedAt  time.Time `json:"updated_at"`
}

TableModel represents a model configuration in the database

func (TableModel) TableName

func (TableModel) TableName() string

type TableModelPricing

type TableModelPricing struct {
	ID                 uint    `gorm:"primaryKey;autoIncrement" json:"id"`
	Model              string  `gorm:"type:varchar(255);not null;uniqueIndex:idx_model_provider_mode" json:"model"`
	Provider           string  `gorm:"type:varchar(50);not null;uniqueIndex:idx_model_provider_mode" json:"provider"`
	InputCostPerToken  float64 `gorm:"not null" json:"input_cost_per_token"`
	OutputCostPerToken float64 `gorm:"not null" json:"output_cost_per_token"`
	Mode               string  `gorm:"type:varchar(50);not null;uniqueIndex:idx_model_provider_mode" json:"mode"`

	// Additional pricing for media
	InputCostPerImage          *float64 `gorm:"default:null" json:"input_cost_per_image,omitempty"`
	InputCostPerVideoPerSecond *float64 `gorm:"default:null" json:"input_cost_per_video_per_second,omitempty"`
	InputCostPerAudioPerSecond *float64 `gorm:"default:null" json:"input_cost_per_audio_per_second,omitempty"`

	// Character-based pricing
	InputCostPerCharacter  *float64 `gorm:"default:null" json:"input_cost_per_character,omitempty"`
	OutputCostPerCharacter *float64 `gorm:"default:null" json:"output_cost_per_character,omitempty"`

	// Pricing above 128k tokens
	InputCostPerTokenAbove128kTokens          *float64 `gorm:"default:null" json:"input_cost_per_token_above_128k_tokens,omitempty"`
	InputCostPerCharacterAbove128kTokens      *float64 `gorm:"default:null" json:"input_cost_per_character_above_128k_tokens,omitempty"`
	InputCostPerImageAbove128kTokens          *float64 `gorm:"default:null" json:"input_cost_per_image_above_128k_tokens,omitempty"`
	InputCostPerVideoPerSecondAbove128kTokens *float64 `gorm:"default:null" json:"input_cost_per_video_per_second_above_128k_tokens,omitempty"`
	InputCostPerAudioPerSecondAbove128kTokens *float64 `gorm:"default:null" json:"input_cost_per_audio_per_second_above_128k_tokens,omitempty"`
	OutputCostPerTokenAbove128kTokens         *float64 `gorm:"default:null" json:"output_cost_per_token_above_128k_tokens,omitempty"`
	OutputCostPerCharacterAbove128kTokens     *float64 `gorm:"default:null" json:"output_cost_per_character_above_128k_tokens,omitempty"`

	// Cache and batch pricing
	CacheReadInputTokenCost   *float64 `gorm:"default:null" json:"cache_read_input_token_cost,omitempty"`
	InputCostPerTokenBatches  *float64 `gorm:"default:null" json:"input_cost_per_token_batches,omitempty"`
	OutputCostPerTokenBatches *float64 `gorm:"default:null" json:"output_cost_per_token_batches,omitempty"`
}

TableModelPricing represents pricing information for AI models

func (TableModelPricing) TableName

func (TableModelPricing) TableName() string

type TablePlugin added in v1.0.3

type TablePlugin struct {
	ID         uint      `gorm:"primaryKey;autoIncrement" json:"id"`
	Name       string    `gorm:"type:varchar(255);uniqueIndex;not null" json:"name"`
	Enabled    bool      `json:"enabled"`
	ConfigJSON string    `gorm:"type:text" json:"-"` // JSON serialized plugin.Config
	CreatedAt  time.Time `gorm:"index;not null" json:"created_at"`
	UpdatedAt  time.Time `gorm:"index;not null" json:"updated_at"`

	// Virtual fields for runtime use (not stored in DB)
	Config any `gorm:"-" json:"config,omitempty"`
}

func (*TablePlugin) AfterFind added in v1.0.3

func (p *TablePlugin) AfterFind(tx *gorm.DB) error

func (*TablePlugin) BeforeSave added in v1.0.3

func (p *TablePlugin) BeforeSave(tx *gorm.DB) error

func (TablePlugin) TableName added in v1.0.3

func (TablePlugin) TableName() string

type TableProvider

type TableProvider struct {
	ID                       uint      `gorm:"primaryKey;autoIncrement" json:"id"`
	Name                     string    `gorm:"type:varchar(50);uniqueIndex;not null" json:"name"` // ModelProvider as string
	NetworkConfigJSON        string    `gorm:"type:text" json:"-"`                                // JSON serialized schemas.NetworkConfig
	ConcurrencyBufferJSON    string    `gorm:"type:text" json:"-"`                                // JSON serialized schemas.ConcurrencyAndBufferSize
	ProxyConfigJSON          string    `gorm:"type:text" json:"-"`                                // JSON serialized schemas.ProxyConfig
	CustomProviderConfigJSON string    `gorm:"type:text" json:"-"`                                // JSON serialized schemas.CustomProviderConfig
	SendBackRawResponse      bool      `json:"send_back_raw_response"`
	CreatedAt                time.Time `gorm:"index;not null" json:"created_at"`
	UpdatedAt                time.Time `gorm:"index;not null" json:"updated_at"`

	// Relationships
	Keys []TableKey `gorm:"foreignKey:ProviderID;constraint:OnDelete:CASCADE" json:"keys"`

	// Virtual fields for runtime use (not stored in DB)
	NetworkConfig            *schemas.NetworkConfig            `gorm:"-" json:"network_config,omitempty"`
	ConcurrencyAndBufferSize *schemas.ConcurrencyAndBufferSize `gorm:"-" json:"concurrency_and_buffer_size,omitempty"`
	ProxyConfig              *schemas.ProxyConfig              `gorm:"-" json:"proxy_config,omitempty"`

	// Custom provider fields
	CustomProviderConfig *schemas.CustomProviderConfig `gorm:"-" json:"custom_provider_config,omitempty"`

	// Foreign keys
	Models []TableModel `gorm:"foreignKey:ProviderID;constraint:OnDelete:CASCADE" json:"models"`
}

TableProvider represents a provider configuration in the database

func (*TableProvider) AfterFind

func (p *TableProvider) AfterFind(tx *gorm.DB) error

AfterFind hooks for deserialization

func (*TableProvider) BeforeSave

func (p *TableProvider) BeforeSave(tx *gorm.DB) error

BeforeSave hooks for serialization

func (TableProvider) TableName

func (TableProvider) TableName() string

type TableRateLimit

type TableRateLimit struct {
	ID string `gorm:"primaryKey;type:varchar(255)" json:"id"`

	// Token limits with flexible duration
	TokenMaxLimit      *int64    `gorm:"default:null" json:"token_max_limit,omitempty"`          // Maximum tokens allowed
	TokenResetDuration *string   `gorm:"type:varchar(50)" json:"token_reset_duration,omitempty"` // e.g., "30s", "5m", "1h", "1d", "1w", "1M", "1Y"
	TokenCurrentUsage  int64     `gorm:"default:0" json:"token_current_usage"`                   // Current token usage
	TokenLastReset     time.Time `gorm:"index" json:"token_last_reset"`                          // Last time token counter was reset

	// Request limits with flexible duration
	RequestMaxLimit      *int64    `gorm:"default:null" json:"request_max_limit,omitempty"`          // Maximum requests allowed
	RequestResetDuration *string   `gorm:"type:varchar(50)" json:"request_reset_duration,omitempty"` // e.g., "30s", "5m", "1h", "1d", "1w", "1M", "1Y"
	RequestCurrentUsage  int64     `gorm:"default:0" json:"request_current_usage"`                   // Current request usage
	RequestLastReset     time.Time `gorm:"index" json:"request_last_reset"`                          // Last time request counter was reset

	CreatedAt time.Time `gorm:"index;not null" json:"created_at"`
	UpdatedAt time.Time `gorm:"index;not null" json:"updated_at"`
}

TableRateLimit defines rate limiting rules for virtual keys using flexible max+reset approach

func (*TableRateLimit) BeforeSave

func (rl *TableRateLimit) BeforeSave(tx *gorm.DB) error

BeforeSave hook for RateLimit to validate reset duration formats

func (TableRateLimit) TableName

func (TableRateLimit) TableName() string

type TableTeam

type TableTeam struct {
	ID         string  `gorm:"primaryKey;type:varchar(255)" json:"id"`
	Name       string  `gorm:"type:varchar(255);not null" json:"name"`
	CustomerID *string `gorm:"type:varchar(255);index" json:"customer_id,omitempty"` // A team can belong to a customer
	BudgetID   *string `gorm:"type:varchar(255);index" json:"budget_id,omitempty"`

	// Relationships
	Customer    *TableCustomer    `gorm:"foreignKey:CustomerID" json:"customer,omitempty"`
	Budget      *TableBudget      `gorm:"foreignKey:BudgetID" json:"budget,omitempty"`
	VirtualKeys []TableVirtualKey `gorm:"foreignKey:TeamID" json:"virtual_keys"`

	CreatedAt time.Time `gorm:"index;not null" json:"created_at"`
	UpdatedAt time.Time `gorm:"index;not null" json:"updated_at"`
}

TableTeam represents a team entity with budget and customer association

func (TableTeam) TableName

func (TableTeam) TableName() string

type TableVectorStoreConfig

type TableVectorStoreConfig struct {
	ID              uint      `gorm:"primaryKey;autoIncrement" json:"id"`
	Enabled         bool      `json:"enabled"`                               // Enable vector store
	Type            string    `gorm:"type:varchar(50);not null" json:"type"` // "weaviate, elasticsearch, pinecone, etc."
	TTLSeconds      int       `gorm:"default:300" json:"ttl_seconds"`        // TTL in seconds (default: 5 minutes)
	CacheByModel    bool      `gorm:"" json:"cache_by_model"`                // Include model in cache key
	CacheByProvider bool      `gorm:"" json:"cache_by_provider"`             // Include provider in cache key
	Config          *string   `gorm:"type:text" json:"config"`               // JSON serialized schemas.RedisVectorStoreConfig
	CreatedAt       time.Time `gorm:"index;not null" json:"created_at"`
	UpdatedAt       time.Time `gorm:"index;not null" json:"updated_at"`
}

TableVectorStoreConfig represents Cache plugin configuration in the database

func (TableVectorStoreConfig) TableName

func (TableVectorStoreConfig) TableName() string

type TableVirtualKey

type TableVirtualKey struct {
	ID              string                          `gorm:"primaryKey;type:varchar(255)" json:"id"`
	Name            string                          `gorm:"uniqueIndex:idx_virtual_key_name;type:varchar(255);not null" json:"name"`
	Description     string                          `gorm:"type:text" json:"description,omitempty"`
	Value           string                          `gorm:"uniqueIndex:idx_virtual_key_value;type:varchar(255);not null" json:"value"` // The virtual key value
	IsActive        bool                            `gorm:"default:true" json:"is_active"`
	ProviderConfigs []TableVirtualKeyProviderConfig `gorm:"foreignKey:VirtualKeyID;constraint:OnDelete:CASCADE" json:"provider_configs"` // Empty means all providers allowed

	// Foreign key relationships (mutually exclusive: either TeamID or CustomerID, not both)
	TeamID      *string    `gorm:"type:varchar(255);index" json:"team_id,omitempty"`
	CustomerID  *string    `gorm:"type:varchar(255);index" json:"customer_id,omitempty"`
	BudgetID    *string    `gorm:"type:varchar(255);index" json:"budget_id,omitempty"`
	RateLimitID *string    `gorm:"type:varchar(255);index" json:"rate_limit_id,omitempty"`
	Keys        []TableKey `gorm:"many2many:governance_virtual_key_keys;constraint:OnDelete:CASCADE" json:"keys"`

	// Relationships
	Team      *TableTeam      `gorm:"foreignKey:TeamID" json:"team,omitempty"`
	Customer  *TableCustomer  `gorm:"foreignKey:CustomerID" json:"customer,omitempty"`
	Budget    *TableBudget    `gorm:"foreignKey:BudgetID" json:"budget,omitempty"`
	RateLimit *TableRateLimit `gorm:"foreignKey:RateLimitID" json:"rate_limit,omitempty"`

	CreatedAt time.Time `gorm:"index;not null" json:"created_at"`
	UpdatedAt time.Time `gorm:"index;not null" json:"updated_at"`
}

TableVirtualKey represents a virtual key with budget, rate limits, and team/customer association

func (*TableVirtualKey) AfterAutoMigrate

func (vk *TableVirtualKey) AfterAutoMigrate(tx *gorm.DB) error

Database constraints and indexes

func (*TableVirtualKey) AfterFind added in v1.0.13

func (vk *TableVirtualKey) AfterFind(tx *gorm.DB) error

func (*TableVirtualKey) BeforeSave

func (vk *TableVirtualKey) BeforeSave(tx *gorm.DB) error

BeforeSave hook for VirtualKey to enforce mutual exclusion

func (TableVirtualKey) TableName

func (TableVirtualKey) TableName() string

type TableVirtualKeyProviderConfig added in v1.1.0

type TableVirtualKeyProviderConfig struct {
	ID            uint     `gorm:"primaryKey;autoIncrement" json:"id"`
	VirtualKeyID  string   `gorm:"type:varchar(255);not null" json:"virtual_key_id"`
	Provider      string   `gorm:"type:varchar(50);not null" json:"provider"`
	Weight        float64  `gorm:"default:1.0" json:"weight"`
	AllowedModels []string `gorm:"type:text;serializer:json" json:"allowed_models"` // Empty means all models allowed
}

TableVirtualKeyProviderConfig represents a provider configuration for a virtual key

func (TableVirtualKeyProviderConfig) TableName added in v1.1.0

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL