Resource

How to Create an OpenAI Account and Get an API Key

A practical beginner-friendly guide to creating an OpenAI API account, understanding API billing, generating and protecting an API key, connecting it to your AI PHP Apps product, and troubleshooting the first connection.

How to Create an OpenAI Account and Get an API Key

AI PHP Apps products connect to OpenAI through the OpenAI API using an API key that belongs to you. That keeps the software purchase separate from your AI usage: AI PHP Apps provides the self-hosted application, while API usage is managed through your own OpenAI account.

If you have never used an API before, the terminology can sound more technical than the actual setup. This guide explains what the key is, how billing works, how to connect it safely, and what to check if your first request does not work.

Before You Begin: ChatGPT and the OpenAI API Are Different Services

A ChatGPT subscription and OpenAI API usage are separate. Paying for a ChatGPT plan does not automatically provide API usage for a separate application. Your AI PHP Apps product connects through the OpenAI developer platform, so API billing and access must be configured there.

Important: If ChatGPT works in your browser but your self-hosted application reports a billing, quota, or authentication error, check the API account rather than assuming your ChatGPT subscription covers it.

What Is an API Key?

An API key is a private credential that allows your application to authenticate when it sends a request to OpenAI. It should be treated like a password.

Your application sends the key securely from your server when making an API request. Visitors to your website should never need to see or enter your private key.

Step 1: Create or Sign In to Your OpenAI Account

Open the OpenAI developer platform in your browser:

https://platform.openai.com

  1. Create an account or sign in to your existing account.
  2. Complete any account verification that OpenAI requests.
  3. Open the developer/platform dashboard.

OpenAI may change dashboard labels and navigation over time, so the exact location of billing, projects, usage, or API-key controls may differ slightly from screenshots or older tutorials.

Step 2: Configure API Billing

API requests require an API account that is able to incur usage charges. Open the billing or usage section of the developer platform and complete the billing setup shown for your account.

API charges are based on usage rather than the one-time price of your AI PHP Apps software. Your application does not add an additional AI usage markup.

Good Billing Practices

  • Review the usage dashboard periodically.
  • Use any available budget, project, or usage controls that are appropriate for your account.
  • Start with normal testing before placing an application into heavier production use.
  • Investigate unexpected increases in usage rather than assuming they are normal.

Step 3: Create an API Key

Open the API-key area of the developer platform and create a new secret key.

  1. Choose the option to create a new secret key.
  2. Give the key a descriptive name when that option is available, such as the name of the application using it.
  3. Create the key.
  4. Copy the secret immediately and store it securely.
Important: Secret keys may not be shown in full again after creation. Do not rely on being able to return later and copy the same secret.

Use a Separate Key for Important Applications

When practical, use a dedicated key or project for an important application rather than sharing one key across unrelated systems. This makes it easier to replace a credential, investigate usage, and retire access without affecting other applications.

Step 4: Add the Key to Your AI PHP Apps Product

  1. Sign in to your AI PHP Apps product.
  2. Open the application settings area.
  3. Locate the OpenAI API key field.
  4. Paste the complete key exactly as provided.
  5. Save the settings.

Be careful not to copy an extra space before or after the key. A single missing character or added space can cause authentication to fail.

Step 5: Test the Connection

Use the product normally and submit a small test request. A successful AI-generated response confirms several things at once: the key was saved, your server can reach the API, your account has appropriate API access, and the application can process the response.

If the First Test Fails

Do not immediately start changing application files. First capture the exact error message and work through the likely causes in a consistent order.

  1. Check the API key. Make sure it is complete, current, and has no extra spaces.
  2. Check API billing and account status. Confirm that the developer/API account is configured for usage.
  3. Confirm you are checking API billing. A ChatGPT subscription is separate from API billing.
  4. Check server connectivity. Your host must allow outbound HTTPS requests.
  5. Review the exact error. Authentication, rate-limit, billing, timeout, and server errors require different fixes.

Protect Your API Key

Anyone who obtains a working API key may be able to use the associated API account. Keep it private.

  • Do not publish it in a public code repository.
  • Do not place it in public-facing JavaScript or HTML.
  • Do not post it in screenshots, forums, or social media.
  • Do not include it in support messages unless a trusted support process explicitly requires a secure credential-handling method.
  • Do not email the key in plain text when there is no need to do so.

What If a Key Is Exposed?

If you believe a secret key has been exposed, treat it as compromised. Revoke or delete the exposed credential in your OpenAI account, create a replacement, update the application, and test the connection again.

Replacing a compromised key is safer than hoping nobody noticed it.

Can I Change the Key Later?

Yes. You can replace the API key used by your AI PHP Apps product whenever needed. This is useful when rotating credentials, separating applications, or replacing a key that may have been exposed.

Does AI PHP Apps Receive My OpenAI API Charges?

No. OpenAI API usage is associated with your OpenAI account. Your AI PHP Apps software purchase and your API usage are separate expenses.

Before You Leave This Page

  • You have access to the OpenAI developer platform.
  • API billing is configured for your account.
  • You created and securely saved an API key.
  • The key was added to your AI PHP Apps settings.
  • A test request completed successfully.
  • You know where to review API usage.
  • You have not exposed the key publicly.

Next Step

If the application returns an error after setup, use the Common OpenAI Errors guide to identify the error type and work through the appropriate checks.

Need more help?

If you have questions about setting up an AI PHP Apps product, contact support and we’ll help point you in the right direction.

Contact Support