How to Connect an OpenAI-Compatible API to WordPress AI

How to Connect an OpenAI-Compatible API to WordPress AI

WordPress 7.0 introduces built-in AI features that can connect to various AI providers via API, and we have previously discussed how to use a Google Gemini API Key.

However, not all AI providers are supported directly. If you use an OpenAI-Compatible provider like OpenRouter, OpenWebUI, Ollama, LiteLLM, or other services that provide an OpenAI-compatible endpoint, you can use the plugin Koneek – OpenAI-Compatible Provider as an intermediary.

Why Can't OpenAI-Compatible APIs Be Used Directly?

By default, WordPress AI only supports specific providers. Some OpenAI-Compatible providers use:

  • Different Base URLs.
  • Additional headers.
  • Special authentication formats.
  • Custom endpoints.

As a result, these providers cannot always be used directly with WordPress AI.

Preparation Before Using an OpenAI-Compatible API

Before using an OpenAI-Compatible API, there are a few things you need to prepare:

  • An OpenAI-Compatible API Key, whether it is a free version like from OpenRouter or an API Key from another provider
  • The name of the AI model you will use
  • Using WordPress 7.0 or higher
  • Install and activate the plugin Koneek – OpenAI-Compatible Provider
  • Install and activate the Plugin AI

If all preparations are complete, you can proceed to the next step.

How to Connect an OpenAI-Compatible API to WordPress AI

In this tutorial, we will use a free API from OpenRouter, which you can also obtain from [This Page].

1. Open the Koneek Configuration Page

To open the Koneek plugin configuration page, you can go to the menu Settings > Koneek

Cara Menghubungkan OpenAI-Compatible API ke WordPress AI - WPGan.com - 1

2. Add the OpenAI-Compatible API Configuration

Once you are on the Koneek page, you can add the OpenAI-Compatible API configuration you already have.

  • Name: Enter the name of the API you want to save
  • Provider: Select the AI provider to be used, in this case using OpenAI-Compatible
  • API Key: Enter the API Key you obtained from the OpenAI-Compatible provider, for example from OpenRouter
  • Model: Enter the name of the model you will use. For OpenRouter, this can be found on the page openrouter.ai/models. In this example, we are using the model cohere/north-mini-code:free
  • API URL: Use the OpenAI-Compatible Base URL from the provider you are using. For OpenRouter, you can use https://openrouter.ai/api/v1
  • Timeout: You can leave this blank to use the default timeout. However, if the AI provider you are using requires a long response time, you can input a manual value
Cara Menghubungkan OpenAI-Compatible API ke WordPress AI - WPGan.com - 2

3. Test the Connection and Save

Before saving, be sure to test the connection to ensure that the AI you are using can actually connect.

Cara Menghubungkan OpenAI-Compatible API ke WordPress AI - WPGan.com - 3

If you see a success message, you can save the API Key you just added.

4. Configure the AI Features to Be Enabled

Now you can enable the AI features you want to use from the menu Settings > AI. To enable this, make sure you have activated the plugin AI.

Cara Menghubungkan OpenAI-Compatible API ke WordPress AI - WPGan.com - 4

5. Use AI in WordPress

After enabling the AI features, you can use them, for example, to rewrite sentences or rephrase posts in WordPress, regenerate titles, and more.

Cara Menghubungkan OpenAI-Compatible API ke WordPress AI - WPGan.com - 5

That is the easy way to connect an OpenAI-Compatible API to WordPress AI that you can try out easily.

FAQ

What Is an OpenAI-Compatible API?

An OpenAI-Compatible API is an AI API service that uses a request and response format compatible with the OpenAI API.

Which Providers Are Supported in Koneek?

Koneek supports various providers, including Google Gemini, Anthropic, OpenAI, and OpenAI Compatible.

Is the API Key Stored Securely?

Based on the information available from the Koneek plugin page, the API Key is stored using AES-256-CBC, and the encryption key is derived from the WordPress secret salts found in wp-config.php

Written by

Muhammad Khoirun Nasikin

I enjoy tinkering with WordPress, hosting, VPS, web development, and various small experiments related to websites. I have over 3 years of experience in the web hosting industry.

COMMENTS

Loading...