Developer Documentation
Ultra-fast music search, direct 320 kbps stream extraction, and binary chunked audio pipes built specifically for Telegram music bots and audio streaming applications.
Production Host
All queries are routed through encrypted high-speed HTTPS:
Authentication
Pass your API key as a query parameter or request header:
High Throughput
Zero rate limits, unlimited quota enabled by default:
import httpx
from pyrogram import Client, filters
from pytgcalls import PyTgCalls
from pytgcalls.types import AudioPiped
app = Client("my_bot", api_id=12345, api_hash="your_api_hash", bot_token="your_bot_token")
call_py = PyTgCalls(app)
LYRA_STREAM_URL = "https://api.shnwaz.dev/api/v1/stream"
LYRA_KEY = "eaLyra31e0"
@app.on_message(filters.command("play") & filters.group)
async def play_handler(_, message):
query = " ".join(message.command[1:])
if not query:
return await message.reply_text("Please provide a song name or YouTube link.")
status_msg = await message.reply_text("⚡ Fetching audio stream via Lyra API...")
async with httpx.AsyncClient() as client:
res = await client.get(
LYRA_STREAM_URL,
params={"id": query, "api_key": LYRA_KEY},
timeout=10.0
)
data = res.json()
if data.get("status") != "success":
return await status_msg.edit_text("❌ Failed to resolve music stream.")
stream_url = data["stream_url"]
song_title = data["title"]
duration = data["duration"]
# Direct audio stream into Telegram Voice Chat (zero local ffmpeg load)
await call_py.join_group_call(
message.chat.id,
AudioPiped(stream_url)
)
await status_msg.edit_text(
f"▶️ **Now Playing:** {song_title}\n⏱ **Duration:** {duration}\n⚡ **Latency:** {data['latency_ms']}ms"
)API Endpoints Reference
Live HTTP routes with parameter descriptions, interactive testing, and response samples
Search Music & Videos
Instant search across YouTube and YouTube Music. Returns verified video IDs, high-resolution thumbnails, song titles, channel names, and durations.
Query & Body Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| query | string | Yes | Song title, artist name, YouTube URL, or Spotify song name. |
| limit | integer | No | Number of search results to return (default: 10, max: 25). |
Example Response
{
"status": "success",
"query": "faded",
"count": 5,
"results": [
{
"id": "60ItHLz5WEA",
"title": "Alan Walker - Faded",
"duration": "03:32",
"channel": "Alan Walker",
"thumbnail": "https://i.ytimg.com/vi/60ItHLz5WEA/hq720.jpg",
"views": "3.6B views",
"url": "https://www.youtube.com/watch?v=60ItHLz5WEA"
}
]
}Direct Playable Audio Stream
Resolves direct high-speed audio stream URLs (.m4a / .webm / 320 kbps CDN). Plug directly into Py-TgCalls without any local ffmpeg download or CPU transcoding.
Query & Body Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | YouTube 11-char Video ID, full YouTube URL, or song query. |
| quality | string | No | 'best', 'high', or 'low' (default: 'best'). |
| api_key | string | Yes | Your Lyra API key. |
Example Response
{
"status": "success",
"id": "60ItHLz5WEA",
"title": "Alan Walker - Faded",
"channel": "Alan Walker",
"duration": "03:32",
"duration_seconds": 212,
"thumbnail": "https://i.ytimg.com/vi/60ItHLz5WEA/maxresdefault.jpg",
"stream_url": "https://rr3---sn-gwpa-25ued.googlevideo.com/videoplayback?...",
"proxy_stream_url": "https://api.shnwaz.dev/api/v1/stream/raw?id=60ItHLz5WEA&api_key=eaLyra31e0",
"format": "m4a",
"bitrate": 320.0,
"filesize": 3418520,
"latency_ms": 12.4
}Raw Chunked Audio Pipe
Direct chunked binary audio stream over HTTP. Lyra proxies and streams the audio buffer seamlessly without requiring client direct connections to YouTube CDNs.
Query & Body Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | YouTube Video ID or URL. |
| api_key | string | Yes | Your Lyra API key. |
Example Response
HTTP/1.1 200 OK Content-Type: audio/mp4 Transfer-Encoding: chunked [Binary chunked audio stream ready for native media players and Py-TgCalls]
Direct Song File Download
Triggers direct file download attachment with automatic sanitized song filename in the Content-Disposition header.
Query & Body Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | YouTube Video ID or URL. |
| api_key | string | Yes | Your Lyra API key. |
Example Response
HTTP/1.1 200 OK Content-Disposition: attachment; filename="Alan_Walker_Faded.m4a" Content-Type: audio/mp4 [Direct Binary Audio Download]
Create Developer API Key
Provision a new API key with unlimited throughput and 999,999,999 daily request quota.
Query & Body Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| string (body) | Yes | Developer's email address. | |
| name | string (body) | No | Friendly application label (e.g. 'Telegram Music Bot'). |
| plan | string (body) | No | Subscription tier ('unlimited'). |
Example Response
{
"status": "success",
"key": "eaLyra31e0",
"user_email": "developer@shnwaz.dev",
"user_name": "My Telegram Music Bot",
"plan": "unlimited",
"daily_requests_limit": 999999999,
"daily_video_limit": 999999999,
"expires_at": "2027-10-01T00:00:00Z",
"is_active": true
}Inspect Quota & Key Status
Query live consumption metrics, daily stream counts, and key validity in real time.
Query & Body Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| key | string | Yes | Your Lyra API Key. |
Example Response
{
"status": "success",
"key": "eaLyra31e0",
"plan": "unlimited",
"requests_today": 18,
"daily_requests_limit": 999999999,
"video_requests_today": 4,
"daily_video_limit": 999999999,
"expires_at": "2027-10-01T00:00:00Z",
"percent_used": 0.0
}