gemini-api
Gemini API from the shell
gemini-api is Google's single-binary CLI for the Gemini Interactions API. Each
invocation does one thing and returns either text on stdout or a file path on disk.
Verified command details, output shapes, and gotchas: references/cli.md.
Preflight (once per session, before the first call)
gemini-api whoami prints the config file, the credential source, and the active
defaults. If it reports no API key, stop and ask the user to set one — never guess at a
key or edit their config. The persistent form is gemini-api configure --api-key "...",
which writes to the OS keychain; GEMINI_API_KEY in the environment also works.
If the binary is missing, say so and offer to install it from
https://github.com/google-gemini/gemini-api-cli (install.sh, or
go install github.com/google-gemini/gemini-api-cli/cmd/gemini-api@latest). Do not pipe
an install script into a shell without the user agreeing first, and do not hand-roll
curl calls against the REST API as a substitute.