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

# Go

> Render prompt templates programmatically using the px0 Go SDK.

Integrate px0 into your Go application. This guide shows how to fetch and render a prompt template programmatically.

## Prerequisites

Before running the SDK, ensure you have completed the following steps:

* [Running px0 locally](/get-started/run-locally)
* [Getting an access key](/get-started/get-access-key)
* [Creating your first prompt](/get-started/create-prompt)

## Configuration

The Go SDK requires connection details and authentication to communicate with your px0 instance. Configure these details using environment variables.

* `PX0_HOST`: The URL of your px0 API instance.
* `PX0_ACCESS_TOKEN`: Your API access key.

Set these variables in your shell before running the applications:

```bash theme={null}
export PX0_HOST="http://localhost:8000"
export PX0_ACCESS_TOKEN="your_access_key_here"
```

## Installation

Install the required client library for Go.

```bash theme={null}
go get github.com/px0-ai/px0-go
```

## Hello World Example

The following example demonstrates how to load the client, authenticate, and render a live prompt template named `hello_world` with a dynamic `name` variable.

```go theme={null}
package main

import (
	"context"
	"fmt"
	"os"

	"github.com/px0-ai/px0-go"
)

func main() {
	host := os.Getenv("PX0_HOST")
	accessToken := os.Getenv("PX0_ACCESS_TOKEN")

	config := px0.NewConfiguration()
	if host != "" {
		config.Servers = px0.ServerConfigurations{
			{
				URL: host,
			},
		}
	}

	apiClient := px0.NewAPIClient(config)

	ctx := context.Background()
	if accessToken != "" {
		ctx = context.WithValue(ctx, px0.ContextAccessToken, accessToken)
	}

	renderRequest := px0.NewRenderRequest()
	renderRequest.SetVariables(map[string]interface{}{
		"name": "World",
	})

	response, _, err := apiClient.PromptRendersAPI.RenderLive(ctx, "hello_world").
		RenderRequest(*renderRequest).
		Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error rendering live: %v\n", err)
		os.Exit(1)
	}

	fmt.Println(response.GetRendered())
}
```

## Execution

Run the Go application:

```bash theme={null}
go run main.go
```
