<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/call-gemini-from-any-shell-with-the-new-gemini-api-cli-hres9vjcf" -->

---
title: Call Gemini from any shell with the new Gemini API CLI
description: Google's new open-source Gemini API CLI (`gemini-api`) lets coding agents and CI scripts call Gemini text, image, speech, music, video and agent features...
canonical: https://daily.dev/posts/call-gemini-from-any-shell-with-the-new-gemini-api-cli-hres9vjcf
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Call Gemini from any shell with the new Gemini API CLI | daily.dev
og:description: Google's new open-source Gemini API CLI (`gemini-api`) lets coding agents and CI scripts call Gemini text, image, speech, music, video and agent features...
og:url: https://daily.dev/posts/call-gemini-from-any-shell-with-the-new-gemini-api-cli-hres9vjcf
og:image: https://api.daily.dev/og/posts/HReS9vJCF.png
og:image:alt: Call Gemini from any shell with the new Gemini API CLI
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Call Gemini from any shell with the new Gemini API CLI

**[Flavio Copes](https://daily.dev/sources/flaviocopes)** · 12 min read · 3 upvotes · 1 comments

## Summary

Google's new open-source Gemini API CLI (`gemini-api`) lets coding agents and CI scripts call Gemini text, image, speech, music, video and agent features straight from the shell. It ships as a dependency-free Go binary, in beta since October 27, 2026. Media commands write files to disk and print only the path, so steps chain easily. Tests on v0.5.0 showed structured JSON in 2.56s, an image in 16.03s and a 2m 39s music track in 36.06s. It is stateless HTTP only, so real-time voice and live video still need the Live API. Spend caps count gross usage before credits, so a $0 cap blocks paid requests.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://flaviocopes.com/gemini-api-cli>

## Questions this post answers

### How do I get structured JSON output from the Gemini API CLI?

Pipe text in with `--stdin` and pass a JSON Schema under `response_format` through `--body`, with `--stream=false`. Piping eight git commits into `gemini-api generate` returned clean JSON with no Markdown fences in 2.56 seconds. Adding `"store": false` keeps the interaction from being retained server-side. If a CLI flag and `--body` set the same key, it exits with code 2.

_Developers wiring Gemini into scripts follow tooling like this on daily.dev._

### What can the gemini-api CLI not do compared to the Live API?

`gemini-api` is stateless request-response HTTP only and does not support bidirectional WebSockets. Real-time voice or live video sessions still need the Live API through the Google GenAI SDKs. It is also not a replacement for an interactive coding agent when you need multi-file editing and tool loops.

_Choosing between Gemini API surfaces is easier when you track releases on daily.dev._

### Why does setting a $0 spend cap in Google AI Studio block my Gemini API credits?

Spend caps count gross usage before credits are applied, so a cap of $0 blocks paid requests immediately even if you hold credits. The advice is to set the monthly cap slightly below your credit balance, for example 80 euros against a 98.8 euro grant, so bursts cannot spill onto your card.

_Developers managing AI API costs stay on top of pricing changes through daily.dev._

## Community discussion

Top comments from developers on daily.dev.

**@pdfopsdev** · 0 upvotes

> the stateless-only part is the real limitation imo, once you need a convo loop over multiple turns you're back to rolling your own session state around the CLI calls. also that gross-usage-before-credits thing on spend caps bit me on a different google api, easy to get blindsided by a $0 cap blocking stuff you thought was covered.

## Similar posts on daily.dev

- [Coding With the Gemini CLI Tool](https://daily.dev/posts/coding-with-the-gemini-cli-tool-jxqxwaolg) · The New Stack · 0 upvotes · 0 comments
- [Gemini CLI Quick Start](https://daily.dev/posts/gemini-cli-quick-start-slsvbuocy) · Faun · 0 upvotes · 0 comments

---

Tags: [#ai-agents](https://daily.dev/tags/ai-agents), [#golang](https://daily.dev/tags/golang), [#cli](https://daily.dev/tags/cli), [#google-gemini](https://daily.dev/tags/google-gemini)

[View this post on daily.dev](https://daily.dev/posts/call-gemini-from-any-shell-with-the-new-gemini-api-cli-hres9vjcf)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Call Gemini from any shell with the new Gemini API CLI","url":"https://daily.dev/posts/call-gemini-from-any-shell-with-the-new-gemini-api-cli-hres9vjcf","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/call-gemini-from-any-shell-with-the-new-gemini-api-cli-hres9vjcf"},"datePublished":"2026-11-27T14:22:00.062Z","dateModified":"2026-11-27T14:22:20.492Z","description":"Google's new open-source Gemini API CLI (`gemini-api`) lets coding agents and CI scripts call Gemini text, image, speech, music, video and agent features...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/b68b9ecb6fc965408ed3486728f91b75?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/b68b9ecb6fc965408ed3486728f91b75?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Flavio Copes","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Flavio Copes","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/1f2dbd275797411bbd37bfdaaf0951a9","url":"https://daily.dev/sources/flaviocopes"},"commentCount":1,"discussionUrl":"https://daily.dev/posts/call-gemini-from-any-shell-with-the-new-gemini-api-cli-hres9vjcf","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":2},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":1}],"keywords":"ai-agents,golang,cli,google-gemini","timeRequired":"PT12M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Flavio Copes","item":"https://daily.dev/sources/flaviocopes"},{"@type":"ListItem","position":3,"name":"Call Gemini from any shell with the new Gemini API CLI"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/call-gemini-from-any-shell-with-the-new-gemini-api-cli-hres9vjcf","comment":[{"@type":"Comment","text":"the stateless-only part is the real limitation imo, once you need a convo loop over multiple turns you’re back to rolling your own session state around the CLI calls. also that gross-usage-before-credits thing on spend caps bit me on a different google api, easy to get blindsided by a $0 cap blocking stuff you thought was covered.","datePublished":"2026-11-27T18:05:29.158Z","url":"https://daily.dev/posts/HReS9vJCF#c-rN2tHuh4j","author":{"@type":"Person","name":"PDFops","url":"https://daily.dev/pdfopsdev","image":"https://media.daily.dev/image/upload/s---8isRBKc--/f_auto/v1782922291/avatars/avatar_orjMeK8QKaaVZwGq7ScPz?_a=BAMAMicg0"}}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/call-gemini-from-any-shell-with-the-new-gemini-api-cli-hres9vjcf#faq","mainEntity":[{"@type":"Question","name":"How do I get structured JSON output from the Gemini API CLI?","acceptedAnswer":{"@type":"Answer","text":"Pipe text in with `--stdin` and pass a JSON Schema under `response_format` through `--body`, with `--stream=false`. Piping eight git commits into `gemini-api generate` returned clean JSON with no Markdown fences in 2.56 seconds. Adding `\"store\": false` keeps the interaction from being retained server-side. If a CLI flag and `--body` set the same key, it exits with code 2. Developers wiring Gemini into scripts follow tooling like this on daily.dev."}},{"@type":"Question","name":"What can the gemini-api CLI not do compared to the Live API?","acceptedAnswer":{"@type":"Answer","text":"`gemini-api` is stateless request-response HTTP only and does not support bidirectional WebSockets. Real-time voice or live video sessions still need the Live API through the Google GenAI SDKs. It is also not a replacement for an interactive coding agent when you need multi-file editing and tool loops. Choosing between Gemini API surfaces is easier when you track releases on daily.dev."}},{"@type":"Question","name":"Why does setting a $0 spend cap in Google AI Studio block my Gemini API credits?","acceptedAnswer":{"@type":"Answer","text":"Spend caps count gross usage before credits are applied, so a cap of $0 blocks paid requests immediately even if you hold credits. The advice is to set the monthly cap slightly below your credit balance, for example 80 euros against a 98.8 euro grant, so bursts cannot spill onto your card. Developers managing AI API costs stay on top of pricing changes through daily.dev."}}]}
```

