DEV Community

David Veselý
David Veselý

Posted on

Generate Images and Videos From Claude Code for Free

One API key, hundreds of models, $5 a month free, enough for plenty of images.

Hero images for landing pages, screenshots for app docs, short clips for social. There's always something to generate. None of it is heavy work, but every job used to mean tabbing out of Claude Code. I'd rather not.

Vercel's AI Gateway already solves the model side. One API key gets you a long catalog of models with no token markup. The missing piece was a CLI for terminal-driven workflows. Vercel shipped that recently as ai-cli, with a Claude Code skill alongside it.

What it does

ai is a thin CLI around the Vercel AI Gateway endpoints. Three commands cover most of it:

ai text "explain quicksort in three bullets"
ai image "a minimalist mountain logo" -o cover.png
ai video "a wave crashing on rocks at sunset" --duration 5
Enter fullscreen mode Exit fullscreen mode

Text streams to stdout. Images and videos save to disk; videos take a few minutes per job.

The companion Claude Code skill is the part that matters more day-to-day:

npx skills add https://github.com/vercel-labs/ai-cli --skill ai-cli
Enter fullscreen mode Exit fullscreen mode

Once that's installed, Claude reaches for the CLI automatically when I ask for an image or a clip in plain English. I don't have to remember the command syntax or the model id. Claude picks the model and tells me where the file landed.

Setup, end to end

Five minutes from zero to a working ai command.

1. Create a Vercel account

If you don't have one already, sign up at vercel.com/signup. The free Hobby plan is enough. AI Gateway works on every tier and the $5 monthly credit applies to free accounts too.

2. Get an AI Gateway API key

Open the AI Gateway API Keys page in your Vercel dashboard. Click Create Key, give it a name (e.g. ai-cli), and copy the value that starts with vck_. You only see the full key once, so paste it somewhere safe before closing the modal.

3. Install the CLI

npm install -g ai-cli
Enter fullscreen mode Exit fullscreen mode

pnpm add -g ai-cli and bun add -g ai-cli work too. Source: github.com/vercel-labs/ai-cli.

4. Export your key

export AI_GATEWAY_API_KEY=vck_your_key_here
Enter fullscreen mode Exit fullscreen mode

Add it to ~/.zshrc or ~/.bashrc so it survives a new shell. The CLI is env-var-only by design, no config file and no login flow.

If you're already inside a Vercel-linked project, you can skip the static key entirely — npx vercel link followed by vc env pull fetches a short-lived OIDC token into .env.local, and the CLI picks it up automatically.

5. Add the Claude Code skill

npx skills add https://github.com/vercel-labs/ai-cli --skill ai-cli
Enter fullscreen mode Exit fullscreen mode

This is the piece that lets Claude Code reach for ai automatically when you ask for an image or video in plain English. Without it the CLI still works. You just have to call it directly instead of describing what you want.

That's it. Open Claude Code and try one of the prompts below.

Real prompts I run

Drop these straight into Claude Code. The skill routes them to ai under the hood.

1. Hero image for a landing page

Use /ai-cli to generate a wide hero image for a developer-tools landing page — an abstract topographic map of overlapping data layers, deep navy with thin teal contour lines, photorealistic editorial style. Save as public/hero.png.

GPT-Image-2 is the default and handles this in seconds. Drop it into public/, reference it from your hero section, ship.

2. Logo or poster with text inside the image

Use /ai-cli with openai/gpt-image-2 to generate a minimalist logo for "Envelope.so" — serif wordmark on parchment, terracotta accent dot. Save as logo.png.

GPT-Image-2 is the one I reach for when the image has to render text correctly. Imagen and Flux still mangle longer words.

3. Four OG card backgrounds for a blog post

Use /ai-cli to generate four open-graph background variations (1200x630) for a blog post titled "We migrated 100M rows in an afternoon" — bold editorial composition, dark background, terracotta accent shapes, leave the top-left clear for a title overlay. Save them in og/.

The CLI auto-suffixes the filenames so you get og-1.png through og-4.png. I overlay the post title in code at build time, so the model only has to generate a clean background. Cheap iteration loop when nothing in the first batch is right.

4. Sharpest quality, specific model

