<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ailles</title>
    <description>The latest articles on DEV Community by Ailles (@ailles).</description>
    <link>https://dev.to/ailles</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4004664%2F0c882897-9e77-4bb2-8e02-f5ed7d5b79be.gif</url>
      <title>DEV Community: Ailles</title>
      <link>https://dev.to/ailles</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ailles"/>
    <language>en</language>
    <item>
      <title>I Tried Connecting an OpenAI-Compatible API to WordPress AI</title>
      <dc:creator>Ailles</dc:creator>
      <pubDate>Sat, 27 Jun 2026 00:33:22 +0000</pubDate>
      <link>https://dev.to/ailles/i-tried-connecting-an-openai-compatible-api-to-wordpress-ai-k9m</link>
      <guid>https://dev.to/ailles/i-tried-connecting-an-openai-compatible-api-to-wordpress-ai-k9m</guid>
      <description>&lt;p&gt;I was curious about something while testing WordPress AI features:&lt;/p&gt;

&lt;p&gt;What happens if the AI provider I want to use is not one of the default providers?&lt;/p&gt;

&lt;p&gt;WordPress AI can connect to supported providers directly, but many AI services today expose an &lt;strong&gt;OpenAI-compatible API&lt;/strong&gt; instead of being officially supported one by one.&lt;/p&gt;

&lt;p&gt;That includes things like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;OpenRouter&lt;/li&gt;
&lt;li&gt;OpenWebUI&lt;/li&gt;
&lt;li&gt;Ollama&lt;/li&gt;
&lt;li&gt;LiteLLM&lt;/li&gt;
&lt;li&gt;other custom OpenAI-compatible endpoints&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At first, I assumed that if an API follows the OpenAI format, I could just paste the endpoint somewhere and call it a day.&lt;/p&gt;

&lt;p&gt;Turns out, not always.&lt;/p&gt;

&lt;p&gt;So I tested a bridge approach using a WordPress plugin called &lt;strong&gt;Koneek&lt;/strong&gt; to connect an OpenAI-compatible API provider to WordPress AI.&lt;/p&gt;

&lt;p&gt;Here is what I found.&lt;/p&gt;

&lt;h2&gt;
  
  
  The thing I wanted to test
&lt;/h2&gt;

&lt;p&gt;The question was simple:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Can WordPress AI use an OpenAI-compatible provider even if WordPress does not support that provider directly?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In my test, I used &lt;strong&gt;OpenRouter&lt;/strong&gt; as the provider because it exposes an OpenAI-compatible endpoint and also has free models available.&lt;/p&gt;

&lt;p&gt;The goal was not to build a custom integration from scratch.&lt;/p&gt;

&lt;p&gt;I wanted to see whether WordPress AI could use a third-party compatible API through configuration only.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why OpenAI-compatible APIs are not always plug-and-play
&lt;/h2&gt;

&lt;p&gt;This part surprised me a little.&lt;/p&gt;

&lt;p&gt;Even when a provider says it is OpenAI-compatible, it does not mean every app can automatically use it.&lt;/p&gt;

&lt;p&gt;Different providers may use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a different base URL&lt;/li&gt;
&lt;li&gt;custom authentication behavior&lt;/li&gt;
&lt;li&gt;extra headers&lt;/li&gt;
&lt;li&gt;different model naming&lt;/li&gt;
&lt;li&gt;slightly different endpoint expectations&lt;/li&gt;
&lt;li&gt;different timeout behavior&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So even if the request and response format is mostly compatible, WordPress still needs a way to know:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;where to send the request&lt;/li&gt;
&lt;li&gt;which model to use&lt;/li&gt;
&lt;li&gt;which API key to send&lt;/li&gt;
&lt;li&gt;how long to wait for a response&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That is where the plugin comes in.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I used
&lt;/h2&gt;

