Repository navigation
Expand file tree
/
Copy path.env.example
More file actions
97 lines (83 loc) · 5.21 KB
/
Copy path.env.example
File metadata and controls
97 lines (83 loc) · 5.21 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
# KeyForge configuration
# Copy this to .env and adjust as needed
# ── Network ──────────────────────────────────────────────────────────────────
# Port the gateway listens on
KEYFORGE_PORT=8787
# Bind address (loopback only by default)
KEYFORGE_BIND_ADDR=127.0.0.1
# ── Key validation ───────────────────────────────────────────────────────────
# Prefix for valid API keys
KEYFORGE_KEY_PREFIX=sk-
# Minimum key length
KEYFORGE_KEY_MIN_LEN=20
# ── Timeouts ─────────────────────────────────────────────────────────────────
# Non-streaming request timeout (seconds)
KEYFORGE_UPSTREAM_TIMEOUT_SECS=300
# Free /v1/models probe timeout (seconds)
KEYFORGE_PROBE_TIMEOUT_SECS=12
# Hard wall-clock ceiling per client request (seconds)
KEYFORGE_REQUEST_DEADLINE_SECS=480
# Max buffered request body (bytes)
KEYFORGE_MAX_BODY_BYTES=33554432
# ── Head budget (streaming) ──────────────────────────────────────────────────
KEYFORGE_HEAD_MULT=3.0
KEYFORGE_HEAD_MIN_SECS=45
KEYFORGE_HEAD_MAX_SECS=170
KEYFORGE_HEAD_DEFAULT_SECS=120
KEYFORGE_HEAD_SECS_PER_MB=35.2
KEYFORGE_HEAD_OVERHEAD_SECS=15.0
KEYFORGE_HEAD_SIZE_SAFETY=1.35
# ── Routing ──────────────────────────────────────────────────────────────────
# A provider is "slow" when its p50 TTFB exceeds the best by this multiple
KEYFORGE_SLOW_MULTIPLIER=2.0
# Samples before latency is trusted for demotion
KEYFORGE_MIN_SAMPLES=3
# Weight on recent error rate in routing score
KEYFORGE_ERROR_WEIGHT=4.0
# Weight on consecutive-failure streak (squared)
KEYFORGE_STREAK_WEIGHT=0.5
# Seconds for failure streak to fully decay
KEYFORGE_STREAK_HALFLIFE_SECS=120
# Consecutive failures before circuit opens
KEYFORGE_BREAKER_TRIP=3
# Circuit-open durations by streak depth (comma-separated)
KEYFORGE_BREAKER_BACKOFF_SECS=15,45,120
# Score penalty for provider not advertising requested model
KEYFORGE_MISSING_MODEL_PENALTY=50.0
# Abandon stickiness if pinned provider is this many times slower
KEYFORGE_STICKY_ESCAPE_MULTIPLIER=4.0
# ── Cooldowns ────────────────────────────────────────────────────────────────
KEYFORGE_COOLDOWN_QUOTA_SECS=21600
KEYFORGE_COOLDOWN_AUTH_SECS=604800
KEYFORGE_COOLDOWN_RATE_SECS=60
KEYFORGE_NO_CHANNEL_COOLDOWN_SECS=45
# ── Sessions ─────────────────────────────────────────────────────────────────
KEYFORGE_SESSION_ACTIVE_SECS=2700
KEYFORGE_USAGE_STALE_SECS=1200
# ── Uptime probing ───────────────────────────────────────────────────────────
KEYFORGE_UPTIME_PROBE_SECS=120
KEYFORGE_UPTIME_RETRY_SECS=20
KEYFORGE_UPTIME_FAIL_THRESHOLD=2
# ── Balance sweep ────────────────────────────────────────────────────────────
KEYFORGE_SWEEP_INTERVAL_SECS=1800
KEYFORGE_SWEEP_BATCH=120
KEYFORGE_SWEEP_CONCURRENCY=4
KEYFORGE_SWEEP_PACING_MS=120
# ── Key sync ─────────────────────────────────────────────────────────────────
KEYFORGE_KEYSYNC_INTERVAL_SECS=14400
# ── State ────────────────────────────────────────────────────────────────────
KEYFORGE_STATE_FLUSH_SECS=20
# ── Proxy pool ───────────────────────────────────────────────────────────────
KEYFORGE_PROXY_MAINT_SECS=900
KEYFORGE_PROXY_VET_BATCH=40
KEYFORGE_PROXY_VET_CONCURRENCY=6
KEYFORGE_PROXY_VET_TIMEOUT_SECS=12
KEYFORGE_PROXY_COOL_SECS=90
KEYFORGE_PROXY_EVICT_AFTER_FAILS=3
KEYFORGE_PROXY_REFILL_BELOW=8
# ── Model sync ───────────────────────────────────────────────────────────────
# Fast model sync interval (seconds, 0 to disable)
KEYFORGE_MODEL_SYNC_SECS=5
# ── OpenCode model limits ────────────────────────────────────────────────────
KEYFORGE_OPENCODE_CONTEXT_LIMIT=1000000
KEYFORGE_OPENCODE_OUTPUT_LIMIT=65535