---
title: How to Connect Your Gemini API Key or Managed Credits
description: Choose between WPFactory Managed Credits and your own Google Gemini API key, then verify the license or test the key.
url: "https://wpfactory.com/docs/ai-product-images-connection-mode/"
updated: "2026-10-05"
category: How to
---

# How to Connect Your Gemini API Key or Managed Credits

To connect [AI Product Image Generator for WooCommerce](https://wpfactory.com/item/ai-product-image-generator-for-woocommerce/) to an AI service, go to **AI Images > Settings > Connection** and choose **Managed Credits** (enter and verify a WPFactory license key, then pay per image with credits) or **Use My API Key** (paste a Google Gemini API key and pay Google directly). Click **Save Connection Settings**.

![AI Images, Settings, Connection tab with both connection mode boxes](https://wpfactory.com/wp-content/uploads/ai-product-images-connection-mode-1.png)

## Which mode should you choose?

|  | Managed Credits | Use My API Key |
| --- | --- | --- |
| Where requests go | WPFactory's image service (`imageai.wpfactory.com`) | Google's Gemini API (`generativelanguage.googleapis.com`), model `gemini-2.5-flash-image` |
| What you need | A license key tied to your site's domain | A Gemini API key from Google AI Studio with billing enabled in your Google account |
| How you pay | Credits bought from WPFactory; the service sets the credits charged per image | Google bills your account for each request; no plugin credits are used |
| Settings honored from the style | Prompt, reference images and watermark (the watermark is added on your site) | Prompt, reference images, watermark and Prompt Strength |
| PHP requirement | cURL extension | Standard WordPress HTTP requests |

In both modes your server downloads each source image from its URL and sends the image file itself, together with the prompt, to the service. See [Getting Started](https://wpfactory.com/docs/ai-product-images-getting-started/) for a full list of what is sent.

## How to set up Managed Credits

1. Go to **AI Images > Settings** and open the **Connection** tab.
2. Select **Managed Credits**.
3. Paste your key into **License Key** and click **Verify License**. On success, **License Active** appears. If the key belongs to another domain, you see *This license key is registered for a different domain.*
4. No key yet? Click **Register New Account**, enter **Your Name** and **Email Address** (the **Website Domain** is filled in for you), tick the terms box and click **Register & Get License**. Open the verification email from the service and follow its instructions to activate your license, then paste the key into **License Key** and click **Verify License**. The registration screen says new accounts start with free credits.
5. Click **Save Connection Settings**.
6. Open the **Credits** tab to see **Available Credits** and **Credits Per Image**. Click **Sync Credits** to refresh the balance, or **Open Dashboard** to buy credits and see usage on WPFactory's site.

Lost your key? Use the **Forgot your license key?** link in the registration window.

## How to use your own Gemini API key

1. Create an API key in [Google AI Studio](https://aistudio.google.com/app/apikey) and make sure billing is set up for the project in your Google account.
2. Go to **AI Images > Settings > Connection** and select **Use My API Key**.
3. Paste the key into **Google Gemini API Key**. Keys start with `AIza` and are 39 characters long; the plugin rejects other formats with *Invalid API key format.*
4. Click **Test Connection**. *API connection successful!* means Google accepted the key.
5. Click **Save Connection Settings**.

## Switching modes

You can switch at any time from the Connection tab. The screen warns that *Switching modes may cancel active generation jobs*, so wait for any bulk run to finish first. Your styles and generated images are not affected.

## FAQ

### Do I need a Google account for Managed Credits?

No. Managed Credits uses WPFactory's service and your license key. A Google account is only needed for **Use My API Key**.

### How often is my credit balance updated?

The balance is updated after each generation and refreshed from the service when it is older than 5 minutes and a plugin screen needs it. Click **Sync Credits** on the Credits tab to refresh it immediately.

### Can I move my license to another domain?

Licenses are tied to the domain they were registered for. The plugin tells you to contact support to transfer a license.

### Where is my API key stored?

In your WordPress database, in the `aipig_settings` option. It is sent to Google in the URL of each request.

Need a hand? Our team answers every ticket on the [AI Image Generator support forum](https://wpfactory.com/support/).

Related articles

- [How to Watermark AI Product Images in WooCommerce](https://wpfactory.com/docs/ai-product-images-watermark/)
- [How to Create Custom AI Image Styles for WooCommerce](https://wpfactory.com/docs/ai-product-images-custom-styles/)
- [How to Bulk Generate AI Images for WooCommerce Products](https://wpfactory.com/docs/ai-product-images-bulk-generate/)
- [How to Replace Product Image Backgrounds in WooCommerce](https://wpfactory.com/docs/ai-product-images-replace-backgrounds/)
- [How to Generate WooCommerce Product Images with AI](https://wpfactory.com/docs/ai-product-images-generate/)
