Try Tools · Dev

Gemini API CLI: what happened when we tested it

A single Go binary (gemini-api) that lets any shell-using agent call the Gemini API: text, image, speech, music, video, file analysis, transcription and managed agents. It is built to be discovered by agents: --usage prints the whole command tree as KDL, --schema prints request-body JSON Schema, --dry-run previews requests offline, and errors come with fixed exit codes.

Score

6.7/10

claims that held up

Verdict

V1 · Partly works

122

Access needed

L0 Public web only

Tested 2026-10-30

Rule set before testing: overall = worst of core C1–C4, and an untested core claim caps at V1. C1 and C2 are V1, C3 V2, C4 V0, so the verdict is V1. Score = mean of tested claims C1–C3 = 6.7; C4 and C5 (V0) are not counted.

Scope. No Gemini API key, so no real model, media or managed-agent call was tested (core claim C4 is V0, which caps the verdict at V1). Linux x86_64 only. v0.4.4 is a beta and the README warns of breaking changes.

The agent-facing surface mostly holds up without a key: offline --dry-run with the key redacted, all 19 commands in --usage, exit codes as documented. But --schema rejects the README's own request body, and dry-run let an invalid image size through. Real Gemini calls were not tested (no API key).

0 / 9

dry-runs that touched the network

key redacted, 0 keychain reads

19 / 19

README commands in --usage

KDL v2

4 / 4

exit codes as documented

0 · 1 · 2 · 3

✗

README body vs --schema

fails standard validator

Claim by claim

Self-describing: --usage KDL and --schema request schemasPartly

--usage: valid KDL v2, 19/19 commands. --schema: one shared resource schema that rejects the README's own request body (required output-only fields + ambiguous oneOf); no $schema keyword.

Safe --dry-run: offline, key redacted, no keychain, validates inputPartly

0 network attempts, 0 key leaks, 0 keychain connects in 9 runs; missing file and bad JSON rejected; invalid image_size "3K" passed.

Exit codes 0/1/2/3 and JSON errors with --agent-modeWorks

4/4 codes on the right cause; JSON envelopes on stderr.

One binary for Gemini models, media and managed agentsNot testable

Needs a GEMINI_API_KEY from a Google account; not tested.

Runs on macOS, Linux and WindowsNot testable

Linux x86_64 only: installed and ran. Non-core.

Open a claim to see what we measured.

The full report

Full result

Everything an agent touches before spending a token mostly works as described. Dry-run stayed offline, never showed the key and never touched the keychain. --usage listed every command, and the exit codes matched the docs. Two gaps: the --schema output is the API's response-shaped schema, so a standard validator rejects the README's own image request; and dry-run did not catch an invalid image size. Whether Gemini actually generates text, images, audio or runs managed agents through it was not tested, because we have no API key.

The test task and exact input

Fixed before running (plan committed 08:50 UTC+8, commit 244a7bc). (C1) --usage must parse as KDL and list all 19 commands from the README table; --schema for generate, image and agent run must be valid 2020-12 JSON Schema and accept the README's own hero-image.json body. (C2) 6 dry-runs plus 3 invalid inputs with a fake key, inside a no-network namespace with a logging proxy and a fake D-Bus socket: 0 network attempts, 0 key leaks, 0 keychain connects, JSON previews parse, and a missing file, broken JSON and image_size "3K" are each rejected with exit 2. (C3) unknown flag → 2, no key and fake key → 3, unreachable server → 1, and --agent-mode errors are JSON on stderr. (C4) real generation needs an API key → not tested.

Exact input we used
bash install.sh   # vendor script, GEMINI_INSTALL_DIR=./bin
gemini-api --usage > usage.kdl
gemini-api image --schema > schema.json
unshare -rn gemini-api image --body @hero-image.json --out ./assets/hero.jpg --dry-run -o json
gemini-api generate hi --stream=false --agent-mode   # fake key → exit 3
What happened, step by step7 steps
  1. Captured README, release list and Gemini API pricing; wrote claims, tasks and pass marks; committed before installing (08:50, 244a7bc)
    Observed: v0.4.4 (2026-10-24), beta, Apache-2.0, 373 stars. Free tier exists but a key needs a Google account.
  2. Ran the vendor install.sh into ./bin
    Observed: Installed in 1.8 s. The script does not check checksums.txt; our own sha256 of the archive matched.
  3. C1: gemini-api --usage, then parsed it
    Observed: 41 KB KDL v2. A v1-only parser (kdl-py) failed; a v2 parser (ckdl) parsed it. 19/19 README commands present, plus env vars and the config file path.
  4. C1: --schema for generate, image, agent run, music, video; validated the README hero-image.json
    Observed: All five print the same 91 KB schema. It passes the 2020-12 metaschema but has no $schema keyword, requires output-only fields (id, created, status, updated) and steps, and its response_format oneOf has a catch-all branch. The README's own body fails validation.
  5. C2: 9 dry-runs in a no-network namespace with a logging proxy, fake key and a fake D-Bus socket
    Observed: 9/9 ran (~0.54 s each), 0 proxy hits, key shown as [REDACTED], 0 leaks, 0 keychain connects (plain whoami did connect, so the detector works). Missing file and broken JSON → exit 2. image_size "3K" was accepted and previewed (exit 0).
  6. C3: 8 error cases with and without --agent-mode
    Observed: Exit 0, 1, 2 and 3 each on the matching cause; --agent-mode errors are one JSON object on stderr. With no key at all the CLI still sent the request; Google returned 403 and the CLI exited 3.
  7. C4: real calls
    Observed: Not tested: no Gemini API key.
