Learn how to run your first AI inference job using the Livepeer AI Go SDK.
Prerequisites
Install the SDK
go get github.com/livepeer/livepeer-ai-go
Initialize the SDK
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
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 } }
Try it yourself
Was this page helpful?