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.
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.
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.
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.
Open the OpenAI developer platform in your browser:
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.
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.
Open the API-key area of the developer platform and create a new secret key.
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.
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.
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.
Do not immediately start changing application files. First capture the exact error message and work through the likely causes in a consistent order.
Anyone who obtains a working API key may be able to use the associated API account. Keep it private.
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.
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.
No. OpenAI API usage is associated with your OpenAI account. Your AI PHP Apps software purchase and your API usage are separate expenses.
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.
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