Local AI

How to Get an OpenAI API Key: Create, Set Up and Use It

Get an OpenAI API key from the API keys page in the official developer platform: https://platform.openai.com/settings/organization/api-keys. Sign in, select the intended project, create a new secret key and save its complete value privately. You do not obtain this credential from a ChatGPT conversation or from somebody selling shared keys.

This guide takes you from account access to a small MetaStocker test, including billing, spending controls and common errors. Official documentation and MetaStocker controls were checked on October 2, 2026. Dashboard options can depend on your account permissions. Creating a key does not itself mean that paid API requests are available or free.

If you want to understand the credential before setting it up, read: https://metastocker.net/blog/what-is-openai-api-key.html.

From the official API dashboard to a checked first test: Create your key — Sign in, confirm the project and save the secret privately.; Check billing and limits — Separate spend alerts from an enforced spending cap.; Test one image — Connect MetaStocker, review metadata and check API usage.
The workflow developed in this guide.

1. Open the official API key page and sign in

Open the address above in your browser. If the platform requests authentication, sign in to your OpenAI account or follow its registration process. Complete any account checks shown by the official platform. Use a personal account you control, or an organization account whose owner has granted you access.

Confirm the organization and project before creating credentials. A project groups the relevant API resources and access. If key creation is unavailable, check your permissions with the project owner; an organization policy can restrict which keys may be created. A missing button does not mean you need to buy a key elsewhere.

  • Check that the website address is platform.openai.com.
  • Choose the organization and project you intend to use.
  • Keep account sign-in credentials separate from the API key.

2. Create a secret key and save the full value

In the API keys area, choose the action for creating a new secret key. Give it a recognizable name, such as MetaStocker personal test, and confirm the intended project. Review the permissions and expiration settings offered to you. Grant only the access your application needs; if you restrict access, it must still permit the API operation that application uses.

Create the key and immediately save its full secret value in a private password manager or another protected location. The key name, project identifier and shortened preview are not usable substitutes for the secret. If you no longer have the full value and the dashboard does not reveal it, create a replacement instead of trying to reconstruct it.

  • Use a descriptive name so you can identify this key later.
  • Confirm its project, permissions and any expiration date.
  • Copy the entire secret without extra spaces or line breaks.
  • Do not put the secret into screenshots, shared notes or support messages.

3. Check API billing and control spending

For the API-key route described here, charges belong to the developer API account. A ChatGPT subscription does not supply a paid API balance for MetaStocker. Open https://platform.openai.com/settings/organization/billing and check the payment setup or credit balance available to your account. Follow the billing instructions shown there; do not assume that registration includes free credits.

A spend alert sends a notification but allows requests to continue. A hard spend limit stops affected API traffic once tracked spending reaches the cap. In organization or project Limits, use Spend, then Edit spend limit; turn on Enforce a hard limit if you want enforcement and have permission. Enforcement can lag slightly. Review actual costs at https://platform.openai.com/usage before expanding a test.

  • Confirm billing access before processing a batch.
  • Distinguish a notification threshold from an enforced spending limit.
  • Check both organization and project restrictions.
  • Do not budget from an old tutorial's prices or promised trial credits.

4. Connect the key to MetaStocker and test one image

Open https://metastocker.net/. In Model, choose GPT-6 Luna under OpenAI API · paid usage, then paste your secret into OpenAI API key. The generator interface is English. Import one non-sensitive image, check Tags Count and any batch description, and press Start. In this mode, image previews and context are sent directly from your browser to OpenAI using your key.

Review the resulting title, keywords and category against the actual image, then check API usage. A successful request proves that this small test worked; it does not establish the accuracy of every future result. MetaStocker temporarily keeps the key in browser session storage. That is not a password vault, so avoid shared browsers and remove the key from the input when finished.

  • Test one harmless image before importing a large batch.
  • Keep the test description factual and relevant to that image.
  • Review generated metadata before exporting any CSV.
