Use Case

Generate AI Video API Integration with AI — From Your Terminal

If you are building an application that needs AI-generated video or images — a SaaS product, a content platform, an internal tool — you need a reliable API that abstracts away provider complexity. agent-media offers both a CLI and an MCP server that can be called programmatically. Instead of managing API keys for seven different providers, you authenticate once with agent-media and access every model through a unified interface.

Best Models for This

These models are recommended for generating ai video api integration. Each one brings different strengths to this workflow.

ModelWhy
Kling 3.0 ProMost versatile video model — supports text-to-video and image-to-video with predictable output quality, making it the safest default for automated pipelines.
Flux 2 ProFast generation and accurate text rendering make it ideal for programmatic image generation where output consistency matters.
Flux 2 FlexLowest cost at 25-50 credits per image — best choice for high-volume programmatic generation where speed and budget outweigh peak quality.

Step-by-Step Workflow

Follow these steps to start generating ai video api integration with agent-media CLI.

1

Get your API key

Log in to your agent-media account and verify your API key and credit balance. The API key is stored locally and used for all programmatic requests.

terminal
$ agent-media login
agent-media credits
2

Configure the MCP server

The MCP server exposes agent-media as a tool that any MCP-compatible client (Claude Code, custom agents) can call. This is the recommended integration path for AI-powered applications.

terminal
$ # Add to .claude/settings.json or your MCP client config:
{
  "mcpServers": {
    "agent-media": {
      "command": "npx",
      "args": ["-y", "agent-media-cli", "mcp"],
      "env": { "AGENT_MEDIA_API_KEY": "your-api-key" }
    }
  }
}
3

Call from a shell script or CI pipeline

The CLI works in any environment that runs Node.js. Use it in GitHub Actions, GitLab CI, or any shell-based automation to generate images and videos as part of your build process.

terminal
$ agent-media generate flux2-pro -p "OG image for blog post: $TITLE" --aspect-ratio 16:9 --sync
4

Monitor usage programmatically

Track credit consumption and job status from your scripts. Pipe the output to monitoring tools or log aggregators to keep your integration observable.

terminal
$ agent-media credits
agent-media jobs list

MCP / Claude Code Integration

The MCP server is the primary integration path for AI agents and coding assistants. Any MCP-compatible client can call agent-media tools — generate videos, check credits, list jobs — using structured tool calls. This means your AI agent can autonomously generate media as part of a larger task, like building a landing page or populating a content database, without human intervention at the generation step.

.claude/settings.json
{
  "mcpServers": {
    "agent-media": {
      "command": "npx",
      "args": ["-y", "agent-media-cli", "mcp"],
      "env": {
        "AGENT_MEDIA_API_KEY": "your-api-key"
      }
    }
  }
}

Then ask Claude: "Generate ai video api integration using agent-media"

How Much Does It Cost

API integration costs scale with usage. Image generation starts at 25 credits (Flux 2 Flex) and video at 200 credits (Kling/Seedance). For applications generating content on behalf of users, the Pro Plus plan ($119/month for 10,000 credits) provides the best unit economics. Pay-as-you-go packs ($9 for 500 credits up to larger bundles) offer flexibility for unpredictable workloads. There are no separate API fees — credits are the only cost.

Start generating ai video api integration

Install agent-media CLI and create your first video in under 60 seconds.

npm install -g agent-media-cli