Skip to content
BYOK Tools

Setup

How to get API keys from OpenAI, Anthropic, Google and OpenRouter

Create a provider account, generate a key, set a spend limit, then connect it to an app through a settings screen, environment variable or base URL.

By the BYOK Tools editorial team · 12 November 2026 · 7 min read

The process is similar for every provider: create an account, add billing, generate a key and set a limit. Provider dashboards change often, so treat the menu names below as approximate.

OpenAI

  1. Sign in to the OpenAI Platform at platform.openai.com. API billing is separate from a ChatGPT subscription.
  2. Add credit under Billing. Prepaid credit is the simplest way to cap spend.
  3. Open API keys, create a secret key, name it after the app that will use it and copy it. It is shown once.
  4. Set usage limits in your organisation or project settings.

Base URL: https://api.openai.com/v1. Conventional environment variable: OPENAI_API_KEY.

Anthropic (Claude)

  1. Sign in to the Anthropic Console at console.anthropic.com.
  2. Add credit under Billing.
  3. Go to API keys, create a key and name it for its app.
  4. Set a monthly spend limit under Limits.

Base URL: https://api.anthropic.com. Conventional environment variable: ANTHROPIC_API_KEY. Anthropic's native Messages API uses its own request format and an x-api-key header, so check that your app supports Anthropic directly or uses a compatibility layer.

Google Gemini

  1. Open Google AI Studio at aistudio.google.com and choose Get API key.
  2. A free tier with rate limits is available, which is useful for testing. Free-tier data terms can differ from paid terms, so read them before sending sensitive material.
  3. Enable billing on the linked Google Cloud project for higher rate limits.

Conventional environment variable: GEMINI_API_KEY. Google also provides an OpenAI-compatible endpoint for Gemini models.

OpenRouter

  1. Create an account at openrouter.ai and add credits.
  2. Create a key under Keys. Each key can have its own credit limit.
  3. One OpenRouter key gives access to models from many labs. See OpenRouter explained.

Base URL: https://openrouter.ai/api/v1. Conventional environment variable: OPENROUTER_API_KEY.

Connecting a key

Desktop and web apps. Look for a Settings → Models or Providers screen. Paste the key, choose a default model and send a short test message.

Command-line tools and agents. Most read keys from environment variables. Set them in your shell profile or a project .env file that is excluded from version control:

export OPENAI_API_KEY="sk-..."
export ANTHROPIC_API_KEY="sk-ant-..."

Custom endpoints. Apps that support an OpenAI-compatible provider ask for three values: a base URL, a key and a model name. That is how you point one app at OpenRouter, Groq or a local server. See OpenAI-compatible endpoints.

New accounts often start on low rate limits that rise with spend history. If you see HTTP 429 errors early on, that is usually the cause.

Then work through the security checklist, and browse apps by provider: OpenAI, Anthropic, Google, OpenRouter.

Editorial independence: rankings are based on our own testing and research. Some outbound links may in future be affiliate links; that never affects scores. See our editorial policy.

Get the BYOK Brief

New listings, price changes and model releases. Fortnightly.

Fortnightly: new listings, price changes and model releases. Unsubscribe at any time.