# 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: 2026-11-01

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](https://platform.claude.com/settings/keys) for Claude, the [OpenAI Platform](https://platform.openai.com/settings/organization/api-keys) for GPT and [Google AI Studio](https://aistudio.google.com/apikey) 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](https://5abeer.ai/en/docs/apps/claude-code.md), [Codex CLI](https://5abeer.ai/en/docs/apps/codex.md) or [Gemini CLI](https://5abeer.ai/en/docs/apps/gemini-cli.md).
- 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

| Service | Item | Value | Note | Source |
| --- | --- | --- | --- | --- |
| Anthropic | Claude API key | The API keys page in the Claude Console | Sent in the Authorization header after the word Bearer, or in x-api-key. You pick its expiry when you create it. | https://platform.claude.com/docs/en/api/overview |
| OpenAI | OpenAI API key | The API keys page in the OpenAI Platform dashboard | Sent in the Authorization header after the word Bearer. The OpenAI SDKs read it from OPENAI_API_KEY. | https://developers.openai.com/api/reference/overview |
| Google | Gemini API key | The API Keys page in Google AI Studio | Sent in the x-goog-api-key header. The SDKs read it from GEMINI_API_KEY or GOOGLE_API_KEY. | https://ai.google.dev/gemini-api/docs/api-key |

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

| Service | Item | Value | Note | Source |
| --- | --- | --- | --- | --- |
| Anthropic | Supported countries | Egypt is on the list | — | https://www.anthropic.com/supported-countries |
| Anthropic | How you pay in the Claude Console | Prepaid credits, bought by card | Under Billing, then Buy credits. | https://support.claude.com/en/articles/8977456 |
| OpenAI | Smallest API credit purchase | $5 | Prepaid credits that usage is deducted from. Read from a search result for the page, because the page itself didn't open for us. | https://help.openai.com/en/articles/8264778-what-is-prepaid-billing |

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](https://ai.google.dev/gemini-api/docs/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:

| Model | Id | Input (ours) | Output (ours) | Context |
| --- | --- | --- | --- | --- |
| Claude Sonnet 5.5 | `claude-sonnet-5.5` | $0.60 | $3 | 1M |
| Claude Opus 5.5 | `claude-opus-5.5` | $1.20 | $6 | 1M |
| Claude Fable 5.1 | `claude-fable-5.1` | $3 | $15 | — |

| Model | Id | Input (ours) | Output (ours) | Context |
| --- | --- | --- | --- | --- |
| GPT-6.1 Sol | `gpt-6.1-sol` | $0.60 | $3 | 922K |
| GPT-6 Astra | `gpt-6-astra` | $3 | $15 | — |
| GPT-6 Sol | `gpt-6-sol` | $0.60 | $3 | 922K |

| Model | Id | Input (ours) | Output (ours) | Context |
| --- | --- | --- | --- | --- |
| Gemini 4 Argon | `gemini-4-argon` | $0.60 | $3 | — |
| Gemini 2.5 Pro | `gemini-2.5-pro` | $0.38 | $3 | 1M |

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

Example: 2,000,000 input tokens and 500,000 output tokens on Claude Sonnet 5.5 (`claude-sonnet-5.5`) cost $2.70 at our price against $9.00 at the official price (70% lower). Official price checked October 19, 2026.

The official price for every model sits next to ours on the [API page](https://5abeer.ai/en/api), and per provider on [Claude API](https://5abeer.ai/en/api/claude), [OpenAI API](https://5abeer.ai/en/api/openai) and [Gemini API](https://5abeer.ai/en/api/gemini).

## 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](https://5abeer.ai/en/docs/start/payment.md). 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](https://5abeer.ai/en/docs/start/keys.md#create).

### 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:

| Format | Base URL | Key header |
| --- | --- | --- |
| OpenAI | `https://api.5abeer.ai/v1` | `Authorization: Bearer <KEY>` |
| Anthropic | `https://api.5abeer.ai` | `x-api-key: <KEY>` |
| Gemini | `https://api.5abeer.ai/v1beta` | `x-goog-api-key: <KEY>` |

### 4. Check the key

[Check the key](https://5abeer.ai/en/docs/start/keys.md#verify) with a request that calls no model, then send a real one from the [Quickstart](https://5abeer.ai/en/docs/start/quickstart.md).

You can give each key a spend limit, an expiry date and an IP allow-list, as in [Control every key](https://5abeer.ai/en/docs/start/keys.md#controls).

## 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](https://5abeer.ai/en/docs/start/keys.md#env).

## 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](https://developers.openai.com/api/reference/overview) 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](https://support.claude.com/en/articles/9876003) 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](https://5abeer.ai/en/guides/claude-api-vs-subscription), and plans on the [pricing page](https://5abeer.ai/en/pricing).

### 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`](https://5abeer.ai/en/docs/help/errors.md#MODEL_PLATFORM_NOT_ALLOWED).

### Which model should I start with?

For general work, start with the default model, [`claude-sonnet-5.5`](https://5abeer.ai/en/models/claude-sonnet-5.5). For the hardest tasks, move to [`claude-opus-5.5`](https://5abeer.ai/en/models/claude-opus-5.5) or [`claude-fable-5.1`](https://5abeer.ai/en/models/claude-fable-5.1). The full list is on the [models page](https://5abeer.ai/en/models).

### 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](https://5abeer.ai/en/guides/pay-ai-api-from-egypt), and the details are on the [API in Egypt page](https://5abeer.ai/en/api/egypt).

### 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`](https://5abeer.ai/en/docs/help/errors.md#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](https://5abeer.ai/en/api), or create your first key and send a request.
