diff --git a/air.toml b/air.toml new file mode 100644 index 0000000000..31a4aa2c78 --- /dev/null +++ b/air.toml @@ -0,0 +1,48 @@ +root = "." +testdata_dir = "testdata" +tmp_dir = ".air" + +[build] + args_bin = [] + bin = "./cliproxyapi++" + cmd = "go build -o ./cliproxyapi++ ./cmd/server" + delay = 1000 + exclude_dir = ["assets", "tmp", "vendor", "testdata", "node_modules", ".git", "docs/node_modules", ".air"] + exclude_file = [] + exclude_regex = ["_test.go", "_test_ts.go"] + exclude_unchanged = false + follow_symlink = false + full_bin = "" + include_dir = ["pkg/llmproxy", "cmd/server", "internal", "sdk"] + include_ext = ["go"] + include_file = [] + kill_delay = "0s" + log = "build-errors.log" + poll = false + poll_interval = 0 + rerun = false + rerun_delay = 500 + send_interrupt = false + stop_on_error = false + +[color] + app = "" + build = "yellow" + main = "magenta" + runner = "green" + watcher = "cyan" + +[log] + main_only = false + time = false + +[misc] + clean_on_exit = true + +[screen] + clear_on_rebuild = false + keep_scroll = true + +[watcher] + watch_exts = ["go", "yaml", "yml", "json", "toml"] + ignore_paths = [".git", "node_modules", "vendor", "tmp", ".air"] diff --git a/pkg/llmproxy/config/sdk_config.go b/pkg/llmproxy/config/sdk_config.go deleted file mode 100644 index 63e25a079b..0000000000 --- a/pkg/llmproxy/config/sdk_config.go +++ /dev/null @@ -1,13 +0,0 @@ -// Package config provides configuration management for the CLI Proxy API server. -// It handles loading and parsing YAML configuration files, and provides structured -// access to application settings including server port, authentication directory, -// debug settings, proxy configuration, and API keys. -package config - -import internalconfig "github.com/router-for-me/CLIProxyAPI/v6/internal/config" - -// SDKConfig is an alias to internal/config.SDKConfig. -type SDKConfig = internalconfig.SDKConfig - -// StreamingConfig is an alias to internal/config.StreamingConfig. -type StreamingConfig = internalconfig.StreamingConfig diff --git a/pkg/llmproxy/config/sdk_types.go b/pkg/llmproxy/config/sdk_types.go new file mode 100644 index 0000000000..bf4fb90ecf --- /dev/null +++ b/pkg/llmproxy/config/sdk_types.go @@ -0,0 +1,43 @@ +// Package config provides configuration types for CLI Proxy API. +// This file contains SDK-specific config types that are used by internal/* packages. +package config + +// SDKConfig represents the SDK-level configuration embedded in Config. +type SDKConfig struct { + // ProxyURL is the URL of an optional proxy server to use for outbound requests. + ProxyURL string `yaml:"proxy-url" json:"proxy-url"` + + // ForceModelPrefix requires explicit model prefixes (e.g., "teamA/gemini-3-pro-preview") + // to target prefixed credentials. When false, unprefixed model requests may use prefixed + // credentials as well. + ForceModelPrefix bool `yaml:"force-model-prefix" json:"force-model-prefix"` + + // RequestLog enables or disables detailed request logging functionality. + RequestLog bool `yaml:"request-log" json:"request-log"` + + // APIKeys is a list of keys for authenticating clients to this proxy server. + APIKeys []string `yaml:"api-keys" json:"api-keys"` + + // PassthroughHeaders controls whether upstream response headers are forwarded to downstream clients. + // Default is false (disabled). + PassthroughHeaders bool `yaml:"passthrough-headers" json:"passthrough-headers"` + + // Streaming configures server-side streaming behavior (keep-alives and safe bootstrap retries). + Streaming StreamingConfig `yaml:"streaming" json:"streaming"` + + // NonStreamKeepAliveInterval controls how often blank lines are emitted for non-streaming responses. + // <= 0 disables keep-alives. Value is in seconds. + NonStreamKeepAliveInterval int `yaml:"nonstream-keepalive-interval,omitempty" json:"nonstream-keepalive-interval,omitempty"` +} + +// StreamingConfig holds server streaming behavior configuration. +type StreamingConfig struct { + // KeepAliveSeconds controls how often the server emits SSE heartbeats (": keep-alive\n\n"). + // <= 0 disables keep-alives. Default is 0. + KeepAliveSeconds int `yaml:"keepalive-seconds,omitempty" json:"keepalive-seconds,omitempty"` + + // BootstrapRetries controls how many times the server may retry a streaming request before any bytes are sent, + // to allow auth rotation / transient recovery. + // <= 0 disables bootstrap retries. Default is 0. + BootstrapRetries int `yaml:"bootstrap-retries,omitempty" json:"bootstrap-retries,omitempty"` +}