Repository navigation
Expand file tree
/
Copy path.env.docker.example
More file actions
167 lines (141 loc) · 6.05 KB
/
Copy path.env.docker.example
File metadata and controls
167 lines (141 loc) · 6.05 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
# Docker Environment Variables for Claude Code Proxy
# Copy this file to .env and update with your actual values
# Command: cp .env.docker.example .env
# =============================================================================
# PROXY CONFIGURATION
# =============================================================================
# Port for the proxy server (default: 4181)
PROXY_PORT=4181
# =============================================================================
# API KEYS (REQUIRED)
# =============================================================================
# Z.AI API configuration - Get your API key from https://z.ai
ZAI_API_KEY=your-zai-api-key-here
# Anthropic API configuration - Get your API key from https://console.anthropic.com
ANTHROPIC_API_KEY=your-anthropic-api-key-here
# Claude subscription (Pro/Max) long-lived OAuth token.
# Generate once on the host with: claude setup-token
# It prints a ~1-year token — paste it here. This takes precedence over the
# mounted credentials file and removes the need for the macOS keychain/launchd
# sync. Regenerate it once a year when it expires.
CLAUDE_CODE_OAUTH_TOKEN=
# =============================================================================
# DATABASE CONFIGURATION
# =============================================================================
# PostgreSQL Database Configuration
DATABASE_URL=postgresql://postgres:postgres@cc-db:5432/claude_proxy
POSTGRES_DB=claude_proxy
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
DB_PORT=5432
DB_HOST=cc-db
# Database Connection Pool Settings
DB_SSL=false
DB_MAX_CONNECTIONS=10
DB_IDLE_TIMEOUT_MS=30000
DB_CONNECTION_TIMEOUT_MS=2000
# Database Health Check Configuration
DB_HEALTHCHECK_INTERVAL=10s
DB_HEALTHCHECK_TIMEOUT=5s
DB_HEALTHCHECK_RETRIES=5
# =============================================================================
# ADMINER CONFIGURATION (Database Management UI)
# =============================================================================
# Port for Adminer web interface
ADMINER_PORT=8080
# Adminer version (default: latest)
ADMINER_VERSION=latest
# Adminer design theme (options: nette, pepa-linha, pappu687, etc.)
ADMINER_DESIGN=nette
# Default database server to connect in Adminer
ADMINER_DEFAULT_SERVER=cc-db
# =============================================================================
# POSTGRESQL CONFIGURATION
# =============================================================================
# PostgreSQL version (default: 15)
POSTGRES_VERSION=15
# =============================================================================
# LOGGING CONFIGURATION
# =============================================================================
# Log level: debug, info, warn, error, silent (default: info)
LOG_LEVEL=info
# =============================================================================
# CIRCUIT BREAKER CONFIGURATION
# =============================================================================
# Automatic provider switching based on health and rate limits
# Enabled by default - set to "false" to disable
CIRCUIT_BREAKER_ENABLED=true
# Time in milliseconds to wait before retrying a failed provider (default: 60000 = 1 minute)
CIRCUIT_BREAKER_COOLDOWN_MS=60000
# Number of consecutive errors before marking provider as degraded (default: 3)
CIRCUIT_BREAKER_DEGRADED_THRESHOLD=3
# Number of consecutive errors before marking provider as unavailable (default: 5)
CIRCUIT_BREAKER_UNAVAILABLE_THRESHOLD=5
# Time in milliseconds between health checks for unhealthy providers (default: 30000 = 30 seconds)
CIRCUIT_BREAKER_HEALTH_CHECK_INTERVAL=30000
# =============================================================================
# QUOTA CONFIGURATION
# =============================================================================
# Weekly token limit for Anthropic before switching to Z.AI (0 = no limit)
# Example: 1,000,000 tokens per week
ANTHROPIC_WEEKLY_LIMIT=0
# Percentage of weekly limit to trigger fallback to Z.AI (default: 80)
# When Anthropic usage reaches this percentage, requests go to Z.AI
QUOTA_WARNING_THRESHOLD=80
# =============================================================================
# ENVIRONMENT CONFIGURATION
# =============================================================================
# Node environment (development, production)
NODE_ENV=production
# Restart policy for Docker containers (no, always, on-failure, unless-stopped)
RESTART_POLICY=unless-stopped
# =============================================================================
# API TIMEOUT CONFIGURATION
# =============================================================================
# Streaming idle timeout in milliseconds (default: 30000 = 30 seconds)
# Increase this if your upstream provider (Z.AI, OpenRouter) takes longer between chunks
API_STREAM_IDLE_TIMEOUT_MS=30000
# =============================================================================
# ADVANCED CONFIGURATION
# =============================================================================
# Docker Compose project name (helps with multiple instances)
COMPOSE_PROJECT_NAME=claude-code-proxy
# Docker network name
COMPOSE_NETWORK_NAME=claude-network
# =============================================================================
# USAGE EXAMPLES
# =============================================================================
# Start all services:
# docker-compose up -d
#
# Start with custom environment file:
# docker-compose --env-file .env.custom up -d
#
# View logs:
# docker-compose logs -f cc-proxy
#
# Stop all services:
# docker-compose down
#
# Stop and remove volumes:
# docker-compose down -v
#
# Rebuild containers:
# docker-compose build --no-cache
#
# Access database via Adminer:
# http://127.0.0.1:8080
# System: PostgreSQL
# Server: cc-db
# Username: postgres
# Password: postgres
# Database: claude_proxy
#
# Access database via psql:
# docker-compose exec cc-db psql -U postgres -d claude_proxy
#
# Backup database:
# docker-compose exec cc-db pg_dump -U postgres claude_proxy > backup.sql
#
# Restore database:
# docker-compose exec -T cc-db psql -U postgres claude_proxy < backup.sql