Platform Plugins
Each platform has its own package with a factory function. You only install the platforms you need.
Platform Status
Section titled “Platform Status”| Platform | Status | Auth | Rate Limiting | Archive Resolution |
|---|---|---|---|---|
| YouTube | ✅ Stable | API Key (query param) | Quota Budget (10k/day) | ✅ Supported |
| Twitch | ✅ Stable | OAuth2 Client Credentials | Token Bucket (800/min) | ✅ Supported |
| TwitCasting | ✅ Stable | Basic Auth (base64) | Token Bucket (60/min) | ✅ Supported |
YouTube
Section titled “YouTube”Official docs: YouTube Data API v3
YouTube’s quota system charges different costs per endpoint (1–101 units) from a daily pool of 10,000. The SDK tracks consumption locally and throws
QuotaExhaustedErrorbefore you hit silent 403s.
pnpm add @unified-live/core @unified-live/youtubeimport { createYouTubePlugin } from "@unified-live/youtube";
const youtube = createYouTubePlugin({ apiKey: process.env.YOUTUBE_API_KEY!, quota: { dailyLimit: 10_000, // optional, default: 10,000 units },});Getting a YouTube API Key
Section titled “Getting a YouTube API Key”- Go to Google Cloud Console
- Create a project (or select an existing one)
- Enable the YouTube Data API v3
- Go to Credentials and create an API key
YouTube uses a cost-based daily quota (default: 10,000 units). Different operations cost different amounts:
| Operation | Cost |
|---|---|
getContent (videos.list) | 1 unit |
getChannel (channels.list) | 1 unit |
listArchives (channels.list + playlistItems.list + videos.list) | 3 units |
listBroadcasts (search.list + videos.list) | 101 units |
The SDK tracks quota consumption locally and throws QuotaExhaustedError when the limit is reached.
Twitch
Section titled “Twitch”Official docs: Twitch Helix API
Twitch requires OAuth2 Client Credentials with token refresh. The SDK handles the full token lifecycle — initial fetch, 90% expiry refresh, and automatic retry on 401.
pnpm add @unified-live/core @unified-live/twitchimport { createTwitchPlugin } from "@unified-live/twitch";
const twitch = createTwitchPlugin({ clientId: process.env.TWITCH_CLIENT_ID!, clientSecret: process.env.TWITCH_CLIENT_SECRET!,});Getting Twitch Credentials
Section titled “Getting Twitch Credentials”- Go to Twitch Developer Console
- Register a new application
- Copy the Client ID and generate a Client Secret
Rate Limits
Section titled “Rate Limits”Twitch uses a token-bucket algorithm with rate limits communicated via Ratelimit-Limit/Ratelimit-Remaining/Ratelimit-Reset response headers. The SDK initializes with a default bucket size and dynamically adjusts based on actual API responses.
Authentication
Section titled “Authentication”The SDK handles OAuth2 Client Credentials Grant automatically. Tokens are refreshed before expiry.
TwitCasting
Section titled “TwitCasting”Official docs: TwitCasting API v2
TwitCasting has a strict 60 req/min rate limit. The SDK enforces this with a token bucket and transparent retries so you never see unexpected 429 errors.
pnpm add @unified-live/core @unified-live/twitcastingimport { createTwitCastingPlugin } from "@unified-live/twitcasting";
const twitcasting = createTwitCastingPlugin({ clientId: process.env.TWITCASTING_CLIENT_ID!, clientSecret: process.env.TWITCASTING_CLIENT_SECRET!,});Getting TwitCasting Credentials
Section titled “Getting TwitCasting Credentials”- Go to TwitCasting Developer
- Register a new application
- Copy the Client ID and Client Secret
Rate Limits
Section titled “Rate Limits”Most TwitCasting endpoints allow 60 requests per 60 seconds. Some endpoints (supporter/supporting lists) have stricter limits of 30 requests per 60 seconds. The SDK manages this automatically.
Authentication
Section titled “Authentication”The SDK uses Basic Authentication (base64(clientId:clientSecret)) for application-level access, handled internally. TwitCasting also supports Bearer Token for user-level operations, but this is not currently implemented.
Registering Plugins
Section titled “Registering Plugins”Option A — Pass plugins at creation (recommended):
import { UnifiedClient } from "@unified-live/core";
const client = UnifiedClient.create({ plugins: [youtube, twitch, twitcasting],});Option B — Register after creation:
import { UnifiedClient } from "@unified-live/core";
const client = UnifiedClient.create();client.register(youtube);client.register(twitch);client.register(twitcasting);Next Steps
Section titled “Next Steps”- Error Handling — Handling API errors
- Pagination — Fetching archive lists
- Creating a Plugin — Build your own platform plugin