Getting an AI API Key

Premail asks for an AI API key during setup. If you have never made one, that screen is a wall. This article takes it down. An API key is just a long password that lets Premail send a message's sender and subject to an AI model and get back a category. You create the key once on the provider's own website and paste it into Premail.

You are the provider's customer, not Premail's. The key stays on your Mac, goes straight from your machine to the provider, and Premail has no server that could see it.

Option 1: Anthropic (Claude) — recommended

  1. 1Create an account or sign in at console.anthropic.com.
  2. 2Go to Settings → Billing and add credit. Anthropic will not let a key work against an unfunded account, so this step is not optional. $5 is plenty to start.
  3. 3Go to Settings → API Keys and click Create Key. Any name will do.
  4. 4Copy the key — it starts with sk-ant- — and paste it into Premail's AI Model screen. The key is shown only once, so copy it before closing the dialog.

Premail defaults to Claude Haiku, which costs roughly $0.01 per 1,000 emails classified. For a typical inbox that is cents per month.

Option 2: OpenAI

  1. 1Create an account or sign in at platform.openai.com.
  2. 2Add a payment method and buy credit under Billing. A new account has a zero balance, and keys fail until you fund it.
  3. 3Go to API keys and click Create new secret key.
  4. 4Copy the key — it starts with sk- — and paste it into Premail. It is shown only once.

GPT-4o Mini costs about the same as Claude Haiku for this kind of classification.

Option 3: no key at all

If you would rather not create an account or pay anyone, pick Ollama in Premail instead. It runs the model on your own Mac: no key, no bill, and no email text leaving the machine. Install it from ollama.com, run ollama pull qwen3 in Terminal, and enter qwen3 as the model name. Classification is slower than the cloud and the first download is a few GB.

If your key gets rejected

  • "Credit balance is too low" / "insufficient quota" — the key is fine, the account has no money in it. Add credit in the provider's billing settings.
  • "Invalid API key" — usually a partial paste. Keys are long and are displayed only once; create a fresh one and copy the whole value.
  • Anthropic key in the OpenAI slot (or the reverse) — check the prefix. Anthropic keys start with sk-ant-, OpenAI keys with sk-.
  • A line break in the middle of the key — copy it again in one piece. Premail trims spaces at the ends for you, but it cannot repair a key split in half.
Premail earns nothing from your AI spending. There is no markup and no referral arrangement with either provider — you pay them directly at their own rates.