API key setup guide: Claude, OpenAI, and Gemini in 5 minutes.

Updated 2026-04-27 · 9 min read

The short version. An AI API key is a password that lets a desktop app talk to an AI provider on your behalf. Setup takes 5 minutes per provider: sign up at the provider's developer portal, add a payment method, set a spending cap, generate the key, paste it into your app. After that, the app uses the key to send requests, the provider bills you directly for usage, and your data goes from your machine to the provider with nothing in the middle.

Most desktop AI tools that respect your privacy ask you to bring your own API key. The benefit, lower cost and better privacy posture, is real. The first-time setup is also unfamiliar to a lot of indie founders, which is why people sometimes bounce on the signup step.

This page walks through getting a key from Anthropic (Claude), OpenAI, and Google Gemini, with the specific clicks for each. It also covers the things people miss: the spending cap, the security defaults, and the most common errors when pasting the key into a tool.

What an API key actually is

An API key is a long string of letters and numbers that a desktop app sends along with each request to an AI provider. The provider checks the key, decides whether you're authorized, runs the request, and bills your account for the tokens used.

The key is like a password. Treat it like one. Don't paste it into a public document, don't commit it to a Git repo, don't share it on Slack. If it leaks, anyone with the key can run requests on your account until you revoke it.

Mental model:

Anthropic Claude (5 minutes)

Step-by-step

  1. Go to console.anthropic.com and click Sign Up
  2. Verify your email
  3. You'll land on the Console. Click your name in the top right → Plans & Billing
  4. Click Add Payment Method and enter a card
  5. Click Buy Credits and add $5-20 to start (you can always add more)
  6. Set a monthly spending cap. Click Plans & Billing → look for the spending limit option, set to a number you're comfortable with ($20 is a reasonable starting point)
  7. Now generate the key. Click your name → API KeysCreate Key
  8. Give the key a name (e.g., "Projelli on my MacBook"). Click Create
  9. Copy the key (it starts with sk-ant- and is about 100 characters long)
  10. Paste the key immediately into your desktop app. Anthropic only shows the full key once. If you lose it, you'll have to create a new one.

Claude offers three model tiers as of 2026:

For most founder workflows, Sonnet is the right pick. Switch to Haiku when you want fast / cheap, switch to Opus when you want maximum reasoning depth.

OpenAI (5 minutes)

Step-by-step

  1. Go to platform.openai.com and sign up (or log in if you already have a ChatGPT account; the API uses the same account)
  2. Click your profile in the top right → BillingAdd Payment Method
  3. Add a card and put initial credit on file ($5-20)
  4. Set a hard monthly limit. Click SettingsLimits. Set both the "soft limit" (you get an email) and "hard limit" (the API stops working). $20 hard limit is reasonable to start.
  5. Now the key. Click your profile → API KeysCreate new secret key
  6. Name the key, optionally pick which models it can access (default "All" is fine)
  7. Click Create secret key
  8. Copy the key (starts with sk-, then either proj- for project keys or a longer prefix for legacy keys)
  9. Paste into your app. OpenAI also only shows the key once.

OpenAI's GPT model family in 2026:

Google Gemini via AI Studio (5 minutes)

Step-by-step

  1. Go to aistudio.google.com and log in with a Google account
  2. Click Get API key in the left navigation
  3. Pick or create a Google Cloud project (the prompt is straightforward; "default project" is fine)
  4. Click Create API key
  5. Copy the key (starts with AIza)
  6. Paste into your app
Important Gemini caveat. The free tier of Gemini may use your prompts to improve Google's products by default. If you're going to send sensitive content through Gemini, either upgrade to the paid tier (Pay as You Go pricing in Google Cloud Console) or only send non-sensitive prompts. Read the Gemini API terms before relying on the free tier.

Gemini's models in 2026:

The hard spending cap (do this first time, every time)

I cannot stress this enough. Set a hard monthly spending cap on every provider you use. Three reasons:

  1. Protects against bugs. If a tool starts looping, you don't want to find out via a $1,200 bill. The cap stops the bleed at whatever number you set.
  2. Protects against leaked keys. If your key leaks (you accidentally paste it in a Slack message, you get phished), the cap limits damage to one month's worth.
  3. Helps you learn your usage. Setting a cap of $10 the first month forces you to notice your actual usage. You can raise the cap later once you see real numbers.

Recommended starting caps: $20/month per provider. Adjust upward after a month of real usage data.

Security best practices

1. Use one key per app

