Prerequisites
To get the most out of this guide, you’ll need to: Install the SDK
Get the Livepeer AI Golang SDK.go get github.com/livepeer/livepeer-ai-go
Initialize the SDK
The first step is to initialize the SDK (with your API key if required).package main
import (
"context"
livepeeraigo "github.com/livepeer/livepeer-ai-go"
"github.com/livepeer/livepeer-ai-go/models/components"
"log"
)
func main() {
s := livepeeraigo.New(
livepeeraigo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
)
}
Use the SDK
Now that you have the SDK installed and initialized, you can use it to request one of the available AI services.package main
import (
"context"
livepeeraigo "github.com/livepeer/livepeer-ai-go"
"github.com/livepeer/livepeer-ai-go/models/components"
"log"
)
func main() {
s := livepeeraigo.New(
livepeeraigo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
)
ctx := context.Background()
res, err := s.Generate.TextToImage(ctx, components.TextToImageParams{
Prompt: "<value>",
})
if err != nil {
log.Fatal(err)
}
if res.ImageResponse != nil {
// handle response
}
}
Next steps
Checkout Livepeer AI API Reference to learn more about the
Livepeer AI API and the Golang SDK.Last modified on February 18, 2026