API key not stored
-
When I copy the OpenAI API key into the dashboard and leave the field, I get the message:
Failed to update the API key.
What can I do? Can I store it by hand in the database?
-
Please try the following steps:
– Deactivate and then reactivate the plugin to see if that fixes the issue.
– If the problem persists, you can access your database using a plugin like WP phpMyAdmin. From there, locate the wp_wpaicg table. You can either delete this table so it gets recreated automatically, or insert the required data manually.- Deactivate and activate doesn’t change it
- there is no table wp_wpaicg
- there are entries in wp_options like wpaicg_provider, wpaicg_ai_model but nothing for the API key. Here are some examples (there are 49 in total):
If you tell me the option_name I’ll put it in manually.
Thanks in advance.
Thanks for your response.
- deactivate / activate doesn’t fix the issue
- there is no table named wp_wpaicg
- in table wp_options are entries with option_name wpaicg_* and _wpaicg_*
- I found wpaicg_provider (e.g. OpenAI) and wpaicg_ai_model (e.g. gpt-4o-mini)
- Can’t find an entry named wpaicg_api_key or so
If you can tell me the correkt option_name I’ll put it in.
so that is the root cause why you are not able to store the api key.
it seems like for some reason main table (wp_wpaicg) is not created in your db. sometimes this happens when the plugin is installed on multisite network.
so you need to create that table and insert data (make sure to backup you db before performing below command)
CREATE TABLEwp_wpaicg` (
IDmediumint NOT NULL,
nametext COLLATE utf8mb4_unicode_520_ci NOT NULL,
temperaturefloat NOT NULL,
max_tokensfloat NOT NULL,
top_pfloat NOT NULL,
best_offloat NOT NULL,
frequency_penaltyfloat NOT NULL,
presence_penaltyfloat NOT NULL,
img_sizetext COLLATE utf8mb4_unicode_520_ci NOT NULL,
api_keytext COLLATE utf8mb4_unicode_520_ci NOT NULL,
wpai_languagevarchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL,
wpai_add_imgtinyint(1) NOT NULL,
wpai_add_introtinyint(1) NOT NULL,
wpai_add_conclusiontinyint(1) NOT NULL,
wpai_add_taglinetinyint(1) NOT NULL,
wpai_add_faqtinyint(1) NOT NULL,
wpai_add_keywords_boldtinyint(1) NOT NULL,
wpai_number_of_headingint NOT NULL,
wpai_modify_headingstinyint(1) NOT NULL,
wpai_heading_tagvarchar(10) COLLATE utf8mb4_unicode_520_ci NOT NULL,
wpai_writing_stylevarchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL,
wpai_writing_tonevarchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL,
wpai_target_urlvarchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL,
wpai_target_url_ctavarchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL,
wpai_cta_posvarchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL,
added_datedatetime NOT NULL DEFAULT ‘0000-00-00 00:00:00’,
modified_datedatetime NOT NULL DEFAULT ‘0000-00-00 00:00:00’
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;—
— Dumping data for tablewp_wpaicg
—INSERT INTO
wp_wpaicg(ID,name,temperature,max_tokens,top_p,best_of,frequency_penalty,presence_penalty,img_size,api_key,wpai_language,wpai_add_img,wpai_add_intro,wpai_add_conclusion,wpai_add_tagline,wpai_add_faq,wpai_add_keywords_bold,wpai_number_of_heading,wpai_modify_headings,wpai_heading_tag,wpai_writing_style,wpai_writing_tone,wpai_target_url,wpai_target_url_cta,wpai_cta_pos,added_date,modified_date) VALUES
(1, ‘wpaicg_settings’, 1, 1500, 0.01, 1, 0.01, 0.01, ‘1024×1024’, ‘sk…’, ‘en’, 1, 0, 0, 0, 0, 0, 3, 0, ‘h2’, ‘infor’, ‘formal’, ”, ”, ‘beg’, ‘2024-02-29 15:44:04’, ‘2024-02-29 15:44:04’);`It’s a new WordPress 6.8.1 single site installation only to test AI Power. There was no other plugin installed before.
When I’m changing other settings, they are stored in wp_options and read next time as well. I can see the changes in the database and the dashboard.
I created the new table and filled it with the given values. Changing settings changed values in the options table – not in the new one.
I deleted all %aicg% option_name entries and the new table. Then I deactivated and uninstalled the plugin. After a new installation, there wasn’t the new table but the entries in wp_options were generated … without api_key.
Any idea? I hope we can figure it out.
pls forget about options table.
the issue is wp_wpaicg table..
i didnt understand this part “Changing settings changed values in the options table ā not in the new one.”
what do you mean?
if you already created that table then you should be able to store the api key now.
After all the steps including new installation the values are stored in wp_options again. The fields with option_name wpaicg_% where regenerated.
I mean: When I go to the AI Power Dashboard in WordPress and change values, e.g. Engine from OpenAI to Google, I can see the change in wp_options -> wpaicg_provider changing ist option_value from OpenAI to Google.
When I put in the API key the same failure rises.
AI Power doesn’t access the new table. It ignores it. It accesses wp_options. It creates fields in wp_options. It creates fields and stores values in wp_options after reinstall.
yes pls dont explain to me how it works, i am the one who wrote it š
the point is: master api key is stored in wp_wpaicg table. if that table dont exist then nothing is going to work.
I tell you how it works here – don’t blame your (potential) customer if there’s a bug in your plugin.
Here you can see it:
https://interim24.expert/Screenshot_2025-05-07_214617.png
https://interim24.expert/Screenshot_2025-05-07_214742.png
As you can see the table is there. The field has the given dummy value but putting in the real key generates the error and the dummy is still there.
-
This reply was modified 11 months, 1 week ago by
wphr24.
i am not blaming you. i am trying to help. but pls forget about options table. it has nothing to do with the issue.
lets try to troubleshoot.
can you open “developer tools” in google chrome and try to update the api key again and see if there is any error in the console log or network tab?
That was the first i did.
Console: No errors. No warnings.
Network:
admin-ajax.php 200 xhr load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,wp-dom-ready,wp-hooks&ver=6.8.1:2 617 B 275 MS
stack trace:
send @ https://interim24.expert/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,wp-dom-ready,wp-hooks&ver=6.8.1:2
ajax @ https://interim24.expert/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,wp-dom-ready,wp-hooks&ver=6.8.1:2
(anonymous) @ https://interim24.expert/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,wp-dom-ready,wp-hooks&ver=6.8.1:5
(anonymous) @ https://interim24.expert/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,wp-dom-ready,wp-hooks&ver=6.8.1:5
(anonymous) @ https://interim24.expert/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,wp-dom-ready,wp-hooks&ver=6.8.1:2
saveApiKey @ https://interim24.expert/wp-content/plugins/gpt3-ai-content-generator/admin/js/wp-ai-content-generator-admin.js?ver=1.9.18:100
(anonymous) @ https://interim24.expert/wp-content/plugins/gpt3-ai-content-generator/admin/js/wp-ai-content-generator-admin.js?ver=1.9.18:134
dispatch @ https://interim24.expert/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,wp-dom-ready,wp-hooks&ver=6.8.1:2
(anonymous) @ https://interim24.expert/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,wp-dom-ready,wp-hooks&ver=6.8.1:2Thanks for your help on the other channel.
from the screenshots, it seems the main table wasn’t created properly during the initial launch likely due to an issue retrieving the table prefix.
glad it’s resolved now.
The topic ‘API key not stored’ is closed to new replies.