Basics 3 min read

How to get a Gemini API key

Two ways to get a Gemini API key: directly in Google AI Studio, or with one llmbox key for all models, including a ready-to-run Python request example.

How to get a Gemini API key

You need a Gemini API key to call Google models from scripts, bots and applications. There are two ways to get one: directly from Google, or through llmbox, where one key gives access to models from different vendors, Gemini included. Both options are described below.

Option 1. A key directly from Google

The official console for Gemini keys is called Google AI Studio. You create a key on the API Keys page of that console. You need a Google account, and to work beyond the free quotas you also need billing set up in a Google Cloud project. Current terms, quotas and payment details are in the official documentation: Using Gemini API keys.

Such a key works with Google's Gemini API. If you later want to try models from other vendors, each one needs its own registration and its own key.

Option 2. One llmbox key

In llmbox you create a key in the cabinet, and it works with every model in the catalog, Gemini included. You pay from your balance based on actual usage, and requests are sent in the OpenAI format.

  1. Create an account

    Sign up for llmbox. You can confirm your email later in the cabinet.

  2. Top up your balance

    Open the Balance section in the cabinet. How cost is calculated is described in Balance and pricing.

  3. Create a key

    Open the Keys section in the cabinet. You can copy the key at any time with the "Show key" button.

  4. Choose a Gemini model

    Take an identifier such as google/gemini-4-hydrogen from the Google models page.

The API address is https://llmbox.cc/v1; see Quickstart for more. Save the key in an environment variable:

bash
export LLMBOX_API_KEY="sk-your-key"

A request through the official openai SDK:

python
import os
from openai import OpenAI

client = OpenAI(base_url="https://llmbox.cc/v1", api_key=os.environ["LLMBOX_API_KEY"])
resp = client.chat.completions.create(
    model="google/gemini-4-hydrogen",
    messages=[{"role": "user", "content": "Hello! Reply in one sentence."}],
)
print(resp.choices[0].message.content)

The same request with curl:

bash
curl https://llmbox.cc/v1/chat/completions \
  -H "Authorization: Bearer $LLMBOX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"google/gemini-4-hydrogen","messages":[{"role":"user","content":"Hello!"}]}'

Which Gemini model to choose

A fast model suits everyday tasks, and the larger one suits complex reasoning. The cards show the current rates from the catalog, and a click opens the model page.

To compare models, change only the model parameter: the rest of your code stays the same. The example above uses Gemini 4 Hydrogen, which has a separate news post, and all of the vendor's models are on the Google page.

Which option to choose

A direct Google key makes sense if you only need Gemini and work within the Google ecosystem. An llmbox key is convenient when you use several models: one key, one API address, one balance and a single view of usage in the cabinet. For more about keys, see Keys and authentication in the documentation, and for SDKs, OpenAI and ElevenLabs SDKs.

Key security

Keep the key in environment variables, don't publish it in a repository, and don't paste it into code that ships to the browser. If the key falls into the wrong hands, create a new one in the cabinet and replace it in your applications.

Questions

Do I need a separate Google key if I have an llmbox key?

No. The Gemini models in the catalog work with the same llmbox key as all other models. Only the model value in the request changes.

How is an llmbox key different from a Google AI Studio key?

A Google key belongs to your Google account and works with the Gemini API. One llmbox key covers models from different vendors, and requests use the OpenAI format.

How do I check that the key works?

Send a short request with the model google/gemini-4-hydrogen. If a reply comes back, the key works. The request will appear in the Logs section of the cabinet.

Where should I store the key?

In an environment variable or a secrets manager. Don't commit the key to a repository or paste it into client-side code.

Published November 15, 2026

One key — every model

GPT, Gemini, DeepSeek, Qwen, video and audio. Pay as you go.

Create a key