# Service listen port on the host. PORT=8080 # Docker build network settings. Defaults are China-mainland friendly. # To use official upstreams, replace these three values with: # APK_MIRROR= # GOPROXY=https://proxy.golang.org,direct # GOSUMDB=sum.golang.org APK_MIRROR=https://mirrors.aliyun.com/alpine GOPROXY=https://goproxy.cn,direct GOSUMDB=sum.golang.google.cn # Set this to the Docker network where new-api can reach its database service. # Check with: docker network ls | grep new-api NEWAPI_NETWORK=new-api_new-api-network # PostgreSQL: SQL_DSN=postgresql://root:123456@postgres:5432/new-api?sslmode=disable DB_DRIVER=postgres # MySQL: # SQL_DSN=root:123456@tcp(mysql:3306)/new-api?charset=utf8mb4&parseTime=true # DB_DRIVER=mysql # SQLite: # Mount the sqlite file under ./data and set SQL_DSN=/data/one-api.db # SQL_DSN=/data/one-api.db # DB_DRIVER=sqlite DB_MAX_OPEN_CONNS=10 DB_MAX_IDLE_CONNS=5 QUERY_TIMEOUT_SECONDS=30 # Defaults to false. When false, the UI only shows token id, token name, and key tail. SHOW_FULL_KEYS=false # Required. Used to log in to the dashboard. ADMIN_PASSWORD=change-this-password # Optional OpenResty request-body audit JSONL import. # AUDIT_LOG_DIR is mounted as /audit-logs in the container. # AUDIT_LOG_DIR=/home/asants/newapi/new-api/audit-logs # AUDIT_LOG_GLOB=/audit-logs/*.jsonl AUDIT_INDEX_DSN=/var/lib/newapi-usage/audit.db # Timezone of string timestamps written by OpenResty ngx.localtime(). # Use UTC if the JSONL time is 8 hours behind China time. AUDIT_TIMEZONE=UTC AUDIT_SCAN_INTERVAL_SECONDS=10 AUDIT_LOOKUP_WINDOW_SECONDS=120 AUDIT_MAX_LINES_PER_SCAN=50000 # Optional channel balance cards ("渠道余额"). The whole area is hidden unless # at least one channel below is configured. # DeepSeek: manage named keys in the card. A legacy key is imported once. DEEPSEEK_ENABLED=false # DEEPSEEK_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxx DEEPSEEK_API_BASE=https://api.deepseek.com DEEPSEEK_LABEL=DeepSeek DEEPSEEK_ACCOUNTS_PATH=/var/lib/newapi-usage/deepseek-accounts.json # CPA: an independent channel shown as ONE card listing every auth file's # rate-limit usage. Window names are taken from ChatGPT's # limit_window_seconds response field. CPA itself proxies the ChatGPT request # through whatever proxy it is configured with. # Requires base url + management token. Probing runs in the background on # CPA_REFRESH_INTERVAL_SECONDS and is served from cache. # CPA_BASE_URL=https://cpa.example.com # CPA_TOKEN=cpa-management-token CPA_LABEL=CPA CPA_TARGET_TYPE=codex CPA_PROBE_CONCURRENCY=20 CPA_PROBE_TIMEOUT_SECONDS=15 CPA_REFRESH_INTERVAL_SECONDS=300 # Cap accounts probed per refresh (0 = no cap). CPA_MAX_ACCOUNTS=0 # Sub2API: account list card. OAuth accounts show a live usage refresh button; # API-key accounts only show estimated/account-list usage when available. # SUB2API_BASE_URL=http://10.255.200.17:6780 # SUB2API_API_KEY=admin-xxxxxxxxxxxxxxxx SUB2API_LABEL=Sub2API SUB2API_TIMEZONE=Asia/Shanghai SUB2API_TIMEOUT_SECONDS=15 SUB2API_PAGE_SIZE=50 # Optional Ikun quota enrichment for the matching Sub2API account. The account # is matched by IKUN_SUB2API_ACCOUNT_ID when set, otherwise by account name/key # (default "ikun") or credentials.base_url. # IKUN_API_BASE=https://api.ikuncode.cc # IKUN_ACCESS_TOKEN=your-ikun-access-token # IKUN_USER_ID=20378 # IKUN_SUB2API_ACCOUNT_ID=275 IKUN_SUB2API_ACCOUNT_KEY=ikun IKUN_LABEL=Ikun # OpenCode Go Manager account card. The service logs in with these credentials, # loads estimated USD usage for every account, and offers live refresh for # enabled managed accounts. # OPENCODE_BASE_URL=http://host.docker.internal:9042 OPENCODE_USERNAME=admin # OPENCODE_PASSWORD=change-this-password OPENCODE_LABEL=OpenCode OPENCODE_TIMEOUT_SECONDS=30 OPENCODE_CONCURRENCY=5 # Zhipu GLM Coding Plan quota card. ZHIPU_ENABLED=false ZHIPU_API_BASE=https://open.bigmodel.cn # Optional legacy key. On first startup it is migrated into ZHIPU_ACCOUNTS_PATH. # ZHIPU_API_KEY=your-zhipu-api-key ZHIPU_LABEL=智谱 GLM ZHIPU_ACCOUNTS_PATH=/var/lib/newapi-usage/zhipu-accounts.json ZHIPU_TIMEOUT_SECONDS=15 # XFYun MaaS coding-plan card. ssoSessionId accounts are added/updated from the # web card and persisted in XFYUN_ACCOUNTS_PATH. XFYUN_ENABLED=false XFYUN_API_BASE=https://maas.xfyun.cn XFYUN_LABEL=讯飞 MaaS XFYUN_ACCOUNTS_PATH=/var/lib/newapi-usage/xfyun-accounts.json XFYUN_TIMEOUT_SECONDS=15 XFYUN_PAGE_SIZE=20 TZ=Asia/Shanghai