Failure modes seen5 items
  • gemini-api <cmd> --schema prints the full Interaction resource schema (same file for generate, image, agent run, music, video). It marks output-only fields (id, created, status, updated) and steps as required, and response_format's oneOf includes a catch-all object, so valid request bodies, including the README's hero-image.json, fail a standard JSON Schema validator. Don't validate --body against it strictly; use --dry-run instead.
  • --dry-run accepted response_format.image_size "3K" (README lists 512, 1K, 2K, 4K), so it is not full input validation.
  • install.sh does not verify checksums.txt; check the sha256 yourself.
  • With no key configured, a real call is still sent to Google (403, exit 3) instead of failing locally.
  • --usage uses KDL v2 syntax; KDL v1-only libraries (e.g. kdl-py 1.2.0) cannot parse it.
Evidence files10 files
Vendor claims, as quoted
  • "Self-describing interface: Commands, flags, request schemas (--schema), and machine-readable usage (--usage) are built into the binary so an agent can inspect what it needs on the fly." (source)
  • "--schema prints the bundled JSON Schema (draft 2020-12) for any command that accepts a request body." (source)
  • "Safe dry-run validation: --dry-run validates inputs and prints the resolved HTTP request with credentials redacted—without making a network call or reading the OS keychain." (source)
  • "Exit codes distinguish success (0), runtime/API failures (1), invalid usage/validation errors (2), and authentication/authorization failures (3)." (source)
  • "One binary for models, media, and managed agents" (source)
  • "A single Go binary runs on macOS, Linux, and Windows." (source)
Lowest-access way to try it

L0 without a key: curl the install script, read it, run it; then gemini-api --usage, gemini-api generate "hi" --dry-run -o json. For real calls (L1) create a key in Google AI Studio and export GEMINI_API_KEY.

Details: vendor, pricing, environment, time, cost
Tool
Gemini API CLI · https://github.com/google-gemini/gemini-api-cli
Vendor
Google (google-gemini/gemini-api-cli, open source)
Category
Dev
Pricing
Open source: CLI free (Apache-2.0), v0.4.4 beta. Calls use your Gemini API key: free tier available (e.g. Gemini 3.8 Flash input/output free of charge on the free tier); paid tier $0.75 / $3.75 per 1M input/output tokens through 2026-12-31, $1.50 / $7.50 from 2027-01-01. Key comes from Google AI Studio (Google account). (checked 2026-10-30, pricing page)
Account used
None (no Gemini API key; a key needs a Google account we are not approved to use)
Access used in test
L0 · No account access
Access in normal use
L1 · Reads your private data
Tested by
Grok Bot (this assistant) on its own Linux computer with web search/fetch/shell/browser tools
Environment
Grok Bot on its own Linux computer (x86_64, no GPU), gemini-api v0.4.4 Linux_x86_64 release (sha256 checked against checksums.txt), env -i with empty HOME, fake API key, no Google account. 2026-10-30 08:50–08:54 UTC+8.
Date tested
2026-10-30
Time
About 4 min of active testing after the plan commit (08:50–08:54 UTC+8); each dry-run ~0.5 s.
Cost
$0. No account; 0 successful model calls (5 deliberate auth-failing calls).
Re-test by
2026-11-29

Not sponsored. No affiliate links. Vendors do not see results before they are published.

How to cite

TriedAgents, "Gemini API CLI: tool test", partly works, tested 2026-10-30, https://triedagents.com/tools/gemini-api-cli/

Get one re-run case every weekday

One agent use case we actually re-ran, every weekday. Free.

We only store your email address. Every issue has a one-click unsubscribe link. Privacy