# GLM-ZAI-2API — environment configuration # Copy this file to .env and fill in your values. # The .env file is loaded automatically on startup. # Z.AI JWT token (from chat.z.ai → DevTools → Local Storage → "token") # Without this, the server uses guest mode (only glm-4.7 works). # NOTE: image input (vision) REQUIRES a logged-in token — the Z.AI file # upload endpoint rejects guest sessions with 401. ZAI_TOKEN= # Server settings PORT=5082 HOST=0.0.0.0 # Auth token for the API (clients must send this as Bearer token) AUTH_TOKEN=d3vin # Logging: debug | info | warn | error LOG_LEVEL=info # Path to device tokens database (from token-collector) DB_PATH=tokens.sqlite # ── Z.AI account pool (по примеру прокси: булевый переключатель + файл) ── # USE_ACCOUNT_POOL=true → use ZAI_TOKENS_FILE below as an account pool: # one JWT per line ('#' comments and blank lines OK). Accounts are # validated at startup against /api/v1/auths/; banned (USER_BLOCKED) or # expired ones are skipped automatically, including mid-session rotation # on chat-level 401. If every account dies → guest session fallback. # USE_ACCOUNT_POOL=false → single ZAI_TOKEN above; the pool file is ignored. # CLI flag: -zai-tokens USE_ACCOUNT_POOL=false ZAI_TOKENS_FILE=zai_tokens.txt # ── Proxy pool (Z.AI chat traffic only; captcha/Aliyun stays direct) ── # USE_PROXY=true → PROXY_FILE is used as a proxy pool for CHAT requests only: # one proxy per line, bare host:port or full URL. First attempt is always # direct; after an Aliyun WAF block the retries rotate through the pool. # USE_PROXY=false → all traffic goes direct. USE_PROXY=false PROXY_FILE=proxy.txt # Request timeout in milliseconds (default 300000 = 5 minutes) # TIMEOUT=300000 # Claude Desktop mode: /v1/models returns claude-* aliases and /v1/messages # accepts claude model names (for apps that hardcode claude models) # CLAUDE_DESKTOP=false # Anthropic /v1/messages: minimum gap between Z.AI sends in ms (WAF-friendly) # ANTHROPIC_ZAI_MIN_MS=1500