Files
opencode2api/config.example.json
T
Jason Xu 4438acb8e7 feat(egress): route free-model traffic through userspace WARP
Free-tier requests now optionally leave through a Cloudflare WARP tunnel that runs inside the gateway process: WireGuard over UDP plus a gVisor netstack, so no TUN device, root, NET_ADMIN, or route changes are needed. Adapted from github.com/sudogeeker/ai-route (MIT).

- warp.enabled/pool_size/stack in config, the WebUI, config.example.json and all READMEs; startup and hot reload fail closed when WARP cannot initialize.
- Anonymous lane, free-model Zen-key fallback, free-model probes and the anonymous catalog refresh send no proxy traffic while enabled; Go keys and paid models keep their proxies.
- Per-attempt leases feed 403/429 rotation and broken-tunnel failures back into the pool; /healthz and /api/monitor expose the pool state and readiness requires an active exit.
- errWARPUnavailable maps to a 503 warp_unavailable response.
2026-10-25 05:51:00 +08:00

69 lines
1.5 KiB
JSON

{
"listen": "127.0.0.1:8080",
"server_keys": ["change-this-local-key"],
"zen_keys": [],
"go_keys": [],
"anonymous": true,
"warp": {
"enabled": false,
"pool_size": 2,
"stack": "ipv4"
},
"proxies": ["direct"],
"proxyfile": "",
"upstream": {
"zen": "https://opencode.ai/zen",
"go": "https://opencode.ai/zen/go",
"anonymous": "https://opencode.ai/inference"
},
"retry": {
"max_attempts": 3,
"timeout_seconds": 300
},
"models": {
"refresh_seconds": 300,
"protocols": {},
"free_only": false
},
"performance": {
"max_idle_conns": 2048,
"max_idle_conns_per_host": 256,
"max_conns_per_host": 0,
"idle_conn_timeout_seconds": 120,
"connect_timeout_seconds": 5,
"failure_cooldown_seconds": 15,
"attempt_timeout_seconds": 0,
"first_event_timeout_seconds": 0,
"max_anonymous_exits": 8,
"free_tier_block_seconds": 900
},
"logging": {
"level": "info",
"ring_size": 2000,
"dump_request_bodies": false
},
"webui": {
"enabled": true,
"listen": "0.0.0.0:8081",
"username": "admin",
"password": "change-this-admin-password",
"session_ttl_minutes": 720
},
"prefer": "go",
"reasoning": {
"effort": "high",
"effort_by_model": {}
},
"rotation": {
"sota": {
"alias": "sota",
"order": ["deepseek-v4.1-flash", "glm-5.3", "grok-4.6", "kimi-k3", "qwen3.8-max"]
},
"sweet": {
"alias": "sweet",
"order": []
},
"first_output_seconds": 30
}
}