You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{OpenAPIClient}from'@marswave/listenhub-sdk';constclient=newOpenAPIClient({apiKey: 'lh_sk_...'});// or set LISTENHUB_API_KEY env var and call new OpenAPIClient()const{items: speakers}=awaitclient.listSpeakers({language: 'en'});const{episodeId}=awaitclient.createFlowSpeech({sources: [{type: 'text',content: 'Hello world'}],speakers: [{speakerId: speakers[0].speakerId}],});
OAuth (for client-side apps)
Clone the repo and run the OAuth login example — it opens a browser, handles the callback, and prints your tokens:
git clone https://github.com/marswaveai/listenhub-sdk.git
cd listenhub-sdk
pnpm i
npx tsx examples/oauth-login.ts
Client options
The SDK provides two clients for different auth modes:
// OpenAPI Key — server-side, no user login requiredconstopenapi=newOpenAPIClient({apiKey: 'lh_sk_...',// or LISTENHUB_API_KEY env varbaseURL: 'https://api.marswave.ai/openapi',// or LISTENHUB_OPENAPI_URL env vartimeout: 60_000,maxRetries: 2,});// OAuth access token — client-side, user login requiredconstclient=newListenHubClient({accessToken: 'token',// static string or () => string | undefinedbaseURL: 'https://api.listenhub.ai/api',timeout: 30_000,maxRetries: 2,});