Optional: Get an API key (required for some gateways).
2
Install the SDK
Get the Livepeer AI JavaScript SDK.
Copy
Ask AI
npm add @livepeer/ai
3
Initialize the SDK
The first step is to initialize the SDK (with your API key if required).
Copy
Ask AI
import { Livepeer } from "@livepeer/ai";const livepeer = new Livepeer({ httpBearer: "<YOUR_BEARER_TOKEN_HERE>",});
4
Use the SDK
Now that you have the SDK installed and initialized, you can use it to request one of the available AI services.
Copy
Ask AI
import { Livepeer } from "@livepeer/ai";const livepeer = new Livepeer({ httpBearer: "<YOUR_BEARER_TOKEN_HERE>",});async function run() { const result = await livepeer.generate.textToImage({ prompt: "<value>", }); // Handle the result console.log(result);}run();