-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathconfig.example.toml
More file actions
194 lines (164 loc) · 5.69 KB
/
config.example.toml
File metadata and controls
194 lines (164 loc) · 5.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# CCProxy Configuration Example
# This file demonstrates how to configure CCProxy and its plugins
# Server settings
[server]
host = "0.0.0.0"
port = 8000
log_level = "INFO"
# log_file = "/var/log/ccproxy/ccproxy.log" # Optional: Log to file
# Security settings
[security]
enable_auth = false # Set to true to require authentication
# auth_token = "your-secret-token" # Required if enable_auth is true
# CORS settings
[cors]
allow_origins = ["*"]
allow_credentials = true
allow_methods = ["*"]
allow_headers = ["*"]
# Claude settings (for Claude SDK integration)
[claude]
cli_path = "auto" # Auto-detect Claude CLI, or specify path
builtin_permissions = true
include_system_messages_in_stream = true
# Scheduler settings
[scheduler]
enabled = true
max_concurrent_tasks = 10
graceful_shutdown_timeout = 30.0
default_retry_attempts = 3
default_retry_delay = 60.0
# Logging settings
[logging]
level = "INFO"
format = "auto"
plugin_log_base_dir = "/tmp/ccproxy"
# Plugin system settings
enable_plugins = true
# Filesystem plugin discovery (override defaults if needed)
[plugin_discovery]
# directories = ["/opt/ccproxy/plugins", "${HOME}/.config/ccproxy/custom"]
# Plugin configurations
# Each plugin can have its own configuration section under [plugins.PLUGIN_NAME].
# Below are examples for common bundled plugins; uncomment and adjust as needed.
# Access log plugin (structured/common/combined)
[plugins.access_log]
enabled = true
client_enabled = true
client_format = "structured"
client_log_file = "/tmp/ccproxy/access.log"
provider_enabled = false
# Request tracer plugin (structured JSON + optional raw HTTP)
[plugins.request_tracer]
enabled = true
verbose_api = true
json_logs_enabled = true
raw_http_enabled = true
log_dir = "/tmp/ccproxy/traces"
# Credential balancer plugin (rotate multiple credential files)
[plugins.credential_balancer]
enabled = false
# Example: OpenAI Codex credential pool with manager-based credentials (recommended)
[[plugins.credential_balancer.providers]]
provider = "codex"
strategy = "round_robin" # or "failover"
max_failures_before_disable = 2
cooldown_seconds = 120.0
failure_status_codes = [401, 403]
# Pool-level defaults applied to all credentials in this pool
manager_class = "ccproxy.plugins.oauth_codex.manager.CodexTokenManager"
storage_class = "ccproxy.plugins.oauth_codex.storage.CodexTokenStorage"
credentials = [
{ type = "manager", file = "~/.config/ccproxy/codex_pro.json", label = "codex_pro" },
{ type = "manager", file = "~/.config/ccproxy/codex_plus.json", label = "codex_plus" },
]
# Example: Claude API credential pool
# [[plugins.credential_balancer.providers]]
# provider = "claude-api"
# strategy = "failover"
# manager_class = "ccproxy.plugins.oauth_claude.manager.ClaudeApiTokenManager"
# storage_class = "ccproxy.plugins.oauth_claude.storage.ClaudeOAuthStorage"
# credentials = [
# { type = "manager", file = "~/.config/ccproxy/claude_primary.json" },
# { type = "manager", file = "~/.config/ccproxy/claude_backup.json" },
# ]
# Example: GitHub Copilot credential pool
# [[plugins.credential_balancer.providers]]
# provider = "copilot"
# manager_class = "ccproxy.plugins.copilot.manager.CopilotTokenManager"
# storage_class = "ccproxy.plugins.copilot.oauth.storage.CopilotOAuthStorage"
# credentials = [
# { type = "manager", file = "~/.config/ccproxy/copilot_account1.json" },
# { type = "manager", file = "~/.config/ccproxy/copilot_account2.json" },
# ]
# Reuse the balancer inside provider plugins
# [plugins.codex]
# auth_manager = "codex_credential_balancer"
# Example: Additional plugin configuration
# [plugins.another_plugin]
# name = "another_plugin"
# base_url = "https://api.example.com"
# api_key = "your-api-key"
# Claude API provider configuration with model mapping overrides
[plugins.claude_api]
enabled = true
# Configure ordered model mapping rules (exact, prefix, suffix, regex)
model_mappings = [
{ match = "gpt-4o", target = "claude-3-7-sonnet-20250219", kind = "prefix" },
{ match = "claude-3-5-sonnet-latest", target = "claude-3-5-sonnet-20241022" },
]
# Plain list of model dictionaries served at /claude/v1/models
[[plugins.claude_api.models_endpoint]]
id = "claude-3-5-sonnet-20241022"
object = "model"
created = 1696000000
owned_by = "anthropic"
root = "claude-3-5-sonnet-20241022"
[[plugins.claude_api.models_endpoint]]
id = "claude-3-5-haiku-20241022"
object = "model"
created = 1696000000
owned_by = "anthropic"
root = "claude-3-5-haiku-20241022"
# Codex provider model mappings and /models override
[plugins.codex]
model_mappings = [
{ match = "gpt-5-nano", target = "gpt-5" },
{ match = "gpt-5-nano-2025-08-07", target = "gpt-5-2025-08-07" },
]
[[plugins.codex.models_endpoint]]
id = "gpt-5"
object = "model"
created = 1704000000
owned_by = "openai"
root = "gpt-5"
permission = []
[[plugins.codex.models_endpoint]]
id = "gpt-5-nano"
object = "model"
created = 1704000000
owned_by = "openai"
root = "gpt-5-nano"
permission = []
# DuckDB storage plugin configuration (replaces observability.duckdb_path/backends)
[plugins.duckdb_storage]
# database_path = "/var/lib/ccproxy/metrics.duckdb" # Optional override
# Analytics (logs API) plugin
[plugins.analytics]
# route_prefix = "/logs"
# Metrics plugin (serves /metrics; optional Pushgateway)
[plugins.metrics]
# pushgateway_enabled = false
# pushgateway_url = "http://localhost:9091"
# pushgateway_job = "ccproxy"
# pushgateway_push_interval = 60
# Docker settings (for running Claude in containers)
[docker]
enabled = false
# docker_image = "ghcr.io/anthropics/claude-code:latest"
# docker_volumes = ["/host/data:/container/data"]
# Pricing settings
[pricing]
update_interval_hours = 24
cache_duration_hours = 24
# pricing_file = "/path/to/custom/pricing.json" # Optional: Custom pricing file