Install & accounts
Install, configure accounts and run DanyAPI.
Setup script
One-command install: paste irm https://raw.githubusercontent.com/FANATFANATA/DanyAPI/main/docs/install.ps1 | iex
into PowerShell, or curl -fsSL https://raw.githubusercontent.com/FANATFANATA/DanyAPI/main/docs/install.sh | bash
on Linux/macOS - it clones the repo and runs docs/setup.py. The script installs dependencies,
creates .env from .env.example if missing, asks for the provider credentials and server
settings, live-checks the tokens against the provider, writes everything back to .env and creates a
DanyAPI launcher shortcut on the desktop. The server auto-updates itself from the latest GitHub
release at every launch (DANYAPI_AUTO_UPDATE=0 disables it). Press Enter to keep a
current value, type !clear to erase one.
docs\setup.bat # Windows
docs/setup.sh # Linux/macOS
# or directly:
python docs/setup.py
Requires Python 3.13+. Passwords are masked during input and written to .env which is
gitignored and never committed.
Install
Requires Python 3.13+.
pip install -r requirements.txt
For development (tests + linting) install the dev extras:
pip install -r requirements-dev.txt
Account setup
DeepSeek
Set a pool of tokens (from different accounts), comma-separated, or a single token via DEEPSEEK_TOKEN:
export DEEPSEEK_TOKENS="token1,token2,token3"
# or
export DEEPSEEK_TOKEN="token1"
Each account can generate one message at a time, so a pool of N tokens
gives up to N parallel generations. Grab a token in the browser:
DevTools → Application → Local Storage → https://chat.deepseek.com → userToken.
Or a single email + password account (login happens at startup):
export DEEPSEEK_EMAIL="you@example.com"
export DEEPSEEK_PASSWORD="secret"
Qwen
Same model, different token location (single token via QWEN_TOKEN):
export QWEN_TOKENS="token1,token2,token3"
# or
export QWEN_TOKEN="token1"
Grab a token in the browser:
DevTools → Application → Local Storage → https://chat.qwen.ai → token.
For Qwen accounts used by DanyAPI, disable the built-in Tools switch (code interpreter, image generation, and other Qwen built-ins) in the chat.qwen.ai web interface. When it is enabled, Qwen's built-in tools fire their own response phases on every request, which DanyAPI cannot parse, and the server-side conversation history grows fast (hitting the input token limit quickly). With the switch off, DanyAPI's emulated tool calling (
tools/tool_choice) and plain chat work as intended.
Or a single email + password account (login happens at startup):
export QWEN_EMAIL="you@example.com"
export QWEN_PASSWORD="secret"
Both providers are optional. Run at least one of them (or both) - requests
are routed to the right provider by the model name (deepseek-* / qwen*).
At startup every token is validated against its provider; invalid or expired
tokens are skipped with a warning (the server refuses to start when no valid
credential remains). The Qwen model list for /v1/models is fetched from the
first Qwen account at startup (text-chat models only); if the fetch fails,
a built-in default list is used. New requests without a session_id are
distributed across healthy accounts round-robin.
Run
The .env file (gitignored, created from .env.example) is loaded
automatically at startup:
cp .env.example .env # fill in tokens
python -m danyapi
# or
uvicorn danyapi.api.openai:app --host 0.0.0.0 --port 8000
Or with the helper scripts:
run.bat # Windows
./run.sh # Linux/macOS
Logging
By default logs go to the console. To persist them to a file, set DANYAPI_LOG_FILE in .env (or as an environment variable):
DANYAPI_LOG_FILE=/var/log/danyapi.log # or danyapi.log for the working dir
DANYAPI_LOG_LEVEL=INFO # DEBUG / INFO / WARNING / ERROR
DANYAPI_LOG_MAX_BYTES=10485760 # rotate at 10 MB per file
DANYAPI_LOG_BACKUP_COUNT=3 # keep 3 rotated files
The file is rotated by size (DANYAPI_LOG_MAX_BYTES, default 10 MB) keeping
DANYAPI_LOG_BACKUP_COUNT backups (default 3). When started via
python -m danyapi, uvicorn's own startup/access logs are routed through the
same root logger and also land in the file.