Skip to content

Platform Plugins

Each platform has its own package with a factory function. You only install the platforms you need.

PlatformStatusAuthRate LimitingArchive Resolution
YouTube✅ StableAPI Key (query param)Quota Budget (10k/day)✅ Supported
Twitch✅ StableOAuth2 Client CredentialsToken Bucket (800/min)✅ Supported
TwitCasting✅ StableBasic Auth (base64)Token Bucket (60/min)✅ Supported

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 QuotaExhaustedError before you hit silent 403s.

Terminal window
pnpm add @unified-live/core @unified-live/youtube
import { createYouTubePlugin } from "@unified-live/youtube";
const youtube = createYouTubePlugin({
apiKey: process.env.YOUTUBE_API_KEY!,
quota: {
dailyLimit: 10_000, // optional, default: 10,000 units
},
});
  1. Go to Google Cloud Console
  2. Create a project (or select an existing one)
  3. Enable the YouTube Data API v3
  4. Go to Credentials and create an API key

YouTube uses a cost-based daily quota (default: 10,000 units). Different operations cost different amounts:

OperationCost
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.


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.

Terminal window
pnpm add @unified-live/core @unified-live/twitch
import { createTwitchPlugin } from "@unified-live/twitch";
const twitch = createTwitchPlugin({
clientId: process.env.TWITCH_CLIENT_ID!,
clientSecret: process.env.TWITCH_CLIENT_SECRET!,
});
  1. Go to Twitch Developer Console
  2. Register a new application
  3. Copy the Client ID and generate a Client Secret

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.

The SDK handles OAuth2 Client Credentials Grant automatically. Tokens are refreshed before expiry.


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.

Terminal window
pnpm add @unified-live/core @unified-live/twitcasting
import { createTwitCastingPlugin } from "@unified-live/twitcasting";
const twitcasting = createTwitCastingPlugin({
clientId: process.env.TWITCASTING_CLIENT_ID!,
clientSecret: process.env.TWITCASTING_CLIENT_SECRET!,
});
  1. Go to TwitCasting Developer
  2. Register a new application
  3. Copy the Client ID and Client Secret

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.

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.


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);