OpenAI (ChatGPT) API Key: How to Get One and Keep It Safe

You create an OpenAI API key, the key for the models behind ChatGPT, on the API keys page of the OpenAI platform. The full key is shown only once, when you create it, so copy it straight away.

API usage is billed separately from ChatGPT, so a ChatGPT Plus or Pro plan doesn't pay for API calls.

Steps checked against OpenAI (ChatGPT)'s own docs in Nov 2026. Menus change, so if a screen looks different, follow the linked docs.

How to get an OpenAI (ChatGPT) API key

  1. Sign in to the OpenAI platform (the developer platform, separate from ChatGPT).
  2. Open the API keys page and create a new secret key in the project you want it to use.
  3. Choose its permissions: All, Restricted (only the endpoints you pick) or Read Only.
  4. Copy the key. OpenAI shows the full key only once, and you can't view it again in your account.
  5. Save it as an environment variable called OPENAI_API_KEY, the name OpenAI recommends.

To go beyond the first test requests, add credits under Billing. OpenAI says "API usage is billed separately from your ChatGPT subscription."

Project keys can be created with an expiration date, and organization owners can set a maximum key lifetime in the platform settings.

Check a key you already have

Not sure which service a key in your config belongs to, or whether you just pasted one somewhere? Paste it below to see what it is and how to revoke it.

Runs only in your browser. The check happens on this page. What you paste isn't sent anywhere, saved or logged, and the checker never contacts the provider. Want proof? Open your browser's network tab, or turn off Wi-Fi, and paste.

What an OpenAI (ChatGPT) API key looks like

Current OpenAI (ChatGPT) keys start with sk-proj- (project keys), sk-svcacct- (service accounts) or sk-admin- (admin keys). Older user keys start with plain sk-.

OpenAI keys also contain the marker T3BlbkFJ, which is "OpenAI" in base64. The gitleaks rule set uses it to tell OpenAI keys apart from other sk- keys.

How to store your OpenAI (ChatGPT) API key safely

  • Keep it in OPENAI_API_KEY or a secret manager, never in your code or in a website's JavaScript.
  • Give every team member and every app its own key. OpenAI recommends a unique key per person, so one leak doesn't mean rotating everyone's.
  • Use Restricted or Read Only permissions where an app doesn't need everything, and set an expiration date on project keys.
  • Where your platform supports it, OpenAI recommends workload identity federation over long-lived keys, and you can limit keys to known IP addresses.

Never paste your OpenAI (ChatGPT) API key into an AI chat

It usually happens while debugging. The error sits next to a config file, you paste the whole thing into ChatGPT or Claude, and the key goes in with everything else.

Once it's sent, the key is stored on someone else's servers, in the chat history, and possibly in training data, depending on your account settings. Deleting the chat doesn't take it back, so treat any key you pasted as exposed and rotate it.

We wrote a step-by-step guide for that moment: what to do in the first hour after pasting an API key into ChatGPT. And if a tool you installed might have read your keys, see how to check whether your AI keys were exposed.

What to do if your OpenAI (ChatGPT) API key leaks

Rotate first and investigate second. A key that no longer works can't be misused.

  1. Open the API keys page on the OpenAI platform and delete (revoke) the exposed key. OpenAI says to rotate a leaked key immediately.
  2. Create a new key with the narrowest permissions that work and update your apps.
  3. Check the Usage page for requests you didn't make since the key was exposed.

How Sequirly catches keys at the paste

We build Sequirly, a browser extension that checks what you're about to send to ChatGPT, Claude, Gemini and other AI tools. When a prompt contains an API key, a password or other sensitive data, Sequirly warns you before it leaves your browser, so you can remove it and send the rest.

Sequirly holds an API key before it reaches ChatGPT, then flags customer data in the next prompt.

The check runs inside your browser, and Sequirly says it never sees, stores or sends the values it finds.

There's plenty it doesn't do, so you know where the gaps are:

  • It doesn't scan your code, repos or servers. Use a secret scanner such as gitleaks for that.
  • It doesn't revoke keys or check whether a key is live. Rotation is still on you.
  • It only knows keys by their shape, so a key with no prefix (like Mistral's) can slip past it, just as it slips past the checker above.
  • It warns before it blocks, so a person can still choose to send.

Curious how to test that claim yourself? Our post on whether Sequirly is safe to install walks through a network test you can run.

Common Questions

Is the OpenAI API free with ChatGPT Plus?

No. OpenAI says ChatGPT and the API platform have separate billing, and API usage is billed separately from your ChatGPT subscription.

Where do I find my OpenAI (ChatGPT) API key?

Your keys are listed on the API keys page of the OpenAI platform (platform.openai.com/api-keys). The full key is shown only once, so if you lost it, create a new one.

Can I limit what an OpenAI (ChatGPT) API key can do?

Yes. Each key can have All, Restricted or Read Only permissions, and project keys can have an expiration date.

What does an OpenAI (ChatGPT) API key look like?

Current OpenAI (ChatGPT) keys start with sk-proj-, sk-svcacct- or sk-admin-, and all OpenAI keys contain the string T3BlbkFJ. Older user keys start with sk-.

Sources

Guides for other API keys

Catch the key before it leaves

If you'd like a warning the next time a key ends up in a prompt, try Sequirly now. Or if you'd rather talk it through with us first, book a quick demo.