An OpenCode AI Provider for the PHP AI Client SDK. Works as a WordPress plugin.
- PHP 7.4 or higher
- WordPress 6.9 or higher
- The wordpress/php-ai-client package / plugin must be installed and active
- Upload the plugin files to
/wp-content/plugins/opencode-ai-provider/ - Ensure the PHP AI Client plugin is installed and activated
- Activate the plugin through the WordPress admin
The provider uses the OPENCODE_API_KEY environment variable or constant for authentication, or you can configure it via the WordPress Settings Connectors UI.
To define it in PHP:
define('OPENCODE_API_KEY', 'your-opencode-zen-api-key');Or as an environment variable:
putenv('OPENCODE_API_KEY=your-opencode-zen-api-key');Simply use the standard WordPress AI Client functions:
use WordPress\AiClient\AiClient;
$result = AiClient::prompt('Write a PHP function to filter query parameters.')
->usingProvider('opencode')
->generateTextResult();
echo $result->toText();Available models are dynamically discovered from the OpenCode Zen API /models endpoint, which includes curated, development-optimized coding models like deepseek-v4-flash-free and others.
GPL-2.0-or-later
See the OpenCode privacy policy: https://opencode.ai/legal/privacy-policy
See the OpenCode terms of service: https://opencode.ai/legal/terms-of-service