ChatGPT API Key: How to Get, Set Up & Use It (2026)
An OpenAI API key, often called a ChatGPT API key, is a secret credential you create at platform.openai.com/api-keys with "Create new secret key". It is separate from ChatGPT: OpenAI bills API usage separately from your ChatGPT subscription, so Plus or Pro includes no API credit. As of November 20, 2026, new API accounts use prepaid billing with a $5 minimum credit purchase.
Whether you are building a chatbot, integrating AI into your app, or automating workflows, the OpenAI API is the gateway to programmatic access to OpenAI's models. But the process of getting a key, understanding billing, and configuring it properly can feel overwhelming, especially if you are not a developer.
This guide breaks it down step by step, using OpenAI's developer documentation and the live platform screens as we saw them on November 20, 2026. By the end, you will have a working API key, know how prepaid billing and usage tiers work, and understand best practices for keeping it secure. If you use ChatGPT alongside API development, AI Toolbox (formerly ChatGPT Toolbox) helps you organize those conversations so your debugging sessions, code snippets, and architectural decisions are always findable.
What Is the OpenAI API (and How Is It Different from ChatGPT)?
The OpenAI API gives developers programmatic access to OpenAI's models, while ChatGPT is a consumer-facing chat interface; they are separate products with separate billing.
Many people confuse ChatGPT (the web app) with the OpenAI API. Here is the key difference:
ChatGPT (chatgpt.com) is a ready-to-use product. You type, it responds. Subscriptions include Free, Go, Plus ($20/month), and Pro ($100, $200 or $500/month). See our ChatGPT pricing guide for the plan details.
OpenAI API (platform.openai.com) is a developer tool. You send HTTP requests and receive responses programmatically. You pay for what you use from a prepaid credit balance, not a flat subscription.
Your ChatGPT Plus subscription does not include API access. OpenAI's help article "Managing billing for ChatGPT and the API platform" (article 9039756) says: "API usage is billed separately from your ChatGPT subscription." It adds that API credits, "including promotional API credits", belong to an API organization and "are separate from your ChatGPT subscription and the credit balances used within ChatGPT."
Step 1: Create an OpenAI Platform Account
Go to platform.openai.com, sign up or log in, and you land on the API platform where keys, billing, and usage live.
Billing on the platform is set up on its own, even if you already pay for ChatGPT: OpenAI says "ChatGPT and the API platform have separate billing systems." Here is the process:
How to Get a ChatGPT API Key: Account Setup in 4 Steps
Visit platform.openai.com/signup.
Sign up, or log in if you already have an OpenAI account, and complete any verification the sign-up flow asks for.
Your organization starts with a Default project. OpenAI notes that "Every organization includes a Default project, which can't be deleted."
You land on the platform. In our test on November 20, 2026, the left navigation listed Home, Responses, Decisions (New), Agents (New), Audio, Images, Codex, Daybreak, API Keys, Analytics, Alerts, Logs, Batches, Storage, Plugins, and Settings.
Do not count on free credits. OpenAI's prepaid billing article says "New API accounts use prepaid billing" and mentions free credits only conditionally: "If your account has free credits, those are used before purchased credits."
Step 2: Add a Payment Method and Buy Prepaid Credits
To start paid API usage, add a payment method in your API account billing settings and buy an initial credit balance; the minimum purchase is $5.
Per OpenAI's prepaid billing article (read November 20, 2026), the setup works like this:
Select Add payment details and complete the payment-information step.
Choose your initial credit purchase amount. The minimum purchase is $5, and the default amount is $10.
Review Use auto-reload before confirming your purchase. OpenAI turns it on by default during setup, so decide whether you want automatic top-ups before you confirm.
Expiry: "Purchased credits expire after one year. Credits purchased in Japan after November 13, 2026 expire after 180 days."
Running out: an error with the code credit_balance_exhausted means the organization has no prepaid credits remaining.
Topping up: select Buy credits or Add to credit balance, whichever appears.
For personal projects, a small first purchase and a deliberate choice about auto-reload keep spending predictable while you test.
Step 3: Generate Your API Key
Open API Keys in the platform, select "Create new secret key," fill in the dialog, and copy the key immediately: OpenAI says "a full secret key is only shown when you create it."
Go to platform.openai.com/api-keys (API Keys in the left navigation).
Click "Create new secret key."
Under Owned by, choose You or Service account. With You selected, the dialog says: "This API key is tied to your user and can make requests against the selected project. If you are removed from the organization or project, this key will be disabled."
Give it a descriptive Name (the field is marked Optional), for example "testing-local".
Pick the Project. Our dialog defaulted to Default project.
Set an Expiration from "Select an expiration". OpenAI strongly recommends creating keys with an expiration date.
Choose Permissions: All (full permissions, the default), Restricted (scopes for specific resources or endpoints), or Read only.
Click "Create secret key" and copy the key right away.
User key or service account? OpenAI's API keys guide says: "Use a user-owned project key for your own development work. Use a service account for an application or automation that should have its own permissions and lifecycle." A personal key created within a project "is scoped to that project and its resources." After creation, the keys table shows Name, Status, Tracking ID, Secret Key, Created, Expires, Last used, Created by, Owner type, Permissions, and Monthly spend, which makes it easy to spot keys you no longer use.
Store the key in a password manager or an environment variable. Never hard-code it into your source code. Never commit it to a Git repository.
Building with the OpenAI API and using ChatGPT for code help?
AI Toolbox adds folders, search, and productivity features to ChatGPT, used by 40,000+ users on the Chrome Web Store. Install free.
Step 4: Understand API Pricing and Usage Tiers
OpenAI charges per token at rates that vary by model, and your organization's usage tier sets how much it can spend per month.
Per-model rates change often, so check the current figures on OpenAI's pricing page before you estimate costs. The usage tiers are more stable. OpenAI renamed them: the old numbered tiers are gone, and as of November 20, 2026 the tiers are Free, Build, Launch, and Grow. "Your organization's usage tier upgrades automatically as its total credit purchases reach each threshold."
Usage tier
Qualification
Usage limit
Free
User must be in an allowed geography
$100 / month
Build
$5 in total credit purchases
$500 / month
Launch
$100 in total credit purchases
$5,000 / month
Grow
$500 in total credit purchases
$200,000 / month
Source: OpenAI rate limits guide, read November 20, 2026. To see the per-model limits at your tier, go to Settings > Organization > Limits and review Rate limits. To move up, select Upgrade tier in the Usage Tiers section. OpenAI says API key usage can be monitored on the Usage page once tracking is enabled, and the keys table has a Monthly spend column.
Step 5: Make Your First API Call
A cURL command or a short Python script is all you need to verify your API key works.
First set the key as an environment variable, as OpenAI's quickstart shows: export OPENAI_API_KEY="your_api_key_here". "Each OpenAI SDK automatically reads your API key from the system environment."
The quickest check lists the models your key can use (from OpenAI's API reference):
The reference adds OpenAI-Organization and OpenAI-Project headers, which you only need if you belong to more than one organization or use a legacy user API key.
Here is the Python example from OpenAI's quickstart (install the SDK with pip install openai), which uses the Responses API:
from openai import OpenAI
client = OpenAI()
response = client.responses.create(
model="gpt-6.2-astra",
input="Write a one-sentence bedtime story about a unicorn.",
)
print(response.output_text)
Run it with python example.py. If you get a response, your key is working. The model name is the one OpenAI's quickstart used on November 20, 2026; swap in any model your account lists.
API Key Security Best Practices
Treat your API key like a password: leaked keys can result in unauthorized usage and unexpected charges.
OpenAI's own guidance and the options in the key dialog give you most of what you need. Follow these rules:
Never hard-code keys in source files. Use environment variables or secret managers.
Keep keys server-side. OpenAI says: "Requests should always be routed through your own backend server where you can keep your API key secure."
Add .env to your .gitignore before your first commit.
Set an expiration and rotate. OpenAI strongly recommends "creating keys with an expiration date and establishing a regular key rotation process."
Use project keys with the least permissions: Restricted or Read only where a workload does not need All, and a service account for deployed apps.
Monitor usage on the Usage page and the Monthly spend column during development.
Review auto-reload, which OpenAI turns on by default during billing setup, so automatic top-ups are a choice you made.
If you suspect a key has been compromised, delete it from the API key page with the trash can icon and create a new one. OpenAI says revocations "take effect within a few seconds", and that deleted keys cannot be used, so applications that rely on them may stop working. Administrators can also allow only service-account keys, allow only user-owned project keys, or disable all new API key creation.
Organizing Your API Development Workflow
When you use ChatGPT to debug code, write documentation, and architect your API integration, those conversations pile up fast; folders keep them manageable.
Most developers use ChatGPT alongside the API, asking it to write code, debug errors, explain documentation, or design system architecture. These conversations are valuable reference material, but they get buried quickly. AI Toolbox does not change the API or your OpenAI limits; it organizes the ChatGPT conversations around your build.
With AI Toolbox, you can create folders like "API Integration," "Debugging," and "Architecture Decisions." Pin important conversations (like the one where you figured out rate limiting) so they stay accessible, and use full-text search across your ChatGPT history to find an old error message. The Premium plan ($9.99/month or $49 lifetime) gives you Unlimited folders and search results, which is especially useful for long-running development projects. Developers can find more workflows in ChatGPT for developers.
You can also save frequently used prompts in the Prompt Library and insert them by typing //. For example, save a prompt for debugging API errors: "I'm getting this error from the OpenAI API: {{error_message}}. Here is my code: {{code_snippet}}. What is wrong and how do I fix it?" See how to build a ChatGPT prompt library.
Frequently Asked Questions
Is the OpenAI API free?
OpenAI does not promise free usage. Its docs list a Free usage tier for users in an allowed geography, but also say new API accounts use prepaid billing, so plan on buying credits, with a $5 minimum. If your account has free credits, OpenAI uses them before purchased credits. API usage is billed separately from any ChatGPT plan.
Do I need a ChatGPT Plus subscription to use the API?
No. ChatGPT and the API platform have separate billing systems, and OpenAI says API usage is billed separately from your ChatGPT subscription. You can use the API without any ChatGPT plan, and Plus does not add API credits. Pro and Business are the exception: they include monthly API credits for one linked API organization ($100, $200 or $500 on Pro by tier; $20 per Standard seat or $100 per Premium seat on Business, capped at $500 per workspace), and unused credits expire each billing cycle. API credits belong to your API organization.
What happens if I exceed my API usage limit?
If your prepaid balance runs out, requests fail with an error code of credit_balance_exhausted until the organization has credits again. Separately, each usage tier has a monthly usage limit, from $100 on Free to $200,000 on Grow, and your tier upgrades automatically as total credit purchases grow.
Can I use one API key for multiple projects?
Not with a project key. OpenAI says a personal API key created within a project is scoped to that project and its resources. Create a separate key in each project, or a service account for deployed apps, so a leaked key only exposes one project. Legacy user keys can pass headers to choose an organization and project.
Can I see my OpenAI API key again after creating it?
No. OpenAI shows the full secret key only once, when you create it. The API Keys page later lists each key's name, status, tracking ID, dates, permissions and monthly spend, but not the full secret. If you lose a key, delete it with the trash can icon and create a new one.
How do I keep my API-related ChatGPT conversations organized?
Install AI Toolbox and create dedicated folders for your API work. The free plan includes 2 root folders with unlimited subfolders, 5 pins, 10 saved prompts, and the first 25 search results. For heavier usage across multiple projects, upgrade to Premium ($9.99/month or $49 lifetime) for Unlimited organization features.
Conclusion
Getting an OpenAI API key is straightforward: create an account, buy prepaid credits, generate a key with the right owner, project, expiration and permissions, and make your first call. The harder part is managing costs and keeping your key secure, which comes down to watching auto-reload and usage, scoping keys tightly, and rotating them.
As you build with the API, you will inevitably use ChatGPT itself to help you code, debug, and design. Keep those conversations organized with AI Toolbox. Create folders for each project, pin your breakthrough debugging sessions, and save your best developer prompts in the Prompt Library. AI Toolbox also works on Claude, Gemini and Grok; if you build on Claude too, see Claude for developers. Download it free from the Chrome Web Store.
Last updated: November 20, 2026
Key Terms
AI Toolbox
Chrome extension with 40,000+ users that adds folders, search, export, and prompt management to ChatGPT. Available on all Chromium browsers and Firefox.
Free Plan
2 folders, 5 pinned chats, 10 saved prompts, 25 search results, media gallery, RTL support, and device sync, free forever.
Premium
$9.99/month or $49 one-time lifetime: unlimited folders, unlimited search results, bulk export, and unlimited prompt chains.
Usage tier
OpenAI's API spending level for an organization: Free, Build, Launch or Grow, upgraded automatically by total credit purchases.
Bottom Line
An OpenAI API key comes from platform.openai.com/api-keys, runs on prepaid credits that are billed separately from ChatGPT, and should be a project key with an expiration and only the permissions it needs. AI Toolbox is a Chrome extension with 40,000+ users that enhances ChatGPT with folders, advanced search, bulk export, prompt library, and prompt chaining. Use it to organize your API development conversations, free forever with premium at $9.99/month or $49 one-time lifetime. Related reading: how to get an xAI (Grok) API key, how to get a Gemini API key in Google AI Studio, how to get a Claude API key, ChatGPT image model API guide and Grok pricing and API.
References
Sources, tool names, and authoritative documentation referenced in this article:
OpenAI Help Center articles "Managing billing for ChatGPT and the API platform" (9039756), "Setting up and managing prepaid API billing" (8264644), "Where do I find my OpenAI API key?" (4936850), "Managing projects in the API platform" (9186755) and "Best practices for API key safety" (5112595)
A Full Stack Developer with 7+ years of experience building AI productivity tools. Leads product development and frontend architecture for AI Toolbox, the Chrome extension suite (ChatGPT, Gemini, Grok, and Claude modules) that helps users search, organize, and export their AI conversations.
Liked this guide? Get the next one first.
Join 40,000+ readers getting practical prompts, new features, and subscriber-only deals. No spam, unsubscribe in one click.
New features and product updates before anyone else
Time-saving prompts and workflows for ChatGPT, Gemini, Claude, and Grok