thezakuloGet the newsletter
← All setup guides

Setup guide · 4 steps · about 10 minutes

How to start using Google: Gemini 4 Carbon

Google: Gemini 4 Carbon (google/gemini-4-carbon) is a frontier Gemini 4 model for coding, agentic and complex reasoning work that takes text, image, audio, video and file input, supports output up to 1M tokens, and lets you set low, medium or high reasoning effort.

Built from the official docs: Gemini 4 Carbon - API Pricing & Benchmarks · openrouter.ai · Getting started  |  Gemini API  |  Google AI for Developers · checked 20 November 2026

Through OpenRouter

  1. Get an OpenRouter API key

    Sign up on OpenRouter and create an API key from your dashboard. You'll pass it as a Bearer token on every request.

  2. Export your key

    Store the key in an environment variable so the examples below can read it.

    export OPENROUTER_API_KEY="<your-openrouter-key>"
  3. Call the model with curl

    Send a POST to the OpenRouter responses endpoint. Use the model slug google/gemini-4-carbon and put your prompt in the input field.

    curl https://openrouter.ai/api/v1/responses \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer $OPENROUTER_API_KEY" \
      -d '{
      "model": "google/gemini-4-carbon",
      "input": "What is the meaning of life?"
    }'
  4. Or call it from Python

    OpenRouter's API is OpenAI-compatible, so you can point the OpenAI SDK at OpenRouter by setting the base URL and your key.

    from openai import OpenAI
    
    client = OpenAI(
      base_url="https://openrouter.ai/api/v1",
      api_key="<your-openrouter-key>",
    )
    
    response = client.responses.create(
      model="google/gemini-4-carbon",
      input="What is the meaning of life?"
    )
    
    print(response.output_text)

Direct from Google

  1. Get a Gemini API key

    Create a key on the Google AI Studio API keys page; AI Studio automatically creates a project and key for new users.

  2. Set your key as an environment variable

    The Gemini SDKs and REST calls read your key from this variable.

    export GEMINI_API_KEY="<your-gemini-api-key>"
  3. Install the SDK (Python)

    Install the official Google GenAI SDK with pip.

    pip install -U google-genai
  4. Make your first call

    Initialize the client and create an interaction. Set model to the Gemini model id you want to use.

    from google import genai
    
    client = genai.Client()
    
    interaction = client.interactions.create(
        model="<gemini-model-id>",
        input="Explain how AI works in a few words"
    )
    print(interaction.output_text)

Check it worked

You get a completed response with text in it — for curl, the JSON shows "status": "completed" with an output_text; for the SDK calls, response.output_text / interaction.output_text prints a non-empty answer.

Try these first

Get every issue by email

One email a week with the written issue. Free, one-click unsubscribe

Subscribe