Example test: one photo of a blue ceramic mug on a plain table.
Batch description: Product photo of a blue ceramic mug on a plain table; no people or visible logos.
Check: the title describes the mug, keywords match the visible scene, and no brand or location is invented.

5. What OPENAI_API_KEY means

OPENAI_API_KEY is a common environment variable name used by OpenAI developer tools and SDKs. It is not another account, subscription or kind of key. A program reads the secret from this variable instead of keeping it directly in its source code.

You do not need to configure an environment variable to use MetaStocker: its OpenAI API key input is the relevant control. If you develop your own application, follow the official quickstart for your operating system and use private environment configuration or a secret manager. The example below contains a placeholder, never a working credential.

macOS / Linux example for a developer's own terminal:
export OPENAI_API_KEY="YOUR_PRIVATE_KEY_HERE"
Do not publish a command containing a real key or paste it into a shared log.

6. Diagnose a key that does not work

Read the error message before creating another key or repeating a batch. Authentication, permissions, billing and request-rate errors have different causes. If you contact support, provide the error code and relevant settings with all credentials removed.

For a rate limit, wait as instructed and reduce the request rate. Repeatedly retrying a missing credit balance or a reached spending cap will not restore access. Model or resource access can also depend on project permissions. Correct the specific cause before another small test.

  • 401: check the full key, accidental whitespace, revocation, expiration and intended project.
  • 403 or an access message: check permissions and official availability requirements.
  • 429: inspect the message or error.code to distinguish request-rate limits from credits and spending limits.
  • 400 about service_tier: check the project's permitted service tiers; MetaStocker uses Flex for its API requests.

7. Keep the key private and replace it safely

Treat an API key as a secret that can authorize requests against its associated account. Do not share it with clients, publish it in a repository or embed it in public website code. Supplying your own credential to MetaStocker's personal API input does not make publishing that credential in a website safe.

For planned rotation, create a replacement, update the applications that use it and verify a small request before revoking the old key. If exposure is suspected, revoke the exposed key promptly and review usage. Remove accidental public copies and create a new secret; merely hiding a visible string or deleting a screenshot cannot undo disclosure.

  • Use a private password manager or secret manager.
  • Set an expiration date where appropriate and keep track of replacements.
  • Never ask another person to send you their secret key.

8. FAQ: where to get a key, payment and ChatGPT

Where do I get an OpenAI API key? Use the official platform's API keys page, choose your intended project and create your own secret. The direct dashboard address is given at the beginning of this guide.

Do I need a ChatGPT subscription? A subscription is not required just to follow the API-key setup route. Developer API billing and account access must be checked separately; paying for ChatGPT does not automatically pay for MetaStocker's API calls.

Can I use the API for free? Creating a key is different from paying for requests. Do not assume every account receives a trial balance. Check the credits or offers actually shown in your developer account and the current model prices before sending a request.

9. FAQ: recovering a key and working without one

Can I view a previously created key again? A key's displayed name or masked preview is not its complete secret. If your private copy is lost and the dashboard does not show the full value, create a new key, update your applications and retire the old one when appropriate.

Why does a newly created key not work? Key creation alone does not confirm billing, model access, endpoint permissions or available limits. Start with the actual error and the checks in section 6, rather than generating many replacement keys.

Can MetaStocker work without an OpenAI API key? Yes. Choose a local model and use its download or load control. Local inference runs in your browser without API charges; the initial model download needs internet and compatible hardware. In local mode, your images and prompts are not sent to OpenAI for inference.

Before you continue

  • The key was created in the intended official account and project.
  • The full secret is stored privately and has not appeared in a public file.
  • Billing, permissions and any spending limits have been checked.
  • One non-sensitive MetaStocker test completed and its metadata was reviewed.
  • API usage was checked before starting a larger batch.
  • Temporary key copies and the MetaStocker input were cleared after use.

Sources and editorial approach

Prepared with AI assistance. Worked examples are illustrative. Automated checks do not replace checking the requirements of your stock platform. How these guides are made.