Generate Your First AI Video from the Terminal in 60 Seconds
Most AI video tools make you open a browser, upload files through a web UI, wait in a queue, and then manually download the result. If you are a developer, that workflow is painful. agent-media CLI lets you generate videos and images from any terminal with a single command. This tutorial walks you through the entire process from zero to your first generated video in under 60 seconds.
Why generate video from a terminal?
Terminal-based video generation is not just a novelty. It unlocks workflows that browser-based tools simply cannot match. You can script batch generations, pipe outputs to other tools, integrate with CI/CD pipelines, and automate entire content pipelines without ever touching a GUI. If you can write a shell script, you can build an automated video production line. agent-media CLI gives you access to 7 AI models through one interface, one authentication, and one credit balance. There is no need to manage separate accounts across Kling, Sora, Seedance, and others.
Prerequisites
You need two things before starting:
- 1.Node.js 18 or higher. Check your version with
node --version. If you need to install it, grab it fromnodejs.orgor use a version manager like nvm. - 2.An agent-media account. Sign up at agent-media.ai and choose a plan. The Starter plan at $19/month gives you 1,000 credits, enough for several video generations to explore every model.
Step 1: Install the CLI
Install the agent-media CLI globally with npm. This gives you the agent-media command available from any directory on your system.
$ npm install -g agent-media-cli
After installation completes, verify it worked by checking the version:
$ agent-media --version
agent-media-cli/1.0.5
Step 2: Authenticate your account
The CLI needs to link to your agent-media account. Run the login command and a browser window will open automatically. Sign in with your account credentials and the CLI will store a secure device key locally so you do not need to log in again.
$ agent-media login
Opening browser for authentication...
Logged in successfully. Device key stored.
You can verify your authentication and check your credit balance at any time:
$ agent-media credits
Balance: 1,000 credits | Plan: Starter
Step 3: Generate your first video
Now for the fun part. Use the generate command with a model slug and a prompt. The --sync flag tells the CLI to wait for the generation to complete and print the output URL directly in your terminal, instead of returning immediately with a job ID.
$ agent-media generate kling3 -p "Golden retriever running through autumn leaves in a park, slow motion, warm sunlight" --sync
Submitting to Kling 3.0 Pro...
Waiting for generation (187 credits)...
Completed in 1m 47s
https://ppwvarkmpffljlqxkjux.supabase.co/storage/v1/.../output.mp4
That is it. You just generated a 5-second AI video from your terminal. The output URL is a direct link to your MP4 file. Open it in a browser, download it with curl, or pipe it into your video editing workflow.
Step 4: Understanding sync vs async mode
The --sync flag is convenient for quick one-off generations because it blocks until the video is ready. Without it, the CLI returns a job ID immediately, and you check the status later. This async mode is better when you are submitting multiple jobs in parallel.
# Async mode — returns job ID immediately
$ agent-media generate sora2 -p "Ocean waves crashing on rocky cliffs at sunset"
Job submitted: job_a1b2c3d4
# Check status later
$ agent-media jobs status job_a1b2c3d4
Step 5: Try different models
agent-media CLI gives you access to 4 video models and 3 image models. Each model has a unique slug you pass to the generate command. Here are a few examples to try:
Sora 2 Pro — Fastest generation (~45s)
$ agent-media generate sora2 -p "Abstract ink drops swirling in water, slow motion, vibrant colors mixing" --sync
Seedance 1.0 Pro — Most affordable (104 credits)
$ agent-media generate seedance1 -p "Young woman talking to camera in a sunny coffee shop, selfie vlog style" --sync
Veo 3.1 — Best lip sync and native audio
$ agent-media generate veo3 -p "Chef explaining a recipe while chopping vegetables, kitchen setting, talking head" --sync
To see all available models and their slugs, run:
$ agent-media models list
Bonus: Generate images with Flux 2 Pro
The same CLI also generates images. Flux 2 Pro costs just 5 credits per image and produces photorealistic results in 3-5 seconds. The workflow is identical — swap the model slug and the output is a JPG instead of an MP4.
$ agent-media generate flux2-pro -p "Neon-lit Tokyo alley at night, rain-soaked streets, glowing signs reflected in puddles" --sync
Completed in 4s
https://ppwvarkmpffljlqxkjux.supabase.co/storage/v1/.../output.jpg
At 5 credits per image, you can generate 200 images on the Starter plan. Image generation is a great way to prototype visual concepts before committing credits to a full video generation.
Understanding credits
Every generation costs credits. The amount depends on the model and, for video models, the duration. Here is a quick reference for default 5-second video generations and single image generations:
| Model | Credits | Approx. Cost |
|---|---|---|
| Kling 3.0 Pro (5s) | 187 | $0.50 |
| Veo 3.1 (8s) | 395 | $1.60 |
| Sora 2 Pro (5s) | 187 | $0.50 |
| Seedance 1.0 Pro (5s) | 104 | $0.28 |
| Flux 2 Pro (image) | 5 | $0.04 |
| Flux 2 Flex (image) | 9 | $0.07 |
| Grok Imagine (image) | 17 | $0.13 |
All models are included on every plan. No per-model charges, no separate subscriptions. You can mix and match freely across all 7 models.
What to do next
Now that you have generated your first video, here are some paths to explore:
- *Compare all 7 models — see real benchmarks with generation times, costs, and output samples for every model.
- *Build an automated Shorts pipeline — script batch video generation for YouTube Shorts and TikTok.
- *Turn images into video — learn how to animate still images with Kling and Seedance.
- *Add video generation to Claude Code — set up agent-media as an MCP server for AI-assisted development.
Ready to generate?
One install, one login, one command. Plans start at $19/mo with 1,000 credits.