Get and add an OpenAI API key
Create an OpenAI API key, add and verify it in Promptor, and fix the most common key errors.
Promptor uses an OpenAI API key to index your content and, with the default provider, to write chat answers. This guide shows you how to create a key, add it to Promptor and check that it works.
What the key is used for
- With the direct OpenAI provider (the default), the key is used for everything: indexing your content, matching visitor questions to it, and writing the answers.
- With the WordPress AI Client, the key is used only for semantic-search indexing (embeddings). Answers come from the provider set up in WordPress Settings › Connectors. See Choose your AI provider.
OpenAI bills you by usage. The Promptor readme estimates a typical conversation at $0.01–$0.10, depending on the model and the length of the conversation.
With your own key, the free version answers up to 100 questions a month (the allowance resets every month) from up to 35 knowledge base items. Pro removes both limits. See Free vs Pro.
Step 1: Create the key at OpenAI
- Sign in or sign up at platform.openai.com.
- Add a payment method to your OpenAI account. The API doesn't work without one.
- Open the API keys page and create a new secret key.
- Copy the key. It starts with
sk-. OpenAI shows the full key only once, so keep it somewhere safe until you have pasted it.
In your OpenAI account you can set a monthly budget for the project the key belongs to. Combine it with Promptor's own usage limits for two layers of cost control.
Step 2: Add the key to Promptor
- In WordPress, go to Promptor › Settings. The AI Behavior tab opens.
- In the Core API Configuration card, paste the key into OpenAI API Key.
- Click Verify Key. Promptor asks OpenAI whether the key works and shows the result next to the button.
- Click Save Changes.
You can also add the key in step 1 of the setup wizard, under Use your OpenAI API key. See Run the setup wizard.
What Verify Key tells you
| Message | Meaning |
|---|---|
| Success! Your API Key is valid. | The key works. Promptor also loads the list of models your account can use into GPT Model. |
| Error: Invalid API Key. Please check your key and try again. | OpenAI rejected the key. Check for missing characters or a revoked key. |
| API Key cannot be empty. | The field was empty when you clicked the button. |
| Connection Error: … | Your server couldn't reach OpenAI. A firewall or host restriction may block outgoing requests. |
When Promptor keeps your old key
Promptor checks the format of the key when you save. If it doesn't look like an OpenAI key (it should start with sk-), you see The API key format looks unusual. Your previous key has been kept. Saving with the field empty also keeps the key you saved before, so you never lose a working key by accident.
After you save
- If you were on the free trial, it ends and Promptor switches to your key.
- Sync your knowledge base so your content is indexed with your key: Knowledge Bases › Manage, then Sync on the card. See Sync, re-index and clear a knowledge base.
- Pick a model in GPT Model. See Models, temperature and response length.
Replace a key
To switch to a new key, paste it into OpenAI API Key, click Verify Key, then Save Changes. The new key replaces the old one.
Treat the key like a password. Promptor stores it in your WordPress database, so anyone with administrator or database access to the site can reach it. Never paste it into support tickets or screenshots. If a key leaks, revoke it in your OpenAI account and add a new one.
Common problems
- The chat says "Please set up your OpenAI API key or start a free trial in the plugin settings." No key is saved and no trial has started. Add a key as above.
- The chat says "AI service error: …" OpenAI refused the request. Common causes are an invalid key or no remaining credit on your OpenAI account.
- Sync fails with a message about the API key. Sync needs a saved OpenAI key, even when you use the WordPress AI Client for answers.
More fixes are in The chat doesn't answer or shows an error and Error messages explained.
Related
Still need help?
Our support team answers every ticket. Tell us your WordPress version, Promptor version and what you see.
