DEV Community

Arib Khan
Arib Khan

Posted on Originally published at Medium

Generating video from Claude and Cursor with one API key (MCP + agent skills)

Disclosure: I work on Revana. The examples use its MCP server and REST API because that's what I know end to end. The patterns (quote first, cap the cost, idempotent retries, wait without polling) apply to any paid generation API you give an agent.

Coding agents are now good at the glue work around media: writing a storyboard, generating a start frame, rendering a clip, trimming it with ffmpeg, and committing the result to a repo. What they lack out of the box is a safe way to spend money on generation. An agent that can call a video model in a retry loop can also burn $50 in a minute.

This post covers two ways to give Claude (Claude Code, Claude Desktop) and Cursor access to video models such as Seedance 2.5, Veo 3.1 and Kling, through a single key:

  1. An MCP server. The agent gets typed tools such as get_quote and generate_video.
  2. An agent skill / rules file. The agent calls the REST API with curl, following a short set of rules you write once.

You can use either or both. MCP is less work. The skill gives you more control and works in any agent that can run a shell.

Everything below is also in a public repo, Aribk7/revana-skills: ready-made Agent Skills for Claude Code, Codex and Cursor, runnable examples, and two n8n workflows.

Option 1: the MCP server

Revana runs a remote MCP server over streamable HTTP at:

https://revana.si/api/mcp
Enter fullscreen mode Exit fullscreen mode

Claude Code

claude mcp add --transport http revana https://revana.si/api/mcp
Enter fullscreen mode Exit fullscreen mode

Then type /mcp inside Claude Code and choose revana to sign in. The OAuth flow creates a separate API key for this connection. You can revoke it from the dashboard without touching your other keys.

Claude Desktop / claude.ai

Add it as a custom connector with the same URL, then click Connect and approve it on revana.si.

Cursor

Add the server to ~/.cursor/mcp.json (global) or .cursor/mcp.json (per project). With OAuth, Cursor asks you to sign in the first time a tool is used:

