StableTube API
StableTube resolves a YouTube URL to mp4 via x402. /api/download creates a paid server-side download job. StableTube downloads the video, uploads it to S3, and returns a temporary StableTube-owned URL when it is ready.
Endpoints
GET /api/info?url=...— free metadata (title, duration, channel, thumbnails, available qualities).POST /api/download— paid. Body:url, requiredquality("360p" | "720p" | "1080p"), requiredtier("tube-100mb" | "tube-500mb" | "tube-1gb"), optionalclientRequestId. ReturnsstatusandjobId.GET /api/downloads/:jobId— SIWX. Polls the job or refreshes the temporarydownloadUrl. The wallet must match the wallet that paid for the job.
Pricing
| Tier | Max output | USD |
|---|---|---|
| tube-100mb | 100 MB | $0.05 |
| tube-500mb | 500 MB | $0.10 |
| tube-1gb | 1 GB | $0.20 |
tiered by maximum output size: tube-100mb $0.05 / tube-500mb $0.10 / tube-1gb $0.20.
Quality and tier
The client chooses the exact output quality. If the requested quality is not available before payment, the call aborts with 404 and you are not charged. The client also chooses a byte-size tier; Modal stops the download if the final mp4 exceeds that tier.
Delivery
StableTube never returns upstream YouTube or *.googlevideo.com URLs, and the API does not stream video bytes through Vercel. When a job is complete, download the file directly from the temporary S3 URL before expiresAt. If the URL expires while the object still exists, poll the job again for a fresh URL.
curl -L "$downloadUrl" -o video.mp4Upstream
Metadata checks use YTStream on RapidAPI and server-side downloads use a Modal worker backed by the upstream download provider. Outage or breakage is represented as a failed job.