Documentation
¶
Index ¶
- Constants
- func ConfigDir() string
- func ConfigPath() string
- func DeletePreset(name string) error
- func EnsureConfigDir() error
- func GetAPIKey() string
- func GetBaseURL() string
- func GetWSBaseURL() string
- func Init() error
- func ListPresets() []string
- func MaskKey(key string) string
- func RemoveAPIKey() error
- func Save(cfg *Config) error
- func SavePreset(name string, preset Preset) error
- func SetAPIKey(key string) error
- type Config
- type Defaults
- type Preset
Constants ¶
const ( DefaultBaseURL = "https://api.runware.ai/v1" DefaultWSBaseURL = "wss://ws-api.runware.ai/v1" MaskedKeySuffix = "•••••" DefaultModel = "runware:100@1" DefaultWidth = 1024 DefaultHeight = 1024 DefaultSteps = 28 DefaultCFGScale = 3.5 DefaultScheduler = "euler" DefaultOutputDir = "./outputs" DefaultOutputFmt = "png" DefaultFormat = "table" )
Variables ¶
This section is empty.
Functions ¶
func EnsureConfigDir ¶
func EnsureConfigDir() error
EnsureConfigDir creates the config directory if it doesn't exist.
func GetBaseURL ¶
func GetBaseURL() string
GetBaseURL returns the HTTP API base URL. RUNWARE_BASE_URL overrides the default; this is not exposed in the user-facing config file and is intended for internal testing only.
func GetWSBaseURL ¶ added in v0.7.0
func GetWSBaseURL() string
GetWSBaseURL returns the WebSocket API base URL. RUNWARE_WS_BASE_URL overrides the default; this is not exposed in the user-facing config file and is intended for internal testing only.
func Init ¶
func Init() error
Init sets up Viper to read from ~/.runware/config.yaml and sets defaults.
func MaskKey ¶
MaskKey masks an API key for display, showing the first 16 characters followed by "•••••". If the key is shorter than 16 characters, only "•••••" is shown.
func Save ¶
Save writes the config to disk and reloads Viper so subsequent Get() calls reflect the change.
func SavePreset ¶
SavePreset saves a named preset.
Types ¶
type Config ¶
type Config struct {
APIKey string `mapstructure:"api_key" yaml:"api_key,omitempty"`
Defaults Defaults `mapstructure:"defaults" yaml:"defaults"`
Presets map[string]Preset `mapstructure:"presets" yaml:"presets,omitempty"`
}
Config is the full configuration structure.
type Defaults ¶
type Defaults struct {
Model string `mapstructure:"model" yaml:"model"`
Width int `mapstructure:"width" yaml:"width"`
Height int `mapstructure:"height" yaml:"height"`
Steps int `mapstructure:"steps" yaml:"steps"`
CFGScale float64 `mapstructure:"cfg_scale" yaml:"cfg_scale"`
Scheduler string `mapstructure:"scheduler" yaml:"scheduler"`
OutputDir string `mapstructure:"output_dir" yaml:"output_dir"`
OutputFormat string `mapstructure:"output_format" yaml:"output_format"`
Format string `mapstructure:"format" yaml:"format"`
}
Defaults holds default values for inference commands.
type Preset ¶
type Preset struct {
Model string `yaml:"model,omitempty"`
Width int `yaml:"width,omitempty"`
Height int `yaml:"height,omitempty"`
Steps int `yaml:"steps,omitempty"`
CFGScale float64 `yaml:"cfg_scale,omitempty"`
Scheduler string `yaml:"scheduler,omitempty"`
}
Preset is a named set of inference parameters.