The official SDK wraps the Partners API: it handles authentication, token caching and renewal, and retries with exponential backoff. Works in Node.js and the browser.
Install
npm install @aniflixx/partner-sdk
Quickstart
import AnimeSDK from '@aniflixx/partner-sdk'
const sdk = new AnimeSDK({
apiKey: process.env.ORIGINX_API_KEY,
apiSecret: process.env.ORIGINX_API_SECRET,
})
// authenticate() runs automatically on the first request,
// and the token is cached + renewed for you.
const catalog = await sdk.getContentCatalog()
console.log(`Found ${catalog.total_series} series`)
Options
On a 401, the SDK clears the cached token, re-authenticates, and retries once — so expiring tokens are handled transparently.
Methods
getContentCatalog()
Every series + episodes you can access.
const catalog = await sdk.getContentCatalog()
catalog.content.forEach(s => console.log(`${s.title} — ${s.episodes.length} eps`))
getSeries(seriesId)
const { series, episodes } = await sdk.getSeries('ser_8f2a91')
getEpisodeStream(episodeId)
Resolves a video stream URL, or manga/webtoon page URLs.
const stream = await sdk.getEpisodeStream('ep_123')
if (stream.episode.type === 'video') {
console.log('Play:', stream.stream_data.stream_url)
} else {
stream.stream_data.pages.forEach((p, i) => console.log(`Page ${i + 1}: ${p.url}`))
}
searchContent(query)
const { results, total } = await sdk.searchContent('sakura')
getAnalytics()
const { stats, top_series } = await sdk.getAnalytics()
console.log('Total views:', stats.total_views)
clearAuth()
Drops the cached token to force re-authentication on the next call.
Error handling
The SDK throws AnimeSDKError for API errors, with statusCode and the raw response.
import AnimeSDK, { AnimeSDKError } from '@aniflixx/partner-sdk'
try {
await sdk.getContentCatalog()
} catch (err) {
if (err instanceof AnimeSDKError) {
console.error(err.statusCode, err.message, err.response)
} else {
console.error('Network error', err)
}
}
TypeScript
import AnimeSDK, {
ContentCatalogResponse,
EpisodeStreamResponse,
AnalyticsResponse,
} from '@aniflixx/partner-sdk'
const sdk = new AnimeSDK({ apiKey: process.env.KEY!, apiSecret: process.env.SECRET! })
const catalog: ContentCatalogResponse = await sdk.getContentCatalog()