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

# Build an AI agent on Livepeer

> Build an AI agent using the Eliza framework with Livepeer as the model provider for decentralised GPU inference. A complete tutorial with working code.

> [!TIP]
>
> This tutorial walks through building a working Eliza AI agent that routes all inference through Livepeer's decentralised GPU network. Time to complete: approximately 30 minutes.

***

> [!NOTE]
>
> This tutorial is adapted from the [Livepeer Agent SPE guide on Mirror.xyz](https://mirror.xyz/agent-spe.eth/oxs8VxEvKN88IeTwD-YQMucoDGqfNRz_mIlbUKkwOTg), published as part of the Agent SPE incentive programme. The original tutorial was written by the Agent SPE team and made available under an open licence.

[Eliza](https://github.com/elizaos/eliza) is an open-source multi-agent framework (ai16z) that supports pluggable model providers. The Livepeer plugin routes Eliza's LLM inference requests to the Livepeer AI gateway, where they run on decentralised GPU infrastructure rather than centralised cloud providers.

**What you will build:** An Eliza agent that uses Livepeer as its LLM backend, running `meta-llama/Meta-Llama-3.1-8B-Instruct` (or any Ollama-compatible model) on the network.

Prerequisites

## Prerequisites

* Node.js 22 or later
* pnpm (`npm install -g pnpm`)
* A Livepeer Studio API key from [livepeer.studio](https://livepeer.studio) -- free tier covers this tutorial

Steps

## Build your agent

### 1. Clone the Eliza repository

```bash theme={null}
git clone https://github.com/elizaos/eliza.git
cd eliza
git checkout main
pnpm install
pnpm build
```

### 1. Configure your environment

Create a `.env` file in the project root:

```bash theme={null}
# .env
# Livepeer gateway configuration
LIVEPEER_GATEWAY_URL=https://livepeer.studio/api/beta/generate
LIVEPEER_API_KEY=your-studio-api-key-here

# Agent identity (optional -- Eliza generates defaults if omitted)
AGENT_NAME=my-livepeer-agent
```

The `LIVEPEER_GATEWAY_URL` points to the Studio-managed gateway. For testing with the free public gateway, use `https://dream-gateway.livepeer.cloud` instead -- but do not use the public gateway in production.

### 1. Create your character file

Create `characters/my-agent.character.json`:

```json theme={null}
{
  "name": "LivepeerAgent",
  "clients": [],
  "modelProvider": "livepeer",
  "settings": {
    "model": "meta-llama/Meta-Llama-3.1-8B-Instruct",
    "secrets": {}
  },
  "system": "You are a helpful AI assistant running on decentralised GPU infrastructure via the Livepeer network. Answer questions clearly and concisely.",
  "bio": [
    "AI assistant powered by decentralised compute",
    "Runs on Livepeer's global GPU network"
  ],
  "lore": [],
  "knowledge": [],
  "messageExamples": [
    [
      {
        "user": "{{user1}}",
        "content": { "text": "What can you help me with?" }
      },
      {
        "user": "LivepeerAgent",
        "content": {
          "text": "I can answer questions, help with code, and discuss topics across many domains. My inference runs on the Livepeer decentralised GPU network."
        }
      }
    ]
  ],
  "topics": ["technology", "AI", "decentralisation", "general knowledge"],
  "adjectives": ["helpful", "precise", "direct"]
}
```

The `modelProvider: "livepeer"` field tells Eliza to route all inference through the Livepeer plugin. The `model` value in settings must be a model supported by the Livepeer LLM pipeline -- any Ollama-compatible model works, including Llama, Mistral, Gemma, and Qwen variants.

### 1. Run the agent

```bash theme={null}
pnpm start --characters="characters/my-agent.character.json"
```

On first run, Eliza initialises the agent, loads the character file, and connects to the Livepeer gateway. You should see:

```
[INFO] Starting agent: LivepeerAgent
[INFO] Model provider: livepeer
[INFO] Gateway: https://livepeer.studio/api/beta/generate
[INFO] Agent ready
```

If the LLM pipeline is cold (model not yet loaded on any orchestrator), the first request may take 30-90 seconds. Subsequent requests are fast once the model is warm.

### 1. Test the agent

With the agent running, open a second terminal and send a test message via the Eliza CLI or REST interface:

```bash theme={null}
# If Eliza's REST interface is enabled (default port 3000)
curl -X POST http://localhost:3000/message \
  -H "Content-Type: application/json" \
  -d '{"text": "Explain what Livepeer is in one sentence."}'
```

Expected response (content will vary):

```json theme={null}
{
  "text": "Livepeer is a decentralised protocol that provides GPU compute for AI inference and video transcoding, powered by a network of orchestrators staking LPT."
}
```

Extending the Agent

## What to build next

With a working agent, three natural extensions exist:

**Switch the model** -- Change `settings.model` in your character file to any Ollama-compatible model available on the Livepeer network. The LLM pipeline accepts arbitrary model IDs; see the [model support page](/v2/developers/build/model-support.md) for supported variants.

**Add memory and knowledge** -- Eliza supports RAG (retrieval-augmented generation) via knowledge files and vector stores. Add entries to the `knowledge` array in your character file to give the agent domain-specific context.

**Integrate with Slack or Discord** -- The Eliza framework includes client connectors for Slack, Discord, and Twitter. Add `"slack"` or `"discord"` to the `clients` array and configure the respective credentials in `.env`.

**Build a multi-agent swarm** -- The SwarmZero framework integrates with Livepeer's inference APIs and supports multi-agent orchestration. See the [SwarmZero Livepeer example](https://docs.swarmzero.ai/examples/swarms/livepeer-youtube-video-generator-swarm) for a working YouTube video generator swarm.

Model Reference

## Supported LLM models

The Livepeer LLM pipeline uses an Ollama-based runner. Any Ollama-compatible model works. Warm models respond immediately; others cold-start on the first request.

| Model | Warm on network | VRAM required |
| - | - | - |
| `meta-llama/Meta-Llama-3.1-8B-Instruct` | Yes | 8 GB |
| `mistralai/Mistral-7B-Instruct-v0.3` | Check network | 8 GB |
| `google/gemma-2-9b-it` | Check network | 10 GB |
| `Qwen/Qwen2.5-7B-Instruct` | Check network | 8 GB |

## Related pages

> [card] [AI Quickstart](/v2/developers/get-started/ai-quickstart.md)
>
> Make a direct API call to any AI pipeline without a framework.

> [card] [Model Support](/v2/developers/build/model-support.md)
>
> All supported pipelines, warm models, and VRAM requirements.

> [card] [BYOC](/v2/developers/build/byoc.md)
>
> Deploy a custom model container for workloads not covered by standard pipelines.

> [card] [AI Troubleshooting](/v2/developers/guides/ai/troubleshooting.md)
>
> Diagnose cold model timeouts, auth errors, and validation failures.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.