# Claude Code and the eroq CLI — generate assets from a coding agent

> Wire the eroq CLI into Claude Code, Cursor or Codex as a stdio MCP server that saves renders as files. Commands, env vars and a real landing-page session.

Published 2026-09-04 · eroq.ai — canonical: https://eroq.ai/blog/claude-code-and-the-eroq-cli


Coding agents are good at everything on a landing page except the hero image. They can write the `<picture>` tag; they cannot produce the picture. Media APIs return a URL or a base64 blob, and what an agent actually wants is a file at a path it can reference in the next edit. The `eroq` CLI closes that gap: `eroq mcp` runs a local MCP server over stdio whose tools save renders as files in your project and return the path.

This is the workflow we use ourselves, with the commands, the environment variables and a full session at the end.

## Install and log in

The package is on npm, needs Node 18 or newer, and has zero dependencies.

```bash
npm install -g eroq
eroq login          # paste a key from the developers dashboard
eroq account        # balance, plan, workspace
```

`eroq login` stores the key in `~/.config/eroq/config.json` with `0600` permissions. Two environment variables override it, which is what you want in CI or in an agent's config:

- `EROQ_API_KEY` — the key; wins over the stored one.
- `EROQ_API_URL` — the base URL, default `https://eroq.ai`. Leave it alone unless you are pointing at a staging deployment.

## The commands

Every command prints what it saved and a meter line ("Spent 100 credits · 887 remaining").

```bash
eroq models                                     # models, credit prices, plan gates
eroq voices                                     # roster + your clones
eroq enhance "kettle on a counter" --kind image # free prompt rewrite
eroq image "…" -m eroq-image-one -o public/img/hero.webp
eroq video "…" -s 10 --aspect 9:16 --shot push-in -o public/video/teaser.mp4
eroq speech "…" -v orion --speed 0.95 -o public/audio/intro.mp3
```

