- Use Azure AI Foundry INSTEAD, link below:Azure AI Foundry is a new and improved Azure AI Connector for WordPress 7
This plugin provides Azure OpenAI integration for the WordPress AI Client, enabling text generation, image generation, embedding generation, and text-to-speech using Azure's hosted OpenAI models.
BONUS: How to Add a Custom AI Provider to WordPress 7+ — a step-by-step guide for developers to add AI Connectors to WordPress, with code examples.
- Text generation using GPT-4, GPT-4o, GPT-4.1, GPT-3.5-Turbo deployments
- Image generation using DALL-E 2 and DALL-E 3 deployments
- Embedding generation using text-embedding-ada-002, text-embedding-3-small/large deployments
- Text-to-speech using tts-1 and tts-1-hd deployments
- Integrated into the Connectors settings page (Settings → Connectors) — configure API key, endpoint, deployment, and capabilities in one place
- Multimodal input support (text, image, audio, document combinations)
- Environment variable support for credentials
- WordPress 7.0 or higher
- PHP 7.4 or higher
- Azure OpenAI resource with deployed models
- Download
ai-provider-for-azure-openai.zip - Upload via
Plugins → Add New → Upload Plugin - Activate the plugin through the WordPress admin
- Go to Settings → Connectors
- Find Azure OpenAI and click Set Up
- Enter your API Key (from Azure Portal → Your OpenAI Resource → Keys and Endpoint)
- Enter your Endpoint URL, API Version, Deployment ID, and Capabilities
- Click Save Settings
All settings are stored as individual options and exposed via the REST Settings API.
Set the following environment variables:
export AZURE_OPENAI_API_KEY="your-api-key"
export AZURE_OPENAI_ENDPOINT="https://your-resource.openai.azure.com"
export AZURE_OPENAI_API_VERSION="2024-02-15-preview" # Optional
export AZURE_OPENAI_DEPLOYMENT_ID="gpt-4o" # Optional
export AZURE_OPENAI_CAPABILITIES="text_generation,chat_history" # Optional, comma-separatedAvailable capabilities: text_generation, image_generation, chat_history, embedding_generation, text_to_speech_conversion
Environment variables are used as fallbacks when settings are not saved in the database.
Once configured, the Azure OpenAI provider is automatically registered with the WordPress AI Client and can be used like any other provider:
use WordPress\AiClient\AiClient;
// Get an Azure OpenAI model
$registry = AiClient::defaultRegistry();
$model = $registry->getProviderModel( 'azure_openai', 'gpt-4o' );
// Generate text
$result = $model->generateText( [
[ 'role' => 'user', 'content' => 'Hello, how are you?' ]
] );
echo $result->getText();Azure OpenAI uses a different URL structure:
{endpoint}/openai/deployments/{deployment}/chat/completions?api-version={version}
And uses the api-key header instead of Authorization: Bearer:
api-key: your-api-key
The plugin handles these differences automatically.
composer install
composer lint:phpcomposer testThis plugin is based on AI Provider for OpenAI by the WordPress AI Team. It adapts the OpenAI provider architecture for Azure OpenAI's API format and authentication requirements.
GPL-2.0-or-later
