A self-hosted anime browsing and streaming interface.
Search anime, explore episodes, choose sub or dub servers, and play HLS streams from a clean dark-themed web UI.
Important: KAGE accesses third-party services and displays streams supplied by those services. Make sure your use complies with the laws and terms that apply to you. KAGE does not host or own the streamed content.
KAGE is a small self-hosted application made of two services:
- Frontend — a Flask server that serves the browser UI and proxies HLS and subtitle requests.
- API — a FastAPI service that retrieves anime metadata, episode information, streaming servers, subtitles, and stream URLs.
The API uses Node.js to run the stream decryption helper required by the upstream stream provider. The frontend and API are intentionally separate, so the API can run on another machine if desired.
┌──────────────┐ ┌──────────────────────┐ ┌─────────────────────┐
│ Browser │──────▶│ Frontend · :6767 │──────▶│ API · :8787 │
│ app.html │ │ app.py │ │ KAGE_API/reanime.py │
└──────────────┘ └──────────────────────┘ └──────────┬──────────┘
│
▼
Third-party providers
- Search anime and browse current, popular, and top titles
- View anime details, episode lists, recommendations, and weekly schedules
- Select available subbed and dubbed servers
- Play HLS streams through the built-in browser proxy
- Display subtitles, episode thumbnails, and intro/outro chapter metadata
- Responsive dark-themed interface
- Installable PWA with browser, Android, Apple, and Windows icon assets
- Interactive API documentation through Swagger UI and ReDoc
- Windows
- Python 3.11 or newer
- Node.js 20 or newer
- Internet access
The frontend requires Flask and curl-cffi. The API requires FastAPI,
Uvicorn, curl-cffi, httpx, and PyCryptodome.
Open a Command Prompt or PowerShell window in the project directory and run:
api.batThe API starts at http://localhost:8787.
Open a second Command Prompt or PowerShell window in the same directory and run:
app.batThe frontend starts at http://localhost:6767.
Visit http://localhost:6767 in your browser. Keep both terminal windows open while using the app.
The batch files check for Python and Node.js, then install the service-specific Python dependencies when needed.
Install the dependencies from the project root:
python -m pip install flask curl-cffi fastapi "uvicorn[standard]" "httpx[http2]" pycryptodomeStart the API from a terminal:
Set-Location .\KAGE_API
python reanime.pyIn a second terminal, start the frontend from the project root:
python app.pyThe default service addresses are:
| Service | URL | Entry point |
|---|---|---|
| Frontend | http://localhost:6767 | app.py |
| API | http://localhost:8787 | KAGE_API/reanime.py |
| API docs | http://localhost:8787/docs | FastAPI Swagger UI |
| Alternative docs | http://localhost:8787/redoc | FastAPI ReDoc |
Press Ctrl+C in each terminal to stop a service.
The frontend reads the API address from _KEY.txt:
BASE_API_URL=http://localhost:8787
To use an API running on another machine or port:
- Set
BASE_API_URLto the API’s reachable address. - Restart
app.pyorapp.bat. - Open the frontend using the address of the machine running
app.py.
app.py generates config.js dynamically from _KEY.txt.
For local development, keep the default value:
http://localhost:8787.
Both services bind to 0.0.0.0 by default. If the app is reachable from a
network, protect it with your firewall or place it behind an authenticated
reverse proxy.
The API is available at the configured BASE_API_URL:
| Method | Endpoint | Purpose |
|---|---|---|
GET |
/search?q=...&limit=20 |
Search anime |
GET |
/home?limit=20 |
Latest anime and weekly picks |
GET |
/top?period=week&limit=20 |
Top anime by period |
GET |
/schedule |
Weekly airing schedule |
GET |
/info/{slug} |
Anime metadata and episodes |
GET |
/episodes/{slug} |
Episode list |
GET |
/servers/{slug}/{episode} |
Available sub/dub servers |
GET |
/stream/{access_id}?v=2 |
Resolve a stream |
GET |
/stream/from-link?link={url} |
Resolve a full stream link |
GET |
/thumbnails/{anilist_id} |
Episode thumbnail data |
GET |
/recommendations/{slug} |
Related anime |
1. GET /search?q=demon+slayer
└─ choose an anime slug
2. GET /servers/{slug}/{episode}
└─ choose a sub or dub dataLink
3. GET /stream/from-link?link={dataLink}
└─ receive the HLS URL, subtitles, thumbnails, and chapters
Stream tokens are one-time-use and returned stream URLs are temporary. Avoid
caching /stream responses or reusing an old stream URL.
KAGE/
├── app.html # Browser UI
├── app.py # Flask frontend, config endpoint, and media proxy
├── app.bat # Windows frontend launcher
├── api.bat # Windows API launcher
├── _KEY.txt # Frontend-to-API URL configuration
├── config.js # Default client-side configuration
├── site.webmanifest # PWA metadata
├── KAGE_FLOW.svg # Frontend/API connection diagram
├── favicons/ # Browser, mobile, and Windows icon assets
└── KAGE_API/
├── reanime.py # FastAPI API and upstream integrations
├── decrypt.mjs # Node.js stream decryption helper
└── README.md # API-specific documentation
Confirm that api.bat is running and that _KEY.txt points to the
same host and port. Test the API directly at http://localhost:8787/docs.
Install Python 3.11+ and Node.js 20+, then make sure both commands are on your
PATH:
python --version
node --versionRestart the terminal after changing PATH.
Stream tokens and URLs supplied by upstream services can be short-lived or single-use. Retry from the episode page instead of reusing an old URL. Upstream availability, rate limits, or provider changes can also prevent playback.
Stop the process using port 6767 or 8787, or update the launch configuration
and the corresponding BASE_API_URL value consistently.
app.pyserves the UI and proxies HLS and subtitle requests.KAGE_API/reanime.pyexposes metadata and stream APIs.KAGE_API/decrypt.mjshandles the upstream decryption flow.- Do not commit private API keys, cookies, or other credentials.
- See
KAGE_API/README.mdfor API internals and the decryption flow.
This project is licensed under the MIT License - see the LICENSE file for details.