{
  "mcpServers": {
    "revana": {
      "url": "https://revana.si/api/mcp"
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Any client that takes headers

If your client doesn't support OAuth, pass an API key from the dashboard as a header. Keep this file out of git: the key spends real credits.

{
  "mcpServers": {
    "revana": {
      "type": "http",
      "url": "https://revana.si/api/mcp",
      "headers": { "Authorization": "Bearer sr_live_YOUR_KEY" }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

VS Code and Codex CLI one-liners, for completeness:

code --add-mcp '{"name":"revana","type":"http","url":"https://revana.si/api/mcp"}'
codex mcp add revana --url https://revana.si/api/mcp && codex mcp login revana
Enter fullscreen mode Exit fullscreen mode

What the agent gets

Tool What it does Costs money
list_models Every video/image model with options and price no
get_quote Exact price for a request, before anything runs no
get_balance What the credits can spend now, what's held by running jobs no
upload_file Turn a local image/clip/sound into an https link for references (14 days) no
generate_video Start the generation, capped by max_cost_usd yes
get_video Wait for a job (long-poll up to 40 s per call) no
get_video_link A download link for the result (valid one hour) no

The design choice that matters is that quoting is a separate, free tool and the server instructions tell the model to quote first and ask before calling generate_video. In practice, this prompt:

Make a 5-second 720p video of a paper boat in the rain with Seedance 2.5. Tell me the price first.

produces a get_quote call, a message like "That's $1.05 (5 s x $0.21/s at 720p, price as of 2026-11-05). Go ahead?", and only after you answer yes, a generate_video call with max_cost_usd: 1.25 and an idempotency key the agent makes up. If the agent retries after a network error, it reuses that key, and the server returns the same job instead of starting a second paid one.

The other detail is get_video with wait_seconds. Without it, agents tend to poll in a tight loop and fill their own context with status messages. A long-poll lets one tool call wait up to 40 seconds.

Option 2: an agent skill that calls the REST API

MCP is convenient, but sometimes you want the agent to drive the HTTP API directly: in CI, in a sandbox without MCP, or when you want the generated files written straight into the repo. In that case, give the agent a short rules file and a key in the environment.

The key goes in the environment, set by you, never pasted into the chat:

export REVANA_API_KEY=sr_live_...   # in your shell profile or a .env the agent can't print
Enter fullscreen mode Exit fullscreen mode

Then add a skill. For Claude Code that's .claude/skills/video/SKILL.md. For Cursor, put the same text in .cursor/rules/video.mdc.

If you'd rather not write it yourself, the revana-skills repo has finished skills for video, images, UGC ads, music and picking the cheapest model. Copy a folder from its skills/ directory into ~/.claude/skills/ (or your agent's skills directory). The minimal version looks like this:

---
name: video
description: Generate a video or image with the Revana API (Seedance 2.5, Veo 3.1, Kling, Wan, Nano Banana Pro). Use when the user asks to make, render or animate a video or image.
---

# Rules
1. The key is in $REVANA_API_KEY. Never print, echo or write it to a file.
2. Quote first from the live price list (no key needed) and wait for a "yes":
   curl -s https://api.revana.si/v1/models | jq '.data[] | select(.id=="seedance-2.5") | .price'
   Cost = price.usd[resolution] (or "<res>+audio" when present and audio is on) x duration.
3. Always send max_cost_usd equal to the agreed price.
4. Send an Idempotency-Key header. On any retry, send the same key and the same body.
5. Poll GET /v1/generations/{id} every 5 s until status is succeeded or failed.
6. Download with GET /v1/generations/{id}/content into ./media/, then tell the user the path and the final cost_usd.
7. If error.retryable is false, don't retry: change the request or ask the user.
Enter fullscreen mode Exit fullscreen mode

With the skill in place, the agent's generated commands look like this:

# 1. submit (202 Accepted; a replay of the same key returns 200 with the same job)
GEN=$(curl -s https://api.revana.si/v1/generations \
  -H "Authorization: Bearer $REVANA_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: boat-rain-v1" \
  -d '{
    "model": "seedance-2.5",
    "input": {
      "prompt": "a paper boat drifting down a rain-soaked street, low angle, shallow depth of field",
      "resolution": "720p", "duration": 5, "aspect_ratio": "16:9", "audio": true
    },
    "max_cost_usd": 1.05
  }')
ID=$(echo "$GEN" | jq -r .id)

# 2. poll
while :; do
  G=$(curl -s https://api.revana.si/v1/generations/$ID -H "Authorization: Bearer $REVANA_API_KEY")
  S=$(echo "$G" | jq -r .status)
  [ "$S" = succeeded ] || [ "$S" = failed ] && break
  sleep 5
done
echo "$G" | jq '{status, cost_usd, error}'

# 3. download (the endpoint redirects to a short-lived file URL, hence -L)
mkdir -p media
curl -sL https://api.revana.si/v1/generations/$ID/content \
  -H "Authorization: Bearer $REVANA_API_KEY" -o media/boat-rain.mp4
Enter fullscreen mode Exit fullscreen mode

Image-to-video from a local file

Agents often generate a start frame first and then animate it. Reference media must be public https:// URLs, so a local file goes through /v1/uploads first. The upload is free, and the returned link is valid for 14 days:

// upload.mjs: node upload.mjs frame.png  ->  prints a https link to use as image_url
import { readFile } from "node:fs/promises";
import { basename } from "node:path";

const file = process.argv[2];
const bytes = await readFile(file);
const headers = { Authorization: `Bearer ${process.env.REVANA_API_KEY}`, "Content-Type": "application/json" };

const up = await fetch("https://api.revana.si/v1/uploads", {
  method: "POST",
  headers,
  body: JSON.stringify({ content_type: "image/png", bytes: bytes.length, filename: basename(file) }),
}).then((r) => r.json());

// PUT the bytes with exactly the headers the API returned (content type and length are signed)
const put = await fetch(up.upload_url, { method: up.upload_method, headers: up.upload_headers, body: bytes });
if (!put.ok) throw new Error(`upload failed: ${put.status}`);

console.log(up.url); // e.g. https://api.revana.si/v1/uploads/upl_..., good for 14 days
Enter fullscreen mode Exit fullscreen mode

Then the generation takes it as the first frame:

{
  "model": "seedance-2.5",
  "input": { "prompt": "the boat starts to drift, rain intensifies", "image_url": "https://api.revana.si/v1/uploads/upl_...",
             "resolution": "720p", "duration": 5, "aspect_ratio": "16:9", "audio": true },
  "max_cost_usd": 1.25
}
Enter fullscreen mode Exit fullscreen mode

What actually goes wrong with agents and paid APIs

After a few weeks of running this daily, these are the problems I've seen and what fixes each one:

  • Double spend on retry. The agent sees a timeout, assumes failure, and resubmits. Fix: an idempotency key per intent, not per HTTP call. The same key with the same body returns the original job, and the same key with a different body is a 409 idempotency_conflict. The conflict is useful, because it means the agent tried to "retry" with a changed prompt.
  • Silent upgrades. The agent decides 1080p "looks better" and triples the cost. Fix: max_cost_usd on every request. A route above the cap is skipped and the request fails with max_cost_exceeded instead of charging more.
  • Polling floods. The agent polls every second and fills its context. Fix: in MCP, use the long-poll tool. With REST, put an explicit interval in the rules.
  • Retrying the unretryable. A content-policy refusal won't pass on the fifth attempt. Fix: read error.retryable. content_policy, invalid_input and max_cost_exceeded are final, while model_busy, timeout and all_routes_failed are worth retrying later.
  • Leaked keys. Agents happily echo $REVANA_API_KEY while debugging. Fix: say so in the rules, prefer OAuth-scoped MCP keys you can revoke individually, and keep a low balance on agent keys.

Which one to use

  • Interactive use in Claude Desktop, claude.ai or Cursor chat: MCP. Two minutes of setup, with quoting and confirmation built in.
  • Claude Code / Cursor working inside a repo, where you want files on disk and scripts you can re-run: the skill plus REST. Keep MCP connected for quotes.
  • CI or batch jobs: REST only, with the same three rules: quote, cap, idempotency key.

SDKs, examples and n8n

The official SDKs are open source on GitHub: revana-js (TypeScript/JavaScript) and revana-python. Both wrap the same quote, cap, idempotency key and wait flow described above. Both are published: npm install revana and pip install revana.

The revana-skills repo also has runnable examples (curl, Node, Python, Next.js route handlers, Vercel AI SDK tools, MCP configs) and importable n8n workflows that quote, create, wait and download.

The full API is described in an OpenAPI file at https://revana.si/openapi.json, and GET https://api.revana.si/v1/models lists every model and price without a key. Prices quoted in this post are as of 2026-11-05.


Try it: revana.si has one API key for 200+ video and image models, with live prices on revana.si/pricing.

Top comments (0)