&lt;p&gt;For this test, I prepared:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;WordPress 7.0&lt;/li&gt;
&lt;li&gt;the official WordPress &lt;strong&gt;&lt;a href="https://wordpress.org/plugins/ai/" rel="noopener noreferrer"&gt;AI&lt;/a&gt;&lt;/strong&gt; plugin&lt;/li&gt;
&lt;li&gt;the &lt;strong&gt;&lt;a href="https://wordpress.org/plugins/koneek-multi-provider-ai-gateway/" rel="noopener noreferrer"&gt;Koneek – AI Provider for OpenAI-Compatible&lt;/a&gt;&lt;/strong&gt; plugin&lt;/li&gt;
&lt;li&gt;an OpenAI-compatible API key&lt;/li&gt;
&lt;li&gt;a model name&lt;/li&gt;
&lt;li&gt;the provider base URL&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For OpenRouter, the base URL I used was:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://openrouter.ai/api/v1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For the model, the original test used:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cohere/north-mini-code:free
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The exact model can change depending on what is available from your provider, so I would not hardcode that forever. Always check the provider's model list before configuring it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The setup flow I tested
&lt;/h2&gt;

&lt;p&gt;After installing and activating the required plugins, I went into:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Settings &amp;gt; Koneek
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From there, I added a new provider configuration.&lt;/p&gt;

&lt;p&gt;The fields were pretty straightforward:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Name: Any label you want
Provider: OpenAI-Compatible
API Key: Your provider API key
Model: The model name from your provider
API URL: The OpenAI-compatible base URL
Timeout: Optional
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For OpenRouter, the important values looked like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Provider: OpenAI-Compatible
Model: cohere/north-mini-code:free
API URL: https://openrouter.ai/api/v1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I left the timeout empty at first because I wanted to see whether the default behavior was good enough.&lt;/p&gt;

&lt;p&gt;If the provider is slow or the model takes longer to respond, setting a custom timeout may be worth testing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Testing before saving was the useful part
&lt;/h2&gt;

&lt;p&gt;One thing I liked about this workflow is that I did not have to blindly save the config and hope it worked.&lt;/p&gt;

&lt;p&gt;Before saving, I tested the connection.&lt;/p&gt;

&lt;p&gt;This is important because there are several small things that can break the setup:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;invalid API key&lt;/li&gt;
&lt;li&gt;wrong base URL&lt;/li&gt;
&lt;li&gt;typo in the model name&lt;/li&gt;
&lt;li&gt;provider-side rate limit&lt;/li&gt;
&lt;li&gt;free model no longer available&lt;/li&gt;
&lt;li&gt;timeout too low&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In my case, once the connection test returned successfully, I saved the configuration.&lt;/p&gt;

&lt;p&gt;That small test step saves a lot of guessing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Enabling WordPress AI features
&lt;/h2&gt;

&lt;p&gt;After the provider was connected through Koneek, the next step was enabling the AI features from:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Settings &amp;gt; AI
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This part depends on the WordPress AI plugin configuration.&lt;/p&gt;

&lt;p&gt;Once enabled, WordPress AI could use the configured provider for features like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;rewriting text&lt;/li&gt;
&lt;li&gt;rephrasing content&lt;/li&gt;
&lt;li&gt;regenerating titles&lt;/li&gt;
&lt;li&gt;other editor AI actions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That was the moment where the setup actually felt useful.&lt;/p&gt;

&lt;p&gt;The provider was not just saved somewhere in settings. It became usable inside WordPress.&lt;/p&gt;

&lt;h2&gt;
  
  
  What worked well
&lt;/h2&gt;

&lt;p&gt;The biggest win is flexibility.&lt;/p&gt;

&lt;p&gt;Instead of waiting for WordPress AI to support every provider directly, this setup makes it possible to connect providers that expose an OpenAI-compatible API.&lt;/p&gt;

&lt;p&gt;That opens the door to testing different backends, such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;hosted AI providers&lt;/li&gt;
&lt;li&gt;local AI gateways&lt;/li&gt;
&lt;li&gt;self-hosted OpenWebUI&lt;/li&gt;
&lt;li&gt;LiteLLM routers&lt;/li&gt;
&lt;li&gt;OpenRouter model routing&lt;/li&gt;
&lt;li&gt;internal proxy APIs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For developers, that is useful because AI providers change fast.&lt;/p&gt;

&lt;p&gt;Today you may want OpenRouter. Tomorrow you may want a local Ollama setup behind an OpenAI-compatible proxy.&lt;/p&gt;

&lt;p&gt;The WordPress side does not need to care too much as long as the bridge configuration works.&lt;/p&gt;

&lt;h2&gt;
  
  
  The trade-offs I noticed
&lt;/h2&gt;

&lt;p&gt;This setup is convenient, but I would not treat it as magic.&lt;/p&gt;

&lt;p&gt;There are still a few things to watch:&lt;/p&gt;

