Skip to content
FossShelf
Home / Categories / For AI Engineers

Cookbook

Multimodal AI API with 1M-token context and real-time voice streaming.

Replaces Openai Api, Anthropic Claude, Azure Openai Service

17.95K starsApache-2.0last commit 13 Nov 2026

Who it's for

Developers processing long documents and codebases

Applications that process full contracts, research papers, entire codebases, or lengthy conversation histories benefit from Gemini 4 Argon's 1M-token context window. The entire document can be sent in a single API call, avoiding retrieval-augmented generation complexity for documents within the context limit.

Your documents are short enough to fit within standard 128K context models and you have no requirement for Gemini-specific multimodal capabilities.

Teams building real-time voice and translation agents

The Live API and Live Translation API handle low-latency bidirectional audio streaming for voice assistants, live interpreters, and interactive agents. Gemini 3.8 Live returns audio without the round-trip latency of standard request-response APIs, making natural-sounding voice interactions feasible.

Your app only needs text-based chat and latency is not a primary concern.

Engineers building multimodal content generation pipelines

Apps that generate images, edit video with natural language prompts, compose music, or combine multiple media types in a single pipeline can use Nano Banana, Gemini Omni, and Lyria 3.5 through one API key, without integrating separate generation services.

Your app is text-only and does not require image, video, or audio generation.

Developers building multi-step AI agents with tool use

The Agents API (Antigravity) handles multi-step agent execution, file search with hosted RAG, Google Maps grounding, and webhook-based async operations. Teams building autonomous agents with tool calling can use the managed agent layer without building a custom orchestration framework.

Your use case is a single-turn prompt without tool use or multi-step workflows.

The problem

Building production apps on large language model APIs means managing multiple vendor relationships and capability gaps. Text-focused APIs require separate vision or audio services when an app needs multimodal reasoning; managing multiple provider integrations adds latency, complexity, and billing overhead. Context window limits create a second challenge. Processing a long contract, codebase, or conversation history forces developers to implement chunking or retrieval before any generation happens. Teams running real-time voice agents face a third pain point: standard request-response APIs introduce too much latency for natural conversation, requiring separate streaming infrastructure.

How it works

1M-Token Context Window on Gemini 4 Argon

Gemini 4 Argon supports a unified 1M-token context window for both input and output, with long decode continuation up to 1M output tokens. This allows processing entire codebases, legal documents, or conversation histories in a single API call without chunking. The model also supports tunable thinking levels (low, medium, high) for adjusting reasoning depth per request.

Live API for Real-Time Voice and Video

The Live API provides low-latency, bidirectional voice and video streaming for agent experiences. Gemini 3.8 Live handles audio and video input and returns audio or text, with 128K tokens of context. It supports extended thinking in real-time sessions with conversational filler cues and non-blocking background tool calls, enabling natural voice agent interactions.

Native Image Generation with Nano Banana Models

Nano Banana models generate and edit images natively using text, image, or interleaved multimodal prompts. Nano Banana Pro produces images at up to 4K resolution with multi-turn editing and character consistency; Nano Banana 2 offers high-speed generation. Both support thinking and search grounding for accurate visual output.

Managed Agents via the Antigravity API

The Agents API (Antigravity) lets developers create and run custom agents in a controlled environment without managing agent state manually. Agents support tool calls, file search with hosted RAG, webhooks for async operations like batch jobs and video generation, and inference tiers to balance speed, cost, and reliability.

Audio Transcription and Text-to-Speech

Gemini Transcribe transcribes audio files and live streams with word-level timestamps, speaker diarization, custom vocabulary, and smart transcription. Gemini 3.8 Flash TTS generates expressive single- and multi-speaker speech; Voice Design creates custom voice personas from text prompts, and Voice Replication clones voices from reference audio samples.

Features

  • 1M-Token Context Window on Gemini 4 Argon
  • Live API for Real-Time Voice and Video
  • Native Image Generation with Nano Banana Models
  • Managed Agents via the Antigravity API
  • Audio Transcription and Text-to-Speech

How to install

Install the Python SDK to start calling the Gemini API from your environment.

pip install google-genai

Recommended for this setup

Strengths

  • One API Key for Text, Vision, Audio, Video, and Music: Instead of integrating separate APIs for vision, voice, and generation, Gemini covers five media types through a single API key and client library. Text, image generation (Nano Banana), video editing (Gemini Omni), music generation (Lyria 3.5), and real-time voice streaming (Live API) all use the same Python or JavaScript SDK and authentication.
  • Free Tier via Google AI Studio: Developers can call Gemini models for free through Google AI Studio without entering payment information. The free tier is available for prototyping and testing before committing to paid usage, and includes access to the same models available on paid plans.
  • Runnable Quickstarts in Google Colab: The cookbook pairs every API feature with a runnable Jupyter notebook available in Google Colab with no local setup required. Quickstarts cover authentication, multimodal prompting, TTS, Live API, Transcribe, image generation, video editing, agents, file search, grounding, and inference tiers.
  • Priority and Flex Inference Tiers: Inference tier selection lets developers balance speed, cost, and reliability per request. Priority tier reduces latency for time-sensitive workloads; Flex tier lowers cost for batch or background tasks. Webhooks deliver real-time notifications for async operations like batch jobs and video generation.

Trade-offs

  • Cloud-Only: No Self-Hosting Option: The Gemini API runs entirely on Google's infrastructure. There is no option to download model weights or run the API on private servers, so availability and pricing depend on Google. Teams with strict data residency or air-gap requirements cannot use this service directly and would need to look at fully open source model alternatives.
  • Google Account Required for All Access: Using the Gemini API requires a Google account and an API key from Google AI Studio. This creates a dependency on Google's identity and billing systems. Organizations with restrictions on Google account usage would need to access Gemini through Vertex AI instead.
  • Notebook-Centric Learning Resources: The cookbook's quickstarts are primarily Jupyter notebooks optimized for Google Colab. Developers who prefer plain documentation or CLI examples, or whose tooling does not support notebooks, will need to adapt the examples before integrating them into their own workflows.

Tech stack

Languages
Jupyter Notebook, Python, JavaScript, Shell
Frameworks
—
Databases
—
Tooling
—

FAQ

Is the Gemini API free to use?

Yes, there is a free tier via Google AI Studio that lets developers call Gemini models without entering payment information. The free tier has rate limits; production workloads typically require a paid API key with usage-based pricing.

What is the maximum context window on the Gemini API?

Gemini 4 Argon supports a unified 1M-token context window for both input and output, with long decode continuation up to 1M output tokens. Most other Gemini models in the cookbook offer 1M-token input contexts as well, with output lengths varying by model.

Can I self-host the Gemini API?

No. The Gemini API runs entirely on Google's infrastructure and cannot be self-hosted. Teams with strict data residency requirements can access Gemini through Vertex AI for enterprise compliance and private networking. For fully self-hosted open source models, see Google's Gemma models, available separately.

What programming languages does the Gemini API support?

Official SDKs are available for Python (google-genai), JavaScript/TypeScript (@google/genai), Go (google.golang.org/genai), and Java (com.google.genai), as shown in the cookbook's quickstarts. The API also supports any language that can make HTTP requests through the REST endpoint.

What license covers the Gemini API Cookbook?

The cookbook repository at github.com/google-gemini/cookbook is Apache-2.0 licensed, which allows free use, modification, and distribution of the example notebooks, including in commercial projects. The Gemini API service itself is a commercial offering from Google and is not open source.

Similar tools

More in AI Engineers