Gemini CLI
Use the Gemini CLI through AnyAgent: what you can ask for, how it behaves, and the flags underneath.
The gemini-cli adapter drives the Gemini CLI over its ACP endpoint, detected as the gemini binary on PATH; import geminiCli from anyagent-js/gemini-cli.
What you can ask for
model rides the endpoint's own flag; readOnly, systemPrompt, and schema are provided by AnyAgent. effort, mcp, and resume are undeclared and throw. models() lists the documented vocabulary — aliases (pro, flash) and full ids — as a probed hint. authStatus() is a heuristic over ~/.gemini/oauth_creds.json, GEMINI_API_KEY/GOOGLE_API_KEY, and ~/.gemini/settings.json; a selected auth type with no visible key answers "unknown", since keys can live in the OS keychain. The full grid is on the support matrix.
Good to know
Pin a model. Automatic routing can spend minutes self-investigating a trivial prompt, so never leave model unset expecting a sane default.
- A session always starts fresh: reattaching is broken upstream, so
agent.session({ resume })throws. - Token usage arrives on the endpoint's own
_meta.quotachannel and lands onusage.inputTokens/outputTokens; per-model attribution stays on the resultraw.
Under the hood
Every session launches gemini --acp --skip-trust and talks the Agent Client Protocol to it; the prompt travels as a content block. Run options map onto the endpoint like this:
| Option | What it becomes |
|---|---|
model | -m <name> on the endpoint's argv, in the Gemini CLI's own vocabulary |
cwd | the cwd of the new session |
readOnly: true | a denial of every permission request for a tool that could change the machine |