> ## 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.

# LLM provider routing

> @livepeer/agent supports four LLM backends: Gemini, Claude, OpenAI, and Livepeer. Swap providers without changing application code.

export const CenteredContainer = ({children, maxWidth = "800px", padding = "0", preset = "default", width = "", minWidth = "", marginRight = "", marginBottom = "", textAlign = "", style = {}, className = "", ...rest}) => {
  const presets = {
    default: {},
    fitContent: {
      width: "fit-content",
      minWidth: "fit-content"
    },
    readable70: {
      width: "70%",
      minWidth: "fit-content"
    },
    readable80: {
      width: "80%",
      minWidth: "fit-content"
    },
    readable90: {
      width: "90%"
    },
    wide900: {
      maxWidth: "900px"
    }
  };
  const presetStyle = presets[preset] || presets.default;
  return <div className={className} style={{
    maxWidth: presetStyle.maxWidth || maxWidth,
    margin: "0 auto",
    padding: padding,
    ...presetStyle.width ? {
      width: presetStyle.width
    } : {},
    ...presetStyle.minWidth ? {
      minWidth: presetStyle.minWidth
    } : {},
    ...width ? {
      width
    } : {},
    ...minWidth ? {
      minWidth
    } : {},
    ...marginRight ? {
      marginRight
    } : {},
    ...marginBottom ? {
      marginBottom
    } : {},
    ...textAlign ? {
      textAlign
    } : {},
    ...style
  }} {...rest}>
      {children}
    </div>;
};

export const CustomDivider = ({color = "var(--lp-color-border-default)", middleText = "", spacing = "default", style = {}, className = "", ...rest}) => {
  const spacingPresets = {
    default: {
      margin: "24px 0"
    },
    overlap: {
      margin: "-1rem 0 -1rem 0"
    },
    tight: {
      margin: "0 0 -1rem 0"
    },
    section: {
      margin: "0 0 -2rem 0"
    },
    sectionOverlap: {
      margin: "-1rem 0 -2rem 0"
    },
    deepOverlap: {
      margin: "-1rem 0 -1.5rem 0"
    }
  };
  const spacingStyle = spacingPresets[spacing] || spacingPresets.default;
  return <div role="separator" aria-orientation="horizontal" className={className} style={{
    display: "flex",
    alignItems: "center",
    ...spacingStyle,
    fontSize: style?.fontSize || "16px",
    height: "fit-content",
    ...style
  }} {...rest}>
      <span style={{
    marginRight: "var(--lp-spacing-px-8)",
    opacity: 0.2
  }}>
        <Icon icon="/snippets/assets/logos/Livepeer-Logo-Symbol-Theme.svg" />
      </span>
      <div style={{
    flex: 1,
    height: "1px",
    background: "var(--lp-color-border-default)",
    opacity: 0.4
  }}></div>
      {middleText && <>
          <Icon icon="circle" size={2} />
          <span style={{
    margin: "0 8px",
    fontWeight: "bold",
    color: color,
    opacity: 0.7
  }}>
            {middleText}
          </span>
          <Icon icon="circle" size={2} />
        </>}
      <div style={{
    flex: 1,
    height: "1px",
    background: "var(--lp-color-border-default)",
    opacity: 0.4
  }}></div>
      <span style={{
    marginLeft: "var(--lp-spacing-px-8)",
    opacity: 0.2
  }}>
        <span style={{
    display: "inline-block",
    transform: "scaleX(-1)"
  }}>
          <Icon icon="/snippets/assets/logos/Livepeer-Logo-Symbol-Theme.svg" />
        </span>
      </span>
    </div>;
};

export const TableCell = ({children, align = "left", header = false, style = {}, className = "", ...rest}) => {
  const Component = header ? "th" : "td";
  return <Component className={className} style={{
    padding: "0.75rem 1rem",
    textAlign: align,
    border: header ? "none" : "1px solid var(--lp-color-border-default)",
    ...style
  }} {...rest}>
      {children}
    </Component>;
};

export const TableRow = ({children, header = false, hover = false, style = {}, className = "", ...rest}) => {
  const rowId = `table-row-${Math.random().toString(36).substr(2, 9)}`;
  return <>
      {hover && <style>{`
          #${rowId}:hover {
            background-color: var(--lp-color-bg-card);
          }
        `}</style>}
      <tr id={rowId} className={className} style={{
    ...header && ({
      backgroundColor: "var(--lp-color-accent-strong)",
      color: "var(--lp-color-on-accent)",
      fontWeight: "bold"
    }),
    ...style
  }} {...rest}>
        {children}
      </tr>
    </>;
};

export const StyledTable = ({children, variant = "default", style = {}, className = "", ...rest}) => {
  const wrapperVariants = {
    default: {
      border: "1px solid var(--lp-color-border-default)",
      backgroundColor: "var(--lp-color-bg-card)",
      overflow: "hidden"
    },
    bordered: {
      border: "2px solid var(--lp-color-accent)",
      backgroundColor: "var(--lp-color-bg-page)",
      overflow: "hidden"
    },
    minimal: {
      border: "none",
      backgroundColor: "transparent",
      overflow: "visible"
    }
  };
  return <div data-docs-styled-table-shell className={className} style={{
    width: "100%",
    padding: 0,
    margin: 0,
    ...wrapperVariants[variant],
    ...style
  }} {...rest}>
      <table data-docs-styled-table style={{
    width: "100%",
    borderCollapse: "collapse",
    borderSpacing: 0,
    margin: 0,
    backgroundColor: "transparent"
  }}>
        {children}
      </table>
    </div>;
};

