Skip to content

KarbonDallas/ai-sdk-js

Repository files navigation

ai-sdk-js

[alpha] Interact with Livepeer AI pipelines

About

Livepeer AI testnet is live! This unofficial client library makes it easy to integrate Livepeer's decentralized AI pipelines into your app. Usage is currently sponsored by Livepeer as the product is in beta, so it's free to get started!

This AI SDK is written in Typescript and published for use with either Typescript or Javascript with both CommonJS and ESM support. It is in active development.

More information about Livepeer AI on our docs site.

Current Supported AI Pipelines

  1. Text-to-Image
  2. Image-to-Image
  3. Image-to-Video
  4. Upscale Image
  5. Audio-to-Text

More pipelines and models are coming online regularly. If you are interested in contributing or requesting specific models, please join our Discord! We have an active community and welcome your participation.

Installation

npm install @karbondallas/ai-sdk

Compatible with modern browsers and Node-like runtimes!

TODO: add compatibility table

Usage

We have designed this library with developer experience in mind. With that said, we are still very early in development, so your feedback is valuable! If you run into any problems or have thoughts on the design, please feel encouraged to let us know!

Below are several examples of how you might make use of this library.

Quickstart

Text-to-Image

Generate an image from a prompt using the warm model with default parameters:

import LivepeerAI from '@livepeer/ai-sdk'

const ai = LivepeerAI()

const response = await ai.textToImage({
	prompt: 'grainy photo of a black cat',
})

Image-to-Image

Generate a new image from a text prompt and existing image using the warm model with default parameters:

import { readFileSync } from 'fs'
import { LivepeerAI } from '@livepeer/ai-sdk'

const ai = new LivepeerAI()
const image = readFileSync('./cat.jpg')
const response = await ai.imageToImage({
	prompt: 'retro video game sprite of a black cat',
	image,
})

Image-to-Video

Generate a short video from an image using the warm model with default parameters:

import { readFileSync } from 'fs'
import { LivepeerAI } from '@livepeer/ai-sdk'

const ai = new LivepeerAI()
const image = readFileSync('./cat.jpg')
const response = await ai.imageToVideo({
	image,
})

Upscale Image

Upscale an existing image to higher resolution using the warm model with default parameters:

import { readFileSync } from 'fs'
import { LivepeerAI } from '@livepeer/ai-sdk'

const ai = new LivepeerAI()
const image = readFileSync('./cat.jpg')
const response = await ai.upscale({
	prompt: 'photorealistic 4k image of a black cat'
	image,
})

Audio-to-Text

Generate text from an audio sample using the warm model with default parameters:

import { readFileSync } from 'fs'
import { LivepeerAI } from '@livepeer/ai-sdk'

const ai = new LivepeerAI()
const audio = readFileSync('./meow.mp3')
const response = await ai.audioToText({
	audio,
})

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published