gemini-api-cli
Skill4.4k starsChanged 6 days agoApache-2.0View on GitHub
Call the Gemini API from the shell with gemini-api. Use for media generation (images, TTS, music, video), file and YouTube analysis, audio/video transcription, Deep Research, and sandboxed agents.
- Pipes a download into a shell
- Reads credentials
2 other projects use a version of this, 2 of them edited.
How people change it
All 2 edited versions we compared keep every one of its 2 rules.
Of the 2 edited versions we compared: 2 keep every rule.
We split this file and each edited version into the rules they give an agent and match them by wording. A version that adds no rule of its own and has not changed since this file last did reads as an older text, so what it lacks is not counted as dropped. We keep no past texts of a file, so that is inferred, and an edited version that started from an older text still counts its gaps as drops.
Adopted by
Steady: 0 new projects took it in the last 4 weeks, none the 4 weeks before.thin data
Most recently taken up by
- kimkon1011/orgiast-claude-rulesedited, first seen Nov 29, 2026
- google-gemini/gemini-skillsedited, first seen Nov 8, 2026
Who's talking about google-gemini/gemini-api-cli
- AI market“【Gemini新ツール】Gemini API CLIで画像・動画・音楽も作れる”YouTube · Oct 24, 2026 · 11k views
- AI with Surya“Gemini API CLI + Claude Code: Give Your Agent Video, Voice & Music”YouTube · Oct 24, 2026 · 10k views
- AIex The AI Workbench“Google's New Gemini API CLI Works With ANY Model (Local M5 Ultra, Claude Code, Codex & OpenRouter)”YouTube · Nov 27, 2026 · 611 views
- AI活用伝道師 “Google新作「Gemini API CLI」でAIが画像も動画も音楽も作る!Claude Codeに任せたら25秒の動画ができた”YouTube · Oct 25, 2026 · 218 views
- Super Intelligence Spotlight“🔥 Google's Gemini API CLI Lets Coding Agents Generate Images, Video and Music #ainews”YouTube · Oct 22, 2026 · 130 views
The biggest 5 of 27 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 27
Talked about on YouTube, GitHub, Bluesky and Hacker News (27 times).
On YouTube · 14
- Oct 24, 2026【Gemini新ツール】Gemini API CLIで画像・動画・音楽も作れる — AI market11k views · 2 comments
- Oct 24, 2026Gemini API CLI + Claude Code: Give Your Agent Video, Voice & Music — AI with Surya10k views · 16 comments
- Nov 27, 2026Google's New Gemini API CLI Works With ANY Model (Local M5 Ultra, Claude Code, Codex & OpenRouter) — AIex The AI Workbench611 views · 2 comments
- Oct 25, 2026Google新作「Gemini API CLI」でAIが画像も動画も音楽も作る!Claude Codeに任せたら25秒の動画ができた — AI活用伝道師 218 views
- Oct 22, 2026🔥 Google's Gemini API CLI Lets Coding Agents Generate Images, Video and Music #ainews — Super Intelligence Spotlight130 views
9 more on YouTube
- Oct 23, 2026Gemini API CLI: Media Tools in Your Terminal — AI Pocket Report121 views
- Oct 26, 2026Gemini API CLI: How My Coding Agent Made a Real Ad — AI with Tech Dad104 views
- Oct 23, 2026Claude Codeから1行で画像・動画を作れる「Gemini API CLI」をGoogleが公開 — プリンの反抗期91 views
- Oct 28, 2026구글 AI Pro 구독자라면, Gemini API CLI로 그림 · 음성 · 영상까지 될까? — Bable88 views · 1 comment
- Nov 26, 2026Give any coding agent Gemini API superpowers in one Go CLI #Go #Gemini #GeminiAPI #AIAgents #Shorts — Nadeem Khan42 views
- Nov 17, 2026Gemini CLI vs Gemini API CLI: Which One Do You Need? — AI Under the Hood27 views
- Oct 25, 2026Gemini API CLI: Why Google Shipped a Binary, Not an Agent — ToolRack19 views
- Nov 26, 2026Gemini API CLI:从安装到第一次返回|普通话教程 — kcittsr11 views
- Nov 26, 2026Claude Code watch videos: use Gemini API in Claude Code — Fresh Out of Beta6 views · 1 comment
On GitHub · 9
- Nov 26, 2026gemini-api-cli 0.5.0 (new formula) — Homebrew/homebrew-core0 reactions · 2 comments
- Nov 26, 2026Implement provider-agnostic agent routing and cost governance — AI-Envision/software-dev-control-plane0 reactions
- Nov 25, 2026agy: execute_bash strips CA bundle, spec.env, GIT_ASKPASS, and AX_METADATA_URL — agentexecutor/images0 reactions
- Nov 24, 2026[Request]: Gemini API CLI — ScoopInstaller/Main0 reactions
- Oct 29, 2026feat(cli): use gemini-3.5-transcribe as default model for transcribe command — googleapis/java-genai0 reactions
4 more on GitHub
- Oct 29, 2026feat(cli): use gemini-3.5-transcribe as default model for transcribe command — googleapis/go-genai0 reactions
- Oct 29, 2026feat(cli): use gemini-3.5-transcribe as default model for transcribe command — googleapis/js-genai0 reactions
- Oct 29, 2026feat(cli): use gemini-3.5-transcribe as default model for transcribe command — googleapis/python-genai0 reactions
- Oct 25, 2026X hype 2026-10-26: add 5 trending tools (137→142) — amanbehumble-create/toolhype0 reactions · 1 comment
On Bluesky · 3
- Nov 29, 2026Google released an official CLI, gemini-api: agents like Muse and Codex can now call Gemini from the shell — hand it a long PDF or a… — @tameshigachi.bsky.social1 likes and repost
- Nov 23, 2026GitHub - google-gemini/gemini-api-cli: An (experimental) CLI for the Gemini API https://github.com/google-gemini/gemini-api-cli — @tech-trending.bsky.social1 likes and repost
- Nov 10, 2026シェル環境やAIエージェントからGemini APIを手軽に叩けるコマンドラインツールっぽい ターミナルでの作業効率がかなり上がりそうかも yug1224 starred google-gemini/gemini-api-cli… — @yug1224.com1 likes and repost · 1 reply
On Hacker News · 1
- Oct 23, 2026Gemini-API-CLI: An (experimental) CLI for the Gemini API1 point
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 2
- google-gemini/gemini-skills★ 4.8k98% same
- kimkon1011/orgiast-claude-rules★ 090% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 34
Run gemini-api --help to list commands, or <subcommand> --help for flags and examples (--usage dumps a 45 KB KDL spec, so stick to --help …
- Very specific: line 50
Model selection: use gemini-3.8-flash (default), gemini-4-carbon (hard reasoning and coding), or gemini-3.5-flash-lite (high throughput).
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
The gemini-api CLI exposes every Gemini API resource as a shell subcommand. Compared to curl: media and transcription commands decode output to disk and print only the file path, -i attaches local files or files/<id> URIs, --jq extracts fields in-process (raw strings by default, no external jq), --dry-run previews redacted HTTP requests offline, and list endpoints auto-paginate with --all (cap pages with --max-pages N; --page-size sets server page size).
CLI vs SDK
CLI for shell work, SDK for application code. Use gemini-api from terminals, scripts, and CI jobs to generate media files, analyze local PDFs or recordings, run Deep Research, and manage agent sandboxes (gemini-api is a stateless Gemini API client, distinct from the interactive @google/gemini-cli coding agent). Use the Google GenAI SDKs (gemini-api-dev, gemini-live-api-dev) when calls live inside application source or need bidirectional Live API WebSockets.
Install and auth
# macOS / Linux (set GEMINI_VERSION=<tag> to pin a release)
curl -fsSL https://raw.githubusercontent.com/google-gemini/gemini-api-cli/main/scripts/install.sh | bashCredentials resolve in order (first match wins): --api-key / --access-token flags, GEMINI_API_KEY / GEMINI_ACCESS_TOKEN env vars, the OS keychain, then ~/.config/gemini-api/config.yaml.
- Env var (agents and CI):
export GEMINI_API_KEY="..." - Workstation key:
gemini-api configure --api-key "..."saves to the OS keychain. Pass--no-keyringorGEMINI_NO_KEYRING=1on headless Linux to useconfig.yaml;gemini-api auth logoutclears stored keys. - Active auth check:
gemini-api whoami(add-o jsonfor JSON) prints masked credentials and the winning source.
The #1 auth trap: an exported
GEMINI_API_KEYoverrides credentials stored in the keychain orconfig.yaml, billing whichever project that env var belongs to. Checkgemini-api whoamito see which source won, or runenv -u GEMINI_API_KEY gemini-api ...to ignore the env var.
Command structure
gemini-api <intent> [prompt] [flags] # task commands with model and modality presets
gemini-api <resource> <action> [flags] # REST resource groupsRun gemini-api --help to list commands, or <subcommand> --help for flags and examples (--usage dumps a 45 KB KDL spec, so stick to --help to save context).
| Command | Key flags / actions | Default model & behavior |
generate [prompt] | -m, -i, --stdin, --system, --previous-interaction-id, --stream=false, --body | gemini-3.8-flash; streams text deltas to stdout |
image [prompt] | -m, -i, --aspect-ratio, --image-size (512..4K), --previous-interaction-id, --out, --body | gemini-nano-banana-2.1; writes image, prints path |
tts [text] | -m, -f, --stdin, -v/--voice (default Kore), --multi-speaker, --language, --out | gemini-3.8-flash-tts; writes 24 kHz WAV, prints path (unstored) |
music [prompt] | -m, -f, --stdin, --out, --body | lyria-3.5; writes audio track, prints path |
video [prompt] | -m, -i, --aspect-ratio, --resolution (360p..4k), --previous-interaction-id, --async, --resume, --out, --body | pass -m gemini-omni-1.2-flash (≤ v0.4.5 preset defaults to gemini-omni-1.1-flash); polls until done, writes MP4, prints path (upscale via --body) |
analyze [question] | -i (required, repeatable), --stdin, --system, -m | gemini-3.8-flash; answers over PDFs, media, CSV/text, YouTube URLs (unstored) |
transcribe | -m, -i (required, repeatable), --format (md, text, json, srt), --no-speakers, --no-timestamps, --out | gemini-3.5-transcribe (audio; 30m speaker/timestamp cap) or gemini-3.8-flash (video); writes --out (or ./transcript-*), prints path (unstored) |
agent | run, status, cancel, delete-interaction; create, list, get, delete | Runs models or managed agents; manages custom agent definitions |
files | upload [--wait], list, get, generated-files-list, register, delete | Uploads reusable files/<id> URIs (48h TTL; up to 2 GB, 50 MB PDFs) |
models | (bare), list [--all], get <id> | Bare models prints an offline catalog; list and get query the live API |
environments | create, list, get, delete, files (list, upload, download), connect, poll, serve | Remote sandboxes and workspace snapshots (credentials, webhooks, triggers for agent infra) |
Model selection: use gemini-3.8-flash (default), gemini-4-carbon (hard reasoning and coding), or gemini-3.5-flash-lite (high throughput); for images, gemini-nano-banana-2.1, gemini-3.1-flash-lite-image, or gemini-3-pro-image; for video, gemini-omni-1.2-flash. Avoid deprecated gemini-2.5-*, gemini-2.0-*, and gemini-1.5-* models.
Global flags
| Flag | Purpose |
-o, --output-format | pretty (default), json, toon, yaml, table |
-q, --jq | Filter JSON output with a built-in jq expression (--raw-output is true by default) |
--agent-mode | Compact TOON on stdout and structured JSON errors on stderr |
--no-interactive | Disable prompts, TUI forms, and explore |
--dry-run | Validate inputs and preview redacted HTTP requests offline (human preview on stderr; -o json or --jq writes JSON to stdout) |
-d, --debug | Log HTTP request and response details to stderr |
Exit codes: 0 ok, 1 runtime or API error (video polling, image/music, tts, transcribe, and analyze also exit 1 on failed/incomplete runs; generate, agent run, and agent status exit 0 and report state in .status), 2 usage or validation error, 3 auth error. See gemini-api --help-global for --server-url and auth flags; pagination flags (--all/-a, --max-pages, --page-size, --page-token) live on <resource> list --help.
Output
Media (image, tts, music, video) and transcribe write files locally and print only the file path on stdout (--out on media commands rewrites the file extension to match the returned MIME type, e.g. .png for default image unless --body '{"response_format": {"mime_type": "image/jpeg"}}' is passed). Adding -o json still writes the file and prints metadata: {kind, path, size_bytes, mime_type, response_id, status} on image/music/video, {model, path, mime_type, size_bytes, sample_rate, channels} on tts, and {model, format, results: [{input, path, size_bytes, model, mime_type}]} on transcribe.
Streaming and JSON shape: generate and agent run stream plain reply text by default, so -o json alone emits {"data": ...} NDJSON SSE events. Pass --stream=false -o json for one JSON object {id, status, steps, usage} (bare --stream=false prints aligned key: value metadata; --background on agent run disables streaming, and --jq disables streaming unless -o or GEMINI_OUTPUT_FORMAT is set, so omit -o json or add --stream=false when filtering a full response with --jq). Reply text lives under .steps[] model_output (see agent status below) rather than .candidates[]. On paginated list commands, --jq runs per page envelope (.models[]?.name, .agents[]?.id).
Input
-i/--inputattaches media and documents ongenerate,image,video,analyze,transcribe, andagent run(repeatable). Accepts local paths up to ~14 MB (20 MB base64 cap),files/<id>URIs, or YouTube URLs (not supported ontranscribe). Upload larger or reused files once withgemini-api files upload <path> --wait.-f/--filereads prompt text from a file onttsandmusic. Piped text needs--stdin: when piping plain text intogenerate,image,music, orvideo, pass--stdinor piped input gets parsed as a JSON--body;analyzeandttsignore piped stdin unless--stdinis set (agent runhas no--stdin, so piped stdin is always JSON--body).--bodypasses raw Gemini API JSON inline, from@file.json, or via@-(merges with flags; exits 2 on duplicate keys). Use it forresponse_formatschemas,tools(google_search,code_execution,url_context, function declarations),generation_config,environment, orstore.- Don't dump
--schemaraw: it prints ~92 KB of minified JSON and exits before--jqruns. Pipe it tojq:gemini-api generate --schema | jq '."$defs".ModelInteraction.properties | keys'
Media, analysis, and transcription
HERO=$(gemini-api image "Isometric cloud database icon" --aspect-ratio 16:9 --image-size 2K \
--body '{"response_format": {"mime_type": "image/jpeg"}}' --out ./hero.jpg)
gemini-api image "Add warm sunset lighting" -i "$HERO" \
--body '{"response_format": {"mime_type": "image/jpeg"}}' --out ./hero-sunset.jpg
gemini-api tts "Alice: Ready to ship? Bob: Checks are green." \
--multi-speaker "Alice=Kore,Bob=Puck" --out ./dialogue.wav
VID_ID=$(gemini-api video "Aerial coastal cliffs at sunrise" -m gemini-omni-1.2-flash --aspect-ratio 16:9 --resolution 1080p --async)
gemini-api video --resume "$VID_ID" --out ./cliffs.mp4
FILE_URI=$(gemini-api files upload ./call.mp4 --wait) # prints files/<id>
gemini-api analyze -i "$FILE_URI" "List action items with owners and timestamps."
gemini-api transcribe -i "$FILE_URI" --format srt --out ./call.srtManaged agents and sandboxes
deep-research-preview-04-2026anddeep-research-max-preview-04-2026: run with--backgroundand pollagent status.antigravity-preview-09-2026(Linux sandbox with Bash, Python, Node, file ops, and web search): pass"environment": "remote"(new sandbox),"environment": "<env_id>"(existing sandbox), or"environment": {"type": "remote", ...}in--body(top-levelenvironment_idis output-only and exits 2).
ID boundary: agent status, agent cancel, and agent delete-interaction take a run ID (v1_...). agent create, agent get, agent list, and agent delete manage custom agents only (built-in agent IDs are listed in gemini-api agent run --help and live gemini-api models list, not the offline gemini-api models catalog; cap agent list and environments list with --page-size 10).
RUN_ID=$(gemini-api agent run "Compare WebRTC SFU architectures with primary sources." \
--agent deep-research-preview-04-2026 --background --jq '.id')
gemini-api agent status "$RUN_ID" --jq '.status' # queued | in_progress | requires_action | requires_continuation | completed | failed | cancelled | incomplete | budget_exceeded (exits 0)
gemini-api agent status "$RUN_ID" \
--jq '[.steps[]? | select(.type=="model_output") | .content[]? | select(.type=="text") | .text] | join("")'
ENV_ID=$(gemini-api agent run "Benchmark radix sort vs timsort in Python and write results.csv." \
--agent antigravity-preview-09-2026 --body '{"environment": "remote"}' --jq '.environment_id')
gemini-api environments files list -e "$ENV_ID" -r
gemini-api environments files download "$ENV_ID" results.csv --out ./results.csv
gemini-api agent create --id code-reviewer --base-agent antigravity-preview-09-2026 \
--system-instruction "Review diffs for race conditions and auth bugs."Multi-turn and structured output
Calls store state server-side by default (store is true), so multi-turn chains only need --previous-interaction-id (system_instruction, tools, and generation_config apply per turn; setting store to false disables previous_interaction_id and background):
TURN1=$(gemini-api generate "Propose 2 indexing strategies for time-series logs." --jq '.id')
gemini-api generate "Compare them for write-heavy workloads." --previous-interaction-id "$TURN1"Combine --stdin with --body for schema-constrained JSON output:
cat build.log | gemini-api generate "Extract unique compiler errors." --stdin --body '{
"response_format": {
"type": "text", "mime_type": "application/json",
"schema": {"type": "object", "properties": {"errors": {"type": "array", "items": {"type": "string"}}}, "required": ["errors"]}
},
"store": false
}'Full CLI reference: aistudio.google.com/docs/cli.md; docs index: llms.txt.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

