@vesely/ai-gateway-cli
v0.2.0
Published
Tiny CLI for generating text and images via the Vercel AI Gateway. One key, hundreds of models.
Maintainers
Readme
ai-gateway
A tiny CLI for generating text, images, and video via the Vercel AI Gateway. One key, hundreds of models, no code required.
ai-gateway "explain quicksort in 3 bullets"
ai-gateway image "a red fox in a snowy forest" -o fox.png
ai-gateway video "a wave crashing on rocks at sunset" --duration 5
cat README.md | ai-gateway "summarize this"Install
Requires Node 20+.
npm install -g @vesely/ai-gateway-cliOr with another package manager:
pnpm add -g @vesely/ai-gateway-cli
bun add -g @vesely/ai-gateway-cliFirst run
Get an API key from https://vercel.com/ai-gateway and either:
- Run any command — you'll be prompted to paste it (saved to
~/.config/@vesely/ai-gateway-cli/config.json, chmod 600), or - Export it:
export AI_GATEWAY_API_KEY=..., or - Run
ai-gateway config set key sk_...
Commands
| Command | What it does |
| --- | --- |
| ai-gateway "<prompt>" | Streamed text completion (default command). |
| ai-gateway image "<prompt>" | Generate an image, save to disk. |
| ai-gateway video "<prompt>" | Generate a video, save to disk. Takes minutes. |
| ai-gateway models | List all available models with prices. |
| ai-gateway config | Show current config. |
| ai-gateway config set <key> <value> | Set key, text-model, image-model, or video-model. |
Defaults
Picked for the best price/quality ratio:
- Text:
xai/grok-4.1-fast-non-reasoning - Image:
google/imagen-4.0-fast-generate-001 - Video:
xai/grok-imagine-video
Override per-call with -m <model-id>, or persist with ai-gateway config set text-model openai/gpt-5.4.
Examples
# Text with a different model
ai-gateway -m anthropic/claude-opus-4.6 "draft a tweet about CLIs"
# Pipe context in
git diff | ai-gateway "write a commit message for this diff"
# Get raw JSON (no streaming)
ai-gateway --json "hello" | jq .text
# Image with a specific output path
ai-gateway image -m bfl/flux-2-pro -o cover.png "a minimalist mountain logo"
# Multiple images
ai-gateway image -n 4 "abstract wallpaper, blue and gold"
# Multimodal LLMs that generate images (Nano Banana, Gemini 3 Pro Image, GPT-5 image)
ai-gateway image -m google/gemini-2.5-flash-image "a hedgehog wearing a tiny hat"
ai-gateway image -m google/gemini-3-pro-image -o cover.png "minimalist mountain logo"
# Browse models
ai-gateway models --type image
ai-gateway models --search claude
ai-gateway models --json | jq '.[] | select(.type=="language") | .id'
# Video (multi-minute job, shows a spinner)
ai-gateway video "a wave crashing on rocks at sunset" --duration 5
ai-gateway video -m google/veo-3.1-fast-generate-001 --aspect 9:16 --resolution 1080p \
-o vertical.mp4 "a hummingbird at a flower, slow motion"
ai-gateway video --json --duration 5 "a tiny ripple in water"Video generation requires a minimum $10 balance on your AI Gateway account.
Claude Code skill
There's a companion Claude Code skill that lets any agent in your terminal use this CLI to generate text or images. Install it with:
npx skills@latest add Vesely/skills/ai-gatewaySource: https://github.com/Vesely/skills/tree/main/ai-gateway.
Key resolution order
--key <value>flagAI_GATEWAY_API_KEYenv var~/.config/@vesely/ai-gateway-cli/config.json- Interactive prompt (TTY only)
