Magento 2 AI Connector v1.x How to Get API Keys

In this article, you will find step-by-step instructions on how to obtain API keys for each supported AI provider. You will need these keys to connect your preferred AI services in the Magento 2 AI Connector extension configuration.

Anthropic (Claude) API Key

Step 1: Log in to your Anthropic account

  1. Go to https://platform.claude.com/dashboard and log in to your account.
  2. Click the Get API Key button on the dashboard.
Magento 2 AI Connector: Anthropic (Claude) API Key

Step 2. Create a new API key

  1. In the Key Name field, enter a name to identify your key.
  2. Select the Workspace this key will belong to.
  3. Click Create API Key to confirm.
Magento 2 AI Connector: Anthropic (Claude) API Key

Step 3. Copy your API key

  1. Once the key is generated, copy it and store it in a safe place.
  2. Click Continue to proceed — you will be taken back to the dashboard, where all your created keys are listed.
  3. Paste this key into the API Key field under Anthropic (Claude) in the AI Connector Configuration.
Magento 2 AI Connector: Anthropic (Claude) API Key

Check out the official documentation here.

Google (Gemini) API Key

Step 1. Log in to Google AI Studio

  1. Go to https://aistudio.google.com/ and log in with your Google account.
  2. Click the Get API Key button.
Magento 2 AI Connector: Google (Gemini) API Key

Step 2. Create a new API key

  1. Click the Create API Key button.
  2. Enter a name for your key in the name field.
  3. Select the Project this key will belong to.
  4. Click Create key to confirm.
Magento 2 AI Connector: Google (Gemini) API Key
Magento 2 AI Connector: Google (Gemini) API Key

Step 3. Copy your API key

  1. The key will appear on your dashboard. Click on the key entry to reveal the full key value and copy it.
  2. Paste this key into the API Key field under Google (Gemini) in the AI Connector Configuration.

Check out the official documentation here.

OpenAI (GPT) API Key

Step 1. Log in to your OpenAI account

  1. Go to https://platform.openai.com/home and log in to your account.
  2. In the left sidebar, navigate to API Keys.
  3. Click the Create new secret key button.
Magento 2 AI Connector: OpenAI (GPT) API Key

Step 2. Create a new API key

  1. In the Name field, enter a name for your key to identify it later.
  2. Select the Project this key will belong to.
  3. Click Create secret key to confirm.
Magento 2 AI Connector: OpenAI (GPT) API Key

Step 3. Copy your API key

  1. Once the key is generated, copy it immediately and store it in a safe place — OpenAI will not show it again after you close the dialog.
  2. Paste this key into the API Key field under OpenAI (GPT) in the AI Connector Configuration.
Magento 2 AI Connector: OpenAI (GPT) API Key

Check out the official documentation here.

OpenRouter API Key

This section explains how to obtain an API key for OpenRouter, which gives you unified access to a wide range of AI models from different providers through a single endpoint. You will need this key to connect OpenRouter in the Magento 2 AI Connector extension configuration.

Step 1. Log in to your OpenRouter account

  1. Go to https://openrouter.ai/settings/keys and log in to your account.
  2. In the left sidebar, navigate to API Keys.
  3. Click the New Key button.
Step 1. Log in to your OpenRouter account

Step 2. Create a new API key

  1. In the Name field, enter a name to identify your key later.
  2. Optionally, set a Credit limit — leave it blank for unlimited usage.
  3. Optionally, configure Reset limit and Expiration if you want the key to renew or expire automatically.
  4. Click Create to confirm.
Step 2. Create a new API key

Step 3. Copy your API key

  1. Once the key is generated, copy it immediately and store it in a safe place — OpenRouter will not show it again after you close the dialog.
  2. Paste this key into the API Key field under OpenRouter in the AI Connector Configuration.
Step 3. Copy your API key

Your created keys are listed on the API Keys page, where you can review their usage, limits, and status at any time.

Check out the official documentation here.

Hugging Face API Key

Hugging Face opens the door to the open-source side of AI: hundreds of community and enterprise models served through a single Inference Providers endpoint. This section explains how to generate the access token you’ll need to connect Hugging Face in the Magento 2 AI Connector configuration.

Step 1. Log in and open the Access Tokens page

  1. Go to https://huggingface.co/login and log in to your account.
  2. Confirm your email address if you haven’t already.
  3. Open https://huggingface.co/settings/tokens.
  4. Click the Create new token button.
Hugging Face API Key: Log in and open the Access Tokens page

Step 2. Create a Fine-grained token

  1. Select the Fine-grained tab at the top.
  2. In the Token name field, enter a name to identify your token later, for example magento-aiconnector.
  3. Under the Inference section, enable Make calls to Inference Providers — this is the only permission the module requires.
  4. Leave all other permissions unchecked.
  5. Click the Create token button at the bottom of the page.
Hugging Face API Key: Create a Fine-grained token

Step 3. Create and copy your token

  1. Once the token is generated, copy it immediately and store it in a safe place — Hugging Face will show it only once. If you lose it, you’ll need to create a new one.
Hugging Face API Key: Click the Create token button
  1. Paste this token into the API Token field under Hugging Face tab in the AI Connector Configuration, then click Save Config.
  2. Click Reload Models to pull the available model list from the router, then use Test Connection to verify the token works.
Hugging Face API Key: set in the extension
Was this article helpful?