If a key leaks or you stop using an app, revoking that one key doesn't break anything else. Keys are free to create. Don't reuse them across apps.

2. Never commit keys to Git

If you're a developer using these keys in code, add the file containing them to your .gitignore. If you accidentally commit a key, GitHub's secret scanning will email you within minutes; revoke and rotate immediately. The provider's logs will show you any unauthorized use.

3. Use OS-level secret storage

Good apps store API keys in:

Avoid apps that store keys in localStorage or plaintext files. Projelli uses the OS keychain on each platform.

4. Rotate periodically

Once a year, regenerate your keys. Easy ritual: pick a date (your birthday, January 1st, whatever), set a calendar reminder, generate new keys, paste into your apps, revoke old keys. Takes 10 minutes. Limits the blast radius of any unnoticed exposure.

5. Watch for suspicious usage

Each provider's dashboard shows usage by day. Once a month, glance at your usage chart. If you see a spike on a day you weren't working, that's a signal a key might be in use somewhere unexpected.

Common errors and how to fix them

Error Likely cause Fix
401 Unauthorized / "Invalid API Key" Typo, extra space, or the key was regenerated Regenerate, paste cleanly without trailing whitespace
402 Payment Required / "Insufficient credits" Prepaid balance ran out, or card declined Add credits in the provider's billing section
429 Rate Limit Exceeded Too many requests in a short window Wait a minute. If persistent, your account tier may be capped, request a tier upgrade
403 Forbidden / "Model not allowed" The key doesn't have access to the model you're requesting Check the key's permissions; some providers scope keys to specific models
"Hard limit reached" You hit your monthly spending cap Wait until next billing cycle, or raise the cap
App says "key works" but no response Network issue, or AI provider is having an outage Check the provider's status page; switch to a different provider if your app supports multiple

How to paste the key into Projelli specifically

If you're using Projelli, the flow after generating a key is:

  1. Open Projelli
  2. Press Ctrl+, (Windows / Linux) or Cmd+, (Mac) to open Settings
  3. Go to the AI tab
  4. Click Manage API Keys
  5. Find the row for the provider you set up (Claude, OpenAI, or Gemini)
  6. Paste the key into the input
  7. Click Save
  8. Click Test connection to verify the key works

The key encrypts to your OS keychain and never appears in plaintext anywhere afterward, including in localStorage, log files, or sent over the network. If you uninstall Projelli, the key stays in the keychain unless you remove it manually.

For the Projelli-specific user guide that goes deeper, see /docs/api-keys.

Frequently asked questions

How long does it take to set up an API key?

About 5 minutes per provider. Sign up (1 min), add billing (2 min), generate key (1 min), paste into app (1 min). Setting a spending cap adds another minute and is strongly recommended.

Do I have to add a credit card?

Anthropic and OpenAI both require payment information to use the API at all. Google Gemini has a generous free tier that can work without payment info, with usage caveats. You can typically start with $5 of prepaid balance and use it down at your own pace.

What if my key gets exposed?

All three providers let you revoke a key with one click and generate a new one. Revoke the exposed key immediately. The hard monthly spending cap (which you should always set) limits damage even if a key leaks. After revocation, the old key returns auth errors and the new key works normally.

Can one API key power multiple apps?

Yes. One key works across any number of apps. Most people generate one key per app though, because then revoking one key doesn't break other apps. Keys are free to create.

How much will I actually spend?

For typical indie founder usage (30-90 minutes/day of AI conversation), expect $2-15/month per provider. Heavy users (multi-hour daily) might see $20-50/month. Setting a hard cap of $20 is a reasonable starting point that you can raise once you see your real usage pattern.

What if I get an authentication error?

Common causes: typo when pasting (extra space at start or end), key was regenerated and the old one is in the app, or the provider's account is in a payment-failed state. Fix: regenerate the key, paste cleanly, verify billing is active.

Can I use the same key on multiple machines?

Yes, but it's better to generate one key per machine. If your laptop is lost or stolen, revoking that machine's key doesn't break your desktop's setup.

Do I need to set up all three providers?

No. Pick one to start. Most founders use Claude for the bulk of their work and add OpenAI or Gemini later if they want a second opinion or to take advantage of model strengths. The cost overhead of having keys for all three is zero (you only pay for what you use).

What to read next

Try it with Projelli

Free download. Pro is $49 one-time, Lifetime is $99 one-time. The first 100 buyers get Lifetime at $29. Bring your own Claude / OpenAI / Gemini key.

Get Projelli