<CenteredContainer preset="readable90">
  <Tip>Provider swap is a one-line change. The AgentRunner interface is identical regardless of which LLM backend processes the request.</Tip>
</CenteredContainer>

<CustomDivider />

`@livepeer/agent` abstracts LLM access behind a provider interface. The `AgentRunner` accepts any provider that implements the common interface; switching from Gemini to Claude or OpenAI requires changing one import and one constructor argument.

<CustomDivider />

## Available providers

<StyledTable variant="bordered">
  <thead>
    <TableRow header>
      <TableCell header>Provider</TableCell>
      <TableCell header>Import</TableCell>
      <TableCell header>API key env var</TableCell>
      <TableCell header>Routes through</TableCell>
    </TableRow>
  </thead>

  <tbody>
    <TableRow>
      <TableCell>**Gemini** (default)</TableCell>
      <TableCell>`@livepeer/agent/providers/gemini`</TableCell>
      <TableCell>`GEMINI_API_KEY`</TableCell>
      <TableCell>Google API directly</TableCell>
    </TableRow>

    <TableRow>
      <TableCell>**Claude**</TableCell>
      <TableCell>`@livepeer/agent/providers/claude`</TableCell>
      <TableCell>`ANTHROPIC_API_KEY`</TableCell>
      <TableCell>Anthropic API directly</TableCell>
    </TableRow>

    <TableRow>
      <TableCell>**OpenAI**</TableCell>
      <TableCell>`@livepeer/agent/providers/openai`</TableCell>
      <TableCell>`OPENAI_API_KEY`</TableCell>
      <TableCell>OpenAI API directly</TableCell>
    </TableRow>

    <TableRow>
      <TableCell>**Livepeer**</TableCell>
      <TableCell>`@livepeer/agent/providers/livepeer`</TableCell>
      <TableCell>`DAYDREAM_API_KEY`</TableCell>
      <TableCell>SDK Service at `sdk.daydream.monster`; routes to Gemini/Claude/OpenAI via Livepeer infrastructure</TableCell>
    </TableRow>
  </tbody>
</StyledTable>

The Livepeer provider routes all LLM calls through Livepeer infrastructure with a single Daydream API key from `daydream.live`. This is the simplest configuration: one key, one provider, all LLM backends available.

<CustomDivider />

## Swapping providers

```typescript theme={"theme":{"light":"github-light","dark":"dark-plus"}}
import { AgentRunner, ToolRegistry, WorkingMemoryStore, SessionMemoryStore } from '@livepeer/agent';

// Option 1: Gemini directly
import { GeminiProvider } from '@livepeer/agent/providers/gemini';
const provider = new GeminiProvider({ apiKey: process.env.GEMINI_API_KEY! });

// Option 2: Claude directly
import { ClaudeProvider } from '@livepeer/agent/providers/claude';
const provider = new ClaudeProvider({ apiKey: process.env.ANTHROPIC_API_KEY! });

// Option 3: All LLM calls through Livepeer (single API key)
import { LivepeerProvider } from '@livepeer/agent/providers/livepeer';
const provider = new LivepeerProvider({ apiKey: process.env.DAYDREAM_API_KEY! });

// The runner interface is identical regardless of provider
const runner = new AgentRunner(
  provider,
  new ToolRegistry(),
  new WorkingMemoryStore(),
  new SessionMemoryStore(),
);

const result = await runner.run({ user: 'generate an image of a mountain' });
```

The `AgentRunner` calls `provider.complete()` internally. Each provider translates the common message format to its backend's native API shape. Tool calls, working memory, and session memory work identically across all providers.

<CustomDivider />

## CLI provider selection

The CLI reads the provider from environment variables. Set the API key for the provider you want to use:

```bash theme={"theme":{"light":"github-light","dark":"dark-plus"}}
# Gemini (default if GEMINI_API_KEY is set)
export GEMINI_API_KEY=your-key
livepeer run flux-schnell --prompt "a mountain at dawn"

# Claude
export ANTHROPIC_API_KEY=your-key
livepeer run flux-schnell --prompt "a mountain at dawn"

# Livepeer (all backends via single key)
export DAYDREAM_API_KEY=sk_live_xxx
livepeer run flux-schnell --prompt "a mountain at dawn"
```

If multiple API keys are set, the CLI uses this precedence: `DAYDREAM_API_KEY` > `GEMINI_API_KEY` > `ANTHROPIC_API_KEY` > `OPENAI_API_KEY`.

<CustomDivider />

Source: [`livepeer/storyboard`](https://github.com/livepeer/storyboard) `packages/agent/README.md`.

The [Agent SDK](/v2/developers/build/ai-and-agents/agents/agent-sdk) page covers the full `AgentRunner` API, MCP server mode, and CLI verb reference.
