Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions air.toml
Original file line number Diff line number Diff line change
@@ -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"]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The paths listed in ignore_paths are already included in exclude_dir on line 10. According to the air tool's documentation, exclude_dir is sufficient for excluding directories from being watched, which makes this ignore_paths entry redundant. You can safely remove this line to simplify the configuration.

13 changes: 0 additions & 13 deletions pkg/llmproxy/config/sdk_config.go

This file was deleted.

43 changes: 43 additions & 0 deletions pkg/llmproxy/config/sdk_types.go
Original file line number Diff line number Diff line change
@@ -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"`
}
Comment on lines +6 to +31
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

While moving these struct definitions here from the internal package is the right direction to fix the import cycle, the original definitions in internal/config/sdk_config.go have not been removed. This has introduced code duplication, as SDKConfig and StreamingConfig are now defined in both pkg/llmproxy/config/sdk_types.go and internal/config/sdk_config.go.

To complete this refactoring correctly and avoid future maintenance issues, the definitions in internal/config/sdk_config.go should be replaced with type aliases that point to these new definitions in the pkg layer. This will create a single source of truth.

Here is a suggested implementation for internal/config/sdk_config.go:

// in internal/config/sdk_config.go
package config

import (
	pkgconfig "github.com/router-for-me/CLIProxyAPI/v6/pkg/llmproxy/config"
)

// SDKConfig is an alias to pkg/llmproxy/config.SDKConfig.
type SDKConfig = pkgconfig.SDKConfig

// StreamingConfig is an alias to pkg/llmproxy/config.StreamingConfig.
type StreamingConfig = pkgconfig.StreamingConfig


// 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"`
}
Loading