The Decoder / One term

What is an API key, and do I need one?

An API key is a long secret string that lets a program, not a person, use an AI model, billed to your account by the token. You need one only to build or run software that calls the model. The chat apps do not need one.

By Mstimaj Numbers checked 6 November 2026 Updated 6 November 2026 Level AI Fluency Tool ChatGPT

Sign in to save your place and mark this done. Free, no card.

A single brass key on a dark desk beside a small meter whose needle sits near zero

An API key is a password for software. When a program sends a question to Claude or ChatGPT without a person typing it, it includes the key, and the company knows whose account to bill. You do not need one to use the chat apps; those come with your plan. You need one when you run a tool that talks to the model directly, or build something yourself. Then you pay per token used, not a flat monthly fee.

Key facts

  • $2per million input tokens on Claude Sonnet 5.5, and $10 per million output
  • $0.10per million input tokens on Claude Haiku 5.5, the cheap one, for prompts up to 100,000 tokens
  • 1place a Claude key is made: the Console, under Settings and then Keys
  • 1environment variable the tools read it from: ANTHROPIC_API_KEY
  • platform.claude.com, Pricing (model table) and Get started (key creation, ANTHROPIC_API_KEY); read 6 November 2026

Do I need one?

If you open ChatGPT, Claude or Gemini and type, no. Your plan covers it and there is no key anywhere. You need a key in two situations. The first is when a tool you install asks for one: a plugin, a writing app, an automation, a script someone gave you. It is asking because it talks to the model on your behalf, and it needs your account to bill. The second is when you build something yourself and your code calls the model. In both cases the key is how the company knows the requests are yours. Claude Code is the one common tool that can go either way: it signs in with a subscription by default, and uses a key only if you set one.

Where do I get one?

From the developer side of the company, not the chat app. For Claude it is the Claude Console at platform.claude.com, under Settings and then Keys, after you add pre-paid credit. The key is shown once; you copy it and store it. Programs look for it in an environment variable, a named setting on your computer; for Claude the name is ANTHROPIC_API_KEY, and the documentation’s own example is export ANTHROPIC_API_KEY="your-api-key-here". OpenAI and Google have the same shape: a developer console, a credit balance, a key, a variable.

What does it cost?

Per token, in both directions. On Anthropic’s pricing page the day this was checked, Claude Sonnet 5.5 is $2 per million input tokens and $10 per million output; Opus 5.5 is $4 and $20; Haiku 5.5 is $0.10 and $0.50 for prompts up to 100,000 tokens. Work it through for one email. A thousand-word reply is about 1,333 tokens, so on Sonnet it costs about a cent and a third to generate. A hundred such emails is a little over a dollar. The surprise comes the other way: a tool that sends a huge document with every request pays input tokens on the whole document every time. The bill is about volume, not about any single call.

What a program pays per million tokens on the Claude API, from the pricing page
Model Input Output
Claude Haiku 5.5 (prompts up to 100K tokens) $0.10 $0.50
Claude Sonnet 5.5 $2 $10
Claude Opus 5.5 $4 $20
Output price per million tokens OUTPUT PRICE PER MILLION TOKENS Haiku 5.5 $0.50 USD Sonnet 5.5 $10 USD Opus 5.5 $20 USD
Output is the expensive direction. A million tokens is roughly 750,000 words.

How do I keep it safe?

Treat it as a password that spends money. Never paste it into a chat, a screenshot, a shared document or a public code repository; anyone who has it can run up your bill. Keep it in the environment variable or a file your code reads and nothing else can see. If it leaks, delete it in the console and make a new one; that is a one-minute job and the old key stops working at once. Set a spending limit in the console before you hand a key to any tool, so a bug cannot cost more than you chose.

Ask what did not make sense

Comments go through our own form and are read before they appear. Links are not allowed; describe it in words.

Comments are read before they appear.

The newsletter

Get the next term.

One email when something goes up. The argument, the film and the term, nothing else. One click to leave.

Have a question now? Ask Mstimaj, she knows the archive.