# gemini-api-cli: Give Shell Agents Access to the Gemini API

This repository profile is provided by osrepos.com, an open source repository discovery platform.

Source: osrepos.com
Repository profile: https://osrepos.com/repo/google-gemini-gemini-api-cli
Generated for open source discovery and AI-assisted research.

Google’s Gemini API CLI lets shell-based coding agents and scripts use Gemini models and managed agents for generation, media, and file analysis. It is a stateless Go binary for macOS, Linux, and Windows, with machine-readable commands and dry-run validation.

GitHub: https://github.com/google-gemini/gemini-api-cli
OSRepos URL: https://osrepos.com/repo/google-gemini-gemini-api-cli

## Summary

Google’s Gemini API CLI lets shell-based coding agents and scripts use Gemini models and managed agents for generation, media, and file analysis. It is a stateless Go binary for macOS, Linux, and Windows, with machine-readable commands and dry-run validation.

## Topics

- go
- cli
- ai-agents
- generative-ai
- gemini-api
- media-generation
- managed-agents

## Repository Information

Last analyzed by OSRepos: Thu Dec 03 2026 04:11:27 GMT+0000 (Coordinated Universal Time)
Detail views: 2
GitHub clicks: 0

## Safety Notice

OSRepos shares public repositories for knowledge and discovery only. Review source code, dependencies, licenses, and security implications before running or installing anything.

## Content

## Overview

`gemini-api` is a Go CLI built around Google’s Gemini API. It gives shell-based coding agents, assistants, scripts, and CI jobs access to Gemini models and managed agents, so they can generate text and media, analyze files, or delegate longer-running tasks without embedding API calls in the host application. It runs as a single binary on macOS, Linux, and Windows.

The CLI is stateless: the calling agent supplies context and keeps any interaction IDs it wants to reuse. Its built-in command discovery, request schemas, structured output, and dry-run mode are intended to make it usable by agents as well as people at a terminal.

## Key Features

- Generate text and reasoning responses, images, speech, music, and video through Gemini API commands.
- Analyze documents and media, including PDFs, images, audio, video, CSV and text files, and YouTube URLs.
- Start, check, and cancel managed-agent interactions, including background runs that return an interaction ID.
- Inspect commands, flags, and request schemas from the binary with `--usage`, `--help`, and `--schema`.
- Validate requests offline with `--dry-run`, which previews the request without a network call and redacts credentials.
- Emit JSON or TOON output and filter results inline with `--jq` for shell and agent workflows.
- Configure credentials through environment variables, an OS keychain, or a config file, and install the bundled agent skill for supported coding agents.

## Use Cases

- A coding agent can create images or voiceovers for an application and use the returned file paths in its project.
- An assistant can extract answers from a PDF or compare images while helping a user complete a research or design task.
- A team can transcribe recordings into text, JSON, or SRT captions from a shell workflow.
- An agent can delegate research to a Gemini managed agent, save the interaction ID, and retrieve the result later.
- A developer can validate CLI requests locally before enabling API calls in a script or CI job.

## Our Take

This is a capable, actively maintained bridge from shell-based agents to Google’s Gemini API, best suited to teams comfortable adopting a beta CLI and managing Gemini API credentials.

**Good fit if:**
- Your coding agent or script can run shell commands and needs Gemini model, media-generation, file-analysis, or managed-agent capabilities.
- You want a single Go binary with machine-readable discovery, structured output, and offline request previews.
- You can work with the Gemini API and its credential setup, and accept the project’s Apache-2.0 licensing.

**Look elsewhere if:**
- You need a provider-neutral CLI rather than one centered on Google’s Gemini API.
- Your environment cannot use Go 1.26.10 or later for development builds, or cannot run a prebuilt binary.
- Your workflow depends on contributing code upstream, since the project says it does not accept pull requests.

## Project Health

| Signal | Value |
|---|---|
| Status | **Active**: regular commits and releases |
| Last commit | 2026-12-02 (today) |
| Commits, last 90 days | 100+ |
| Releases, last 12 months | 13 (latest v0.5.1, 2026-12-02) |
| Contributors | 10 (top contributor: 40% of commits) |
| Issues closed, last 90 days | 8+ (typically closed in 4 days) |
| Pull requests merged, last 90 days | 92 (typically merged in 1 day) |
| Project age | 7 months |

Checked on 2026-12-03 with the GitHub API.

## Project Facts

- Language: Go
- License: Apache-2.0
- Stars: 4.8k
- Forks: 339
- Topics: gemini, gemini-api
- Website: https://ai.google.dev/gemini-api/docs
- Archived: no

## What You Need

Detected in the repository:

- Go 1.26.10 or newer (from go.mod)
- A test suite and automated checks on GitHub Actions

## Getting Started

Install on macOS or Linux:

```bash
curl -fsSL https://raw.githubusercontent.com/google-gemini/gemini-api-cli/main/scripts/install.sh | bash
```

Set `GEMINI_API_KEY`, then check a request without making a network call:

```bash
gemini-api generate "Hello from my agent" --dry-run
```

See the [README](https://github.com/google-gemini/gemini-api-cli#readme) for Windows and Go installation, configuration, and command examples.

## License in Plain Words

**Apache-2.0** (permissive).

- Commercial use: yes
- Modify and redistribute: yes
- You must keep: the license, the NOTICE file and a note of your changes
- Share your changes: no
- Includes an explicit patent grant from the contributors

A summary, not legal advice: the LICENSE file is what applies.

## Considerations

- The README describes the CLI as experimental and in beta, with possible breaking changes between releases. Pin a release for automated workflows.
- Recent commits and releases indicate active development. The project has multiple contributors, and contributions are not concentrated in one person; however, its stated policy is to close external pull requests without review.
- Development builds require Go 1.26.10 or later. The README does not require Docker or a database.
- API use requires a Gemini API key, and available capabilities depend on the Gemini API and the models accessible to that key.