Gemini API Tutorial: Carbon in 12 Steps, 70 Min [2026] Google made Gemini 4 Carbon generally available to paying developers and enterprises on November 10, 2026, at an introductory price of $2 per million input tokens and $10 per million output tokens through November 30, 2026, with rates doubling to $4 and $20 per million tokens from December 1. The model, identified as `gemini-4-carbon`, runs in the Gemini API, Google AI Studio, Android Studio, Gemini for business and Antigravity, with cached input priced at 95% off the input rate, and Google also introduced the faster, cheaper Gemini 4 Hydrogen on November 12 for agentic loops. A tutorial built around the launch warns that anyone who ships a prototype this month and forgets the December 1 date will see costs double overnight, and notes Carbon's rollout still varies by account and region. The Gemini API now serves Gemini 4 Carbon to paying developers, and Google’s launch post https://blog.google/innovation-and-ai/models-and-research/gemini-models/gemini-4-carbon-now-available/ priced it at $2 per million input tokens and $10 per million output tokens through November 30, 2026. From December 1 those rates double to $4 and $20. Anyone who ships a prototype this month and forgets that date will watch the bill jump overnight. That deadline shapes the whole build. Create a small Python CLI called carbon-lab that covers the full path: a safely stored API key, a first call, token accounting, streaming, tool calls, typed JSON output, retries, a spend ledger and a test suite. Each step ends with a command to run and output to compare. Carbon’s rollout still varies by account and region, as the availability picture for the $2 intro price https://shattered.io/gemini-4-carbon-availability-2-dollar-intro-price-not-worldwide-2026/ shows, so the project checks which model IDs your key can see before it sends a single prompt. Demand for this skill is easy to measure. Stack Overflow’s 2025 developer survey https://stackoverflow.co/company/press/archive/stack-overflow-2025-developer-survey/ found that 35% of developers reported using Gemini Flash models. Among developers who use ready-made agents, copilots or assistants, 47.4% reported using Google Gemini. Most of them start the same way you will: grab a key, paste a snippet, and discover the details thinking tokens, retries, price changes only after the first invoice. Don't miss new tech stories on Google Add Shattered once in the Google app and our stories show up in your news suggestions. Add now https://www.google.com/preferences/source?hl=en&q=https%3A%2F%2Fshattered.io%2F Where the Gemini API Stands on November 15, 2026 Google moved Gemini 4 Carbon from a limited cyber-defender preview to general availability for paying developers and enterprises on November 10, 2026. The model reaches developers through the Gemini API, Google AI Studio, Android Studio and Gemini for business. Consumers on Google AI Ultra get it in the Gemini app, AI Mode in Search and Google Antigravity, and Android Authority’s rollout report https://www.androidauthority.com/google-gemini-4-carbon-rollout-3733702/ describes the Ultra-first pattern. The API identifier is gemini-4-carbon . Google also introduced Gemini 4 Hydrogen https://shattered.io/gemini-4-hydrogen-agentic-workflows-1m-context-1-50-input-2026/ on November 12, and reports describe it as the faster, cheaper sibling aimed at agentic loops, while Carbon and Gemini 4 Argon target deeper reasoning. Treat any Hydrogen price you see on forums as unconfirmed until you read Google’s pricing page yourself. The table below sticks to what Google has published. | Item | Current state November 15, 2026 | |---|---| | Model ID | gemini-4-carbon | | General availability | November 10, 2026, for paying developers and enterprises | | Input price, through November 30 | $2 per 1M tokens | | Output price, through November 30 | $10 per 1M tokens | | Input price, from December 1 | $4 per 1M tokens | | Output price, from December 1 | $20 per 1M tokens | | Cached input | 95% off the input price | | Intro price matches | Gemini 4 Argon $2 and $10 per 1M | | Where it runs | Gemini API, Google AI Studio, Android Studio, Gemini for business, Antigravity | Two details in that table matter for a tutorial. First, the price applies to the public Carbon model, and Google’s footnote names no carve-out for existing projects, so budget every token sent on or after December 1 at the higher rate. Second, a subscription is not an API plan. Google AI Ultra unlocks Carbon in consumer surfaces, while Gemini API usage bills separately by token. Reports from the week of November 13 say Google AI Pro subscribers can claim $10 a month in Google Cloud credits for Gemini API use in AI Studio, but confirm that on your own billing page before you rely on it. For model choice beyond this project, the independent comparison of Claude Opus 5.5 and Gemini 4 Carbon https://shattered.io/claude-vs-gemini-opus-5-5-vs-gemini-4-carbon-argon-59-vs-58-2026/ covers where each wins. The Gemini 4 launch timeline https://shattered.io/gemini-4-launch-earlier-claim-meta-muse-argon-carbon-zero-new-dates-2026/ explains how Argon, Carbon and Hydrogen reached developers in that order. Prerequisites and Versions The project needs very little. Everything runs on a laptop, and the test suite works offline with no key at all. - Python 3.12 or newer. Python 3.13 also works. Check with python3 --version . - The google-genai SDK, latest version. This is Google’s current Python client. The older google-generativeai package is the legacy library and does not mix well with the new one in a single environment. - pydantic, python-dotenv and pytest, latest versions. Pydantic gives you typed output, dotenv loads the key, pytest runs the checks. - A Google account with billing enabled in Google AI Studio. Carbon is a paid-tier model, so a free-tier key will list other models and fail on this one. - A Linux, macOS or WSL shell. Windows PowerShell works too, but the commands below use POSIX syntax. - About $1 of credit. At intro prices the whole walkthrough costs a few cents, yet a funded account avoids rate-limit surprises. Pin the exact versions your install resolves into requirements.txt when you finish. Reproducible builds matter more than usual here because the SDK and the model lineup are both moving fast. Steps 1 and 2: Create a Key and Scaffold the Project Step 1: Create the API key Open Google AI Studio, create a key under your billing-enabled project, and copy it once. Treat it like a database password. A key pasted into a notebook, a screenshot or a public repository gets scraped within minutes, and a leaked key on a paid project spends real money. Never commit the key. Create the project folder and an environment file that git ignores: mkdir carbon-lab && cd carbon-lab python3 -m venv .venv source .venv/bin/activate pip install google-genai pydantic python-dotenv pytest printf "GEMINI API KEY=paste-your-key-here\nCARBON MODEL=gemini-4-carbon\nFAST MODEL=gemini-4-hydrogen\nTHINKING LEVEL=low\nDAILY BUDGET USD=2.00\n" .env printf ".env\n.venv/\nusage.jsonl\n pycache /\n" .gitignore printf "GEMINI API KEY=\nCARBON MODEL=gemini-4-carbon\nFAST MODEL=gemini-4-hydrogen\nTHINKING LEVEL=low\nDAILY BUDGET USD=2.00\n" .env.example The last line produces an .env.example with the key blanked out, which is the only env file that belongs in version control. If you already run local models behind an authenticated proxy, the same hygiene applies, and the walkthrough on setting up an Ollama API key behind a reverse proxy https://shattered.io/ollama-api-key-reverse-proxy-docker-12-steps-2026/ shows the pattern. Beyond the ignore file, three habits protect a paid key. Rotate it on a schedule, for example every 90 days, and immediately after anyone who had access leaves the team. Restrict it where the console allows, so a stolen key cannot reach services you never use. In CI and production, inject it from a secrets manager or the platform’s encrypted variables instead of baking it into an image. A key in a Docker layer lives in that layer forever, even after you delete the file in a later step. Step 2: Lay out the project Create the package and test folders so the later steps drop files into the right places: mkdir -p carbonlab tests touch carbonlab/ init .py tests/ init .py pip freeze | grep -iE "google-genai|pydantic|python-dotenv|pytest" requirements.txt cat requirements.txt Expected output your versions will differ : google-genai==