Skip to content

How to get an API key for Claude, GPT and Gemini

What an AI API key does, where to create one at Anthropic, OpenAI and Google, what it costs to use, and how to keep it safe.

Updated November 1, 2026Markdown version

An API key is a secret string that lets your code or a tool call an AI model and bills the usage to your account. You create one in each provider's console: the Claude Console for Claude, the OpenAI Platform for GPT and Google AI Studio for Gemini. A service such as 5abeer gives you one too.

What is an API key?#

An API (application programming interface) is how one program talks to another. When your code sends a question to Claude, GPT or Gemini, it sends an HTTP request to the provider's server. The API key travels in a header on that request, so the provider knows which account is calling and whom to bill for the tokens.

Three things follow from that:

  • The key is like a card number. Anyone who holds it can spend your balance, so it stays secret.
  • A key is not a chat subscription. A Claude Pro or ChatGPT plan is for the provider's own apps. The API is a separate product, billed by usage.
  • A key belongs to one provider. An Anthropic key calls Claude models only. It can't call GPT or Gemini.

When do you need an API key?#

You need a key whenever a program, not a person in a chat window, talks to the model:

  • Your own app, website backend or script that calls a model.
  • Coding agents and tools that run on a key, such as Claude Code, Codex CLI or Gemini CLI.
  • Automation that summarizes, classifies or translates text on a schedule.

If you only chat with a model in its app, you don't need one.

Where do you get an official key?#

Each provider issues its own keys from its own console. The page, how the key is sent and the date we checked each one:

Where to create an official API key
ServiceItemValueNoteSource
AnthropicClaude API keyThe API keys page in the Claude ConsoleSent in the Authorization header after the word Bearer, or in x-api-key. You pick its expiry when you create it.platform.claude.com
OpenAIOpenAI API keyThe API keys page in the OpenAI Platform dashboardSent in the Authorization header after the word Bearer. The OpenAI SDKs read it from OPENAI_API_KEY.developers.openai.com
GoogleGemini API keyThe API Keys page in Google AI StudioSent in the x-goog-api-key header. The SDKs read it from GEMINI_API_KEY or GOOGLE_API_KEY.ai.google.dev
Each row links to the page it comes from, checked October 31, 2026. These figures can change, so check the source before you buy.

The steps are much the same on all three: create an account, add a payment method or credit if the provider asks for it, open the API keys page, create a key and copy it into a safe place before you close the page.

Before a key can make paid calls, the account needs a balance. This is how the official consoles take payment:

How the official APIs are paid for
ServiceItemValueNoteSource
AnthropicSupported countriesEgypt is on the list—www.anthropic.com
AnthropicHow you pay in the Claude ConsolePrepaid credits, bought by cardUnder Billing, then Buy credits.support.claude.com
OpenAISmallest API credit purchase$5Prepaid credits that usage is deducted from. Read from a search result for the page, because the page itself didn't open for us.help.openai.com
Each row links to the page it comes from, checked October 31, 2026. These figures can change, so check the source before you buy.

The Gemini API has a free tier for some models, listed on Gemini API pricing.

How much does using a key cost?#

Creating a key costs nothing. You pay for what it does: each request is billed by the tokens it sends and receives, priced per million tokens, and output usually costs more than input. These are the newest models from each provider, at our price per million tokens:

per 1M tokens

Official price from the provider's page, checked October 19, 2026.

All models and prices
per 1M tokens

Official price from the provider's page, checked October 19, 2026.

All models and prices
per 1M tokens

Official price from the provider's page, checked October 19, 2026.

All models and prices

As a worked example, an app that sends two million tokens a month and gets half a million back, on the default model:

Example: what Claude Sonnet 5.5 costs

2M input tokens and 500K output tokens

Our price$2.7070% below the official price
Official price$9.00

Official price from the provider's page, checked October 19, 2026.

The official price for every model sits next to ours on the API page, and per provider on Claude API, OpenAI API and Gemini API.

How to get a key from 5abeer#

5abeer is an independent service that sells Claude, GPT and Gemini models below the official prices. You keep one balance and create a key for each provider you use:

  1. Top up your balance#

    Add credit with one of the methods in Payment methods. Every key draws on this balance.

  2. Create a key per provider#

    Open the keys page, pick the provider and give the key a name that says which project uses it. The steps are in Create a key.

  3. Point your code at our base URL#

    Use the base URL for the format your code or tool speaks. OpenAI SDK code keeps working once you change the base URL and the key:

    OpenAI-compatiblehttps://api.5abeer.ai/v1Authorization: Bearer <KEY>
    Anthropic-compatiblehttps://api.5abeer.aix-api-key: <KEY>
    Geminihttps://api.5abeer.ai/v1betax-goog-api-key: <KEY>
  4. Check the key#

    Check the key with a request that calls no model, then send a real one from the Quickstart.

You can give each key a spend limit, an expiry date and an IP allow-list, as in Control every key.

Where does the key go in a request?#

Each format has its usual header, and the official SDKs set it for you once they have the key:

  • OpenAI format: the Authorization header, set to the word Bearer followed by the key.
  • Anthropic Messages format: the x-api-key header, plus the anthropic-version header.
  • Gemini format: the x-goog-api-key header.

Keep the key in an environment variable rather than in your code. The docs examples read it from KHABEER_API_KEY, as shown in Keep the key in an environment variable.

How do you keep a key safe?#

  • Never put a key in code that runs in a browser or a phone app, because anyone can read it there. OpenAI's API reference gives the same advice. Send requests from your server.
  • Never commit a key to a code repository. Keep it in a .env file and add that file to .gitignore.
  • Use one key per project, so you can stop one without touching the others.
  • Set a spend limit, so a leaked or looping key can't drain your balance.
  • If a key leaks, disable it at once and create a new one.

FAQ#

Is an API key the same as my account password?#

No. Your password signs you in to the website. A key only lets code call the API and bill your account, and you can disable one key without changing your password or your other keys.

Does a Claude or ChatGPT subscription include an API key?#

Not as the same product. Anthropic bills the Claude API separately from its Claude plans, although its Max, Ultra and Team plans include monthly credits for the Claude API. These are Anthropic's plans, not the 5abeer plans with the same names. 5abeer plans are for the supported apps, and to call models from your own code you need an API key. Compare both routes in Claude API vs Claude Pro/Max, and plans on the pricing page.

Can one key call Claude, GPT and Gemini?#

Not with the official consoles, since each one issues keys for its own models. On 5abeer each key also covers one provider, but all your keys share one balance. A key used for another provider's model returns MODEL_PLATFORM_NOT_ALLOWED.

Which model should I start with?#

For general work, start with the default model, claude-sonnet-5.5. For the hardest tasks, move to claude-opus-5.5 or claude-fable-5.1. The full list is on the models page.

Can I pay from Egypt?#

Yes. The ways to pay from Egypt and the steps are in How to pay for the OpenAI or Claude API from Egypt, and the details are on the API in Egypt page.

What happens if I lose or leak a key?#

Disable it in the dashboard and create a new one, then put the new key wherever the old one was used. Requests with a disabled key return API_KEY_DISABLED.

Is 5abeer part of Anthropic, OpenAI or Google?#

No. 5abeer is an independent service, not affiliated with any of them.

Get started#

Compare prices per provider on the API page, or create your first key and send a request.