𝗬𝗨𝗞𝗜 𝗬𝗧 𝗔𝗣𝗜 is an enterprise-grade, high-performance media extraction microservice engineered for music bots, Telegram bots, and web applications. Powered by FastAPI and the latest yt-dlp engine with YouTube JavaScript Challenge bypassing, it delivers ultra-low latency audio/video streaming with intelligent local disk vault caching.
Eliminate reliance on slow external third-party extractors. Host your own media engine directly on your VPS with zero latency and complete privacy.
⚡ Sub-Second Response Times • 💾 Smart Disk Vault Caching • 🛡️ Challenge Bypass Ready
flowchart LR
Bot["Music Bot / Telegram / Client"] -->|1. GET /download?url=...| APIGateway["Yuki API Router (FastAPI)"]
APIGateway -->|Issue Token| TokenVault["In-Memory Token Authority"]
Bot -->|2. GET /stream/:id?token=...| StreamEngine["Streaming Engine"]
StreamEngine --> CacheCheck{"Cache Hit?"}
CacheCheck -->|Yes| FastServe["Serve Cached Binary (0ms)"]
CacheCheck -->|No| YtDlp["yt-dlp + Node.js JS Solver"]
YtDlp --> Convert["FFmpeg Audio / Video Pipeline"]
Convert --> AsyncServe["Stream Binary to Client"]
AsyncServe --> Background["Async Background Task: Save to Cache"]
|
|
|
|
| Method | Endpoint | Description | Auth |
|---|---|---|---|
GET |
/ |
Root service descriptor and available routes | Public |
GET |
/health |
Uptime probe and system health status | Public |
GET |
/web |
Interactive Cyberpunk Web Studio Console | Public |
GET |
/stats |
Telemetry: total downloads, cache size, active tokens | Public |
GET |
/download |
Generate single-use signed download token | Query url |
GET |
/stream/{video_id} |
Stream media binary directly with background caching | Token |
GET |
/docs |
Interactive Swagger OpenAPI documentation | Public |
curl -X GET "http://localhost:8000/download?url=https://www.youtube.com/watch?v=dQw4w9WgXcQ&type=audio"Response:
{
"status": "success",
"video_id": "dQw4w9WgXcQ",
"download_token": "YUKIMusic3f9a7c2e8b1d40a1SudeepBots",
"stream_url": "/stream/dQw4w9WgXcQ?type=audio&token=YUKIMusic3f9a7c2e8b1d40a1SudeepBots",
"usage": "Use token parameter or X-Download-Token header in /stream endpoint"
}curl -L "http://localhost:8000/stream/dQw4w9WgXcQ?token=YUKIMusic3f9a7c2e8b1d40a1SudeepBots&type=audio" -o track.m4aOr pass the token via Header:
curl -L "http://localhost:8000/stream/dQw4w9WgXcQ?type=audio" \
-H "X-Download-Token: YUKIMusic3f9a7c2e8b1d40a1SudeepBots" -o track.m4aTo integrate Yuki YT API with your music bot (such as AniyaMusic, SimmyMusic, or PulseMusic), update your YouTube extractor fallback in your bot's youtube.py:
FALLBACK_API_URL = "http://127.0.0.1:8000"
async def get_stream_from_api(video_id: str, is_audio: bool = True):
media_type = "audio" if is_audio else "video"
async with aiohttp.ClientSession() as session:
# 1. Fetch token
async with session.get(f"{FALLBACK_API_URL}/download?url={video_id}&type={media_type}") as resp:
data = await resp.json()
token = data["download_token"]
# 2. Return direct stream URL
return f"{FALLBACK_API_URL}/stream/{video_id}?type={media_type}&token={token}"# Clone the repository
git clone https://github.com/SUDEEPBOTS/YUKIYTAPI.git
cd YUKIYTAPI
# Optional: Add your cookies.txt
cp sample_cookies.txt cookies.txt
# Run container
docker compose up -d --build# 1️⃣ Install system packages
sudo apt update && sudo apt install -y python3 python3-pip python3-venv ffmpeg nodejs npm
# 2️⃣ Clone repository
git clone https://github.com/SUDEEPBOTS/YUKIYTAPI.git
cd YUKIYTAPI
# 3️⃣ Create virtual environment
python3 -m venv venv
source venv/bin/activate
# 4️⃣ Install dependencies
pip install -r requirements.txt
# 5️⃣ Start the API
bash startFor high-volume production deployments or age-gated music tracks:
- Export Netscape formatted cookies from your browser using Cookie-Editor.
- Save the file as
cookies.txtin the root folder. - The API will automatically detect and load
cookies.txtwithout needing a restart.
Distributed under the MIT License. See LICENSE for more information.


