> ## Documentation Index
> Fetch the complete documentation index at: https://docs.livepeer.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Go

> Learn how to run your first AI inference job using the Livepeer AI Go SDK.

<Steps>
  <Step title="Prerequisites">
    To get the most out of this guide, you’ll need to:

    * [Choose an AI Gateway](/ai/builders/gateways)
    * **Optional**: Get an API key (required for some gateways).
  </Step>

  <Step title="Install the SDK">
    Get the Livepeer AI Golang SDK.

    ```bash theme={"theme":{"light":"github-light","dark":"dark-plus"}}
    go get github.com/livepeer/livepeer-ai-go
    ```
  </Step>

  <Step title="Initialize the SDK">
    The first step is to initialize the SDK (with your API key if required).

    ```go theme={"theme":{"light":"github-light","dark":"dark-plus"}}
    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>"),
    	)
    }
    ```
  </Step>

  <Step title="Use the SDK">
    Now that you have the SDK installed and initialized, you can use it to request one of the [available AI services](/ai/pipelines/overview).

    ```go theme={"theme":{"light":"github-light","dark":"dark-plus"}}
    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
    	}
    }
    ```
  </Step>

  <Step title="Try it yourself">
    <Card title="Golang Examples" href="https://github.com/livepeer/livepeer-ai-js/tree/main/docs/sdks/generate#generate" icon="arrow-up-right-from-square">
      See the examples on GitHub.
    </Card>
  </Step>
</Steps>

## Next steps

Checkout Livepeer AI [API Reference](/ai/api-reference) to learn more about the
Livepeer AI API and the Golang SDK.