&lt;h3&gt;
  
  
  Model names matter
&lt;/h3&gt;

&lt;p&gt;OpenAI-compatible providers often use their own model naming format.&lt;/p&gt;

&lt;p&gt;For example, OpenRouter model names usually look different from OpenAI model names.&lt;/p&gt;

&lt;p&gt;If the model name is wrong, the connection may fail even if the API key and base URL are correct.&lt;/p&gt;

&lt;h3&gt;
  
  
  Free models may change
&lt;/h3&gt;

&lt;p&gt;If you use a free model, do not assume it will stay available forever.&lt;/p&gt;

&lt;p&gt;This is fine for testing, but for production workflows, I would use a stable paid model or at least have a fallback plan.&lt;/p&gt;

&lt;h3&gt;
  
  
  Timeout may need tuning
&lt;/h3&gt;

&lt;p&gt;Some models respond slower than others.&lt;/p&gt;

&lt;p&gt;If WordPress keeps failing while the provider works elsewhere, timeout settings are one of the first things I would check.&lt;/p&gt;

&lt;h3&gt;
  
  
  API keys still need to be protected
&lt;/h3&gt;

&lt;p&gt;According to the Koneek plugin information, API keys are stored using AES-256-CBC encryption with the encryption key derived from WordPress secret salts in &lt;code&gt;wp-config.php&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;That is better than storing plain text secrets, but I would still treat API keys seriously:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;do not reuse important keys everywhere&lt;/li&gt;
&lt;li&gt;rotate keys if you suspect exposure&lt;/li&gt;
&lt;li&gt;avoid giving unnecessary permissions&lt;/li&gt;
&lt;li&gt;keep &lt;code&gt;wp-config.php&lt;/code&gt; secure&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  When I would use this approach
&lt;/h2&gt;

&lt;p&gt;I would use this setup when I want WordPress AI to work with a provider that is not directly supported yet.&lt;/p&gt;

&lt;p&gt;Good use cases:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;testing multiple AI providers&lt;/li&gt;
&lt;li&gt;using OpenRouter for model routing&lt;/li&gt;
&lt;li&gt;connecting an internal OpenAI-compatible gateway&lt;/li&gt;
&lt;li&gt;experimenting with local or self-hosted AI&lt;/li&gt;
&lt;li&gt;avoiding vendor lock-in&lt;/li&gt;
&lt;li&gt;giving WordPress AI access to cheaper or specialized models&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I probably would not use a random free provider for serious production content automation unless I had already tested its reliability, latency, and privacy policy.&lt;/p&gt;

&lt;h2&gt;
  
  
  The main thing I learned
&lt;/h2&gt;

&lt;p&gt;The interesting part is that "OpenAI-compatible" is more of a compatibility layer than a universal guarantee.&lt;/p&gt;

&lt;p&gt;It gives you a common API shape, but the app still needs to know the provider details.&lt;/p&gt;

&lt;p&gt;Once those details are configurable, WordPress AI becomes much more flexible.&lt;/p&gt;

&lt;p&gt;The setup that worked for me was:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;WordPress AI
    ↓
Koneek provider configuration
    ↓
OpenAI-compatible API endpoint
    ↓
AI provider/model
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That is a pretty clean flow.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final thoughts
&lt;/h2&gt;

&lt;p&gt;I went into this assuming the hardest part would be the API itself.&lt;/p&gt;

&lt;p&gt;It was not.&lt;/p&gt;

&lt;p&gt;The real trick was making WordPress AI aware of the provider's base URL, model name, and authentication details.&lt;/p&gt;

&lt;p&gt;Once that bridge existed, the rest felt surprisingly simple.&lt;/p&gt;

&lt;p&gt;While researching this setup, I also came across an Indonesian article that walks through a similar configuration: &lt;a href="https://wpgan.com/wordpress/intermediate/cara-menghubungkan-openai-compatible-api-ke-wordpress-ai/" rel="noopener noreferrer"&gt;Cara Menghubungkan OpenAI-Compatible API ke WordPress AI&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I am curious how other WordPress developers are approaching this.&lt;/p&gt;

&lt;p&gt;Are you using official AI providers only, or are you routing everything through OpenAI-compatible gateways like OpenRouter, LiteLLM, Ollama, or OpenWebUI?&lt;/p&gt;

</description>
      <category>wordpress</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