Flags worth knowing: `-m` picks the model (images default to `eroq-image-one`, video to `eroq-motion-one`), `-s` is the clip length in seconds (your plan caps it and the engine's grid snaps it — see the [video docs](/docs/video)), `--aspect` takes `16:9`, `9:16` or `1:1`, `--shot` is one of the [camera moves](/tools/camera-controls), `--ref` gives a photo URL (image-to-video for clips, a face to hold for stills), `--negative` is the negative prompt, and `-o` is the output path. Without `-o` you get `./eroq-image-<timestamp>.webp`, `./eroq-video-<timestamp>.mp4` or `./eroq-speech-<timestamp>.mp3`.

## Two ways to plug into Claude Code

There are two servers, and they differ in one important way.

**Remote, over HTTP.** Claude Code talks straight to `https://eroq.ai/mcp`. Tools return URLs, and `generate_video` returns a job id when the render is not done yet.

```bash
claude mcp add --transport http eroq https://eroq.ai/mcp \
  --header "Authorization: Bearer eroq_sk_YOUR_KEY"
```

**Local, over stdio.** Claude Code launches `eroq mcp` as a child process. Tools save files into the working directory and return the path; `generate_video` waits for the render (up to 8 minutes) so the agent gets an MP4, not a receipt.

```bash
claude mcp add eroq --env EROQ_API_KEY=eroq_sk_YOUR_KEY -- npx -y eroq mcp
```

For coding work, take the local one. `eroq install claude-code` prints both snippets with your stored key already in place. The local tools are `generate_image`, `generate_video`, `generate_speech`, `enhance_prompt`, `list_models`, `list_voices`, `list_characters` and `get_account`; the first three accept an `out_path`.

Cursor reads `~/.cursor/mcp.json` (or `.cursor/mcp.json` in a project):

```json
{
  "mcpServers": {
    "eroq": {
      "url": "https://eroq.ai/mcp",
      "headers": { "Authorization": "Bearer eroq_sk_YOUR_KEY" }
    }
  }
}
```

Codex CLI reads `~/.codex/config.toml` and runs the stdio server:

```toml
[mcp_servers.eroq]
command = "npx"
args = ["-y", "eroq", "mcp"]
env = { EROQ_API_KEY = "eroq_sk_YOUR_KEY" }
```

`eroq install cursor` and `eroq install codex` print these too. The full connect matrix is in the [MCP docs](/docs/mcp).

## A realistic session — assets for a landing page

The task: a landing page for a fictional pour-over kettle ([product videos](/use-cases/product-videos) are the classic case). The agent has the local server, a `public/` folder and a budget of about 250 credits. Here is the trace, lightly trimmed.

```text
Agent: Checking the wallet before I spend anything.
       [get_account] → 1,000 credits, no plan (clips capped at 10 s)

Agent: Tightening the hero prompt first — it's free.
       [enhance_prompt kind=image prompt="black kettle, morning light, premium"]
       → "Close-up of a matte black pour-over kettle on a walnut counter, steam
          curling up into morning window light, shallow depth of field, soft cross
          lighting, a few coffee beans scattered out of focus, calm and premium,
          product photography, warm film palette."

Agent: [generate_image model=eroq-image-one out_path=public/img/hero.webp]
       → Image saved to public/img/hero.webp · Spent 10 credits · 990 remaining

Agent: Two feature tiles on the same look, then a vertical teaser.
       [generate_image … out_path=public/img/feature-pour.webp]   → 10 credits
       [generate_image … out_path=public/img/feature-temp.webp]   → 10 credits
       [generate_video model=eroq-motion-one seconds=10 aspect=9:16
        out_path=public/video/teaser.mp4
        prompt="Slow push-in on the same matte black kettle as steam rises and
        drifts toward the window, morning light warming from blue to gold, tiny
        dust motes in the beam, shallow focus holding on the spout, calm premium
        mood, 35mm film look."]
       → Clip saved to public/video/teaser.mp4 · Spent 180 credits · 790 remaining

Agent: A scratch voice-over for the hero, Orion, a touch slower.
       [generate_speech voice=orion speed=0.95 out_path=public/audio/intro.mp3
        text="Pour slower. Taste more. The kettle that waits for you."]
       → Speech saved to public/audio/intro.mp3 · Spent 3 credits · 787 remaining

Agent: Wiring them into index.html now.
```

Then it writes the markup — `<img src="/img/hero.webp">`, a muted autoplay `<video>` with the teaser, an `<audio>` element behind a play button — and the page is real. Total: 213 credits, roughly two dollars at the [entry pack rate](/pricing). Rendering fewer takes than a human would is the agent's one advantage here; it does not fall in love with the third variation.

Two habits make this reliable. Ask the agent to call `get_account` first, so it knows the plan's clip cap and the balance before it starts. And always pass `out_path` — default timestamped names in the project root are fine for a quick test and a mess in a repository.

## Guardrails for an agent that can spend money

- **Dedicated key.** Create one for the agent, with its own rate limits, and revoke it when the project ends.
- **Keep it out of git.** `--env` in Claude Code and the TOML in Codex live outside the repo; a project-level `.cursor/mcp.json` with a key inside belongs in `.gitignore`.
- **Failures are free.** A render that fails refunds itself; a prompt outside policy returns `content_blocked` and is never charged. The agent does not need retry logic beyond "try once more, then ask."
- **Model gates are explicit.** Premium video engines need a plan; a locked model answers `403 plan_required` before any billing. `eroq models` shows what your key can use.

## FAQ

### Do I need the CLI if I already use the remote MCP server?

No. The remote server works for any client that can send headers. The CLI's stdio server is for agents that want files on disk instead of URLs.

### Which models can the CLI use?

Everything your plan unlocks: three image models, the video engines listed by `eroq models`, both speech models and the roster of [voices](/models/eroq-voice-one), plus your clones and characters.

### Can the agent use my characters?

Yes. `list_characters` returns your cast; `generate_speech` with `char:<id>` speaks in that character's voice, and `--ref` with a character's photo holds the face across images or drives image-to-video.

Ready? [Get an API key](/signup), run `eroq login`, and let the agent do the boring part.