Use /ai-cli with bfl/flux-2-pro to generate a cover image for a Medium article on AI tooling — a stylized 3D rendering of stacked translucent terminal panes floating in space, soft volumetric light, editorial composition. Save as output/cover.png.

When the image is going on Medium and I want it to actually look professional, Flux-2-Pro is worth the extra cents.

5. Same prompt, three models in one command

Use /ai-cli with -m "openai/gpt-image-2,bfl/flux-2-pro,xai/grok-imagine-image" to generate the same section banner: an abstract editorial pattern of overlapping circles in deep navy and terracotta, soft volumetric light, no text. Save them in compare/ and open all three so I can pick.

Comma-separated -m is built in. The CLI runs all three in parallel and the slowest one is the bottleneck. A few cents to A/B three aesthetics is the easiest way to decide which model deserves a longer batch — useful when I'm about to render twenty assets in the same style.

6. Pipeline: image straight into video

Use /ai-cli to generate a still of a stylized 3D dashboard mockup — flat dark UI with brand-colored chart shapes, then pipe it into ai video to add a slow camera drift across the surface, 4 seconds. Save the video as marketing/dashboard-pan.mp4.

ai image "..." | ai video "..." is a native pattern. The image streams as raw binary and the video command picks it up as a reference frame. Cleaner than saving an intermediate file and re-loading it, and exactly the move I reach for when I need a quick marketing clip from a static asset.

7. Short social-media video

Use /ai-cli to generate a 5-second vertical clip (9:16, 720p) for a product launch teaser — minimalist liquid-metal animation morphing into a logo silhouette, dark background, clean editorial style. Save as social/launch-teaser.mp4.

This one needs the $10 top-up. Default Seedance 2.0 handles motion well and can render audio; switch to bytedance/seedance-2.0-fast for the cheaper variant or google/veo-3.1-fast-generate-001 for higher fidelity. See the pricing section below for the catch.

8. Browse what's available

Use /ai-cli to list every image model with its current rate, sorted by price.

The skill knows to call ai models --type image. Useful before a batch job to confirm the catalog hasn't changed.

The model lineup

Defaults are picked for price-to-quality, not for headlines. Text goes to openai/gpt-5.5. Image goes to openai/gpt-image-2. Video goes to bytedance/seedance-2.0.

Override with -m when the job calls for it. I reach for bfl/flux-2-pro when the image needs to be sharper than gpt-image-2 handles, and google/imagen-4.0-fast-generate-001 (Imagen 4 Fast) for cheap iteration. For video, Seedance 2.0 already produces clean motion and supports audio; google/veo-3.1-fast-generate-001 is the premium option when the budget allows.

ai models --type image lists every image model with its current rate. Same for --type video and --type text. Pricing comes straight from Vercel.

What "free" actually means

Per the AI Gateway pricing docs, every Vercel team account, Hobby plans included, gets $5 of AI Gateway credits per month. A gpt-image-2 render costs a few cents. A flux-2-pro run is more. You can do real work inside that $5 envelope before the meter starts ticking.

Video is the catch. Vercel requires a $10 minimum top-up to unlock video generation, and per the pricing docs, once you purchase any credits your account transitions to the paid tier and the monthly $5 free credit no longer applies. So topping up for Veo or Seedance also costs you the free image budget. For an image-only workflow on the free tier the line is simple. Want video, and the math flips.

For me that's fine. Most days I'm in image-only territory and the bill is zero. When I need a clip I pay for it like any other API.

Run ai models --type image (or --type video) for live per-token rates straight from Vercel; pricing changes often enough that I don't quote specific cents in writing.

Why this beats tab-switching

The image lands in the repo, ready to commit. No web-app round trip, no download-and-rename dance.

One billing surface is the other underrated win. Want to try Veo? Normally you'd spin up a Google Cloud project with billing enabled. Want Flux? BFL account, separate card. Want gpt-image-2? OpenAI billing. Vercel sits in front of all of them, so the credit card lives in exactly one place. Monthly spend is in one dashboard, the budget cap is in one dashboard, and revoking the key kills every model at once.

And when a new model ships, Vercel adds it to the catalog and the CLI picks it up.


I also wrote about running any agent skill once without installing it. Same one-shot-tooling instinct, different layer.

Top comments (0)