PHPackages                             mralaminahamed/ai-provider-for-opencode-zen - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mralaminahamed/ai-provider-for-opencode-zen

ActiveWordpress-plugin[Utility &amp; Helpers](/categories/utility)

mralaminahamed/ai-provider-for-opencode-zen
===========================================

AI Provider for OpenCode Zen — an independent OpenCode Zen integration for the WordPress AI Client.

1.0.0(2mo ago)00GPL-2.0-or-laterPHPPHP &gt;=7.4CI passing

Since Apr 30Pushed 1mo agoCompare

[ Source](https://github.com/mralaminahamed/ai-provider-for-opencode-zen)[ Packagist](https://packagist.org/packages/mralaminahamed/ai-provider-for-opencode-zen)[ RSS](/packages/mralaminahamed-ai-provider-for-opencode-zen/feed)WikiDiscussions trunk Synced 3w ago

READMEChangelog (6)Dependencies (10)Versions (2)Used By (0)

AI Provider for OpenCode Zen
============================

[](#ai-provider-for-opencode-zen)

An independent, third-party OpenCode Zen provider for the [WordPress PHP AI Client](https://github.com/WordPress/php-ai-client) SDK. Works as both a Composer package and a WordPress plugin. Not affiliated with, endorsed by, or sponsored by OpenCode Zen.

Requirements
------------

[](#requirements)

- PHP 7.4 or higher
- WordPress 7.0 or higher (AI Client SDK is included in WordPress core)
    - On older WordPress releases, the [WordPress AI Client](https://wordpress.org/plugins/wp-ai-client/) plugin must be installed separately

Installation
------------

[](#installation)

### As a WordPress Plugin

[](#as-a-wordpress-plugin)

1. Download the plugin zip
2. Go to **Plugins &gt; Add New &gt; Upload Plugin** in your WordPress admin
3. Upload and activate

### As a Composer Package

[](#as-a-composer-package)

```
composer require mralaminahamed/ai-provider-for-opencode-zen
```

Configuration
-------------

[](#configuration)

### WordPress Admin

[](#wordpress-admin)

Go to **Settings &gt; OpenCode Zen** to configure:

SettingDescriptionDefaultAPI KeyYour OpenCode Zen API key—Default ModelModel used when none is specifiedFirst availableTemperatureOutput randomness (0.0–2.0)1.0Max TokensMaximum response length2048Top PNucleus sampling threshold (0.0–1.0)1.0Presence PenaltyPenalise repeated topics (-2.0–2.0)0.0Frequency PenaltyPenalise repeated tokens (-2.0–2.0)0.0### Environment Variable

[](#environment-variable)

`OPENCODE_ZEN_API_KEY` takes priority over the database setting:

```
export OPENCODE_ZEN_API_KEY=your-api-key
```

Get your API key at [opencode.ai/zen/settings/api-keys](https://opencode.ai/zen/settings/api-keys).

Usage
-----

[](#usage)

### With WordPress (automatic)

[](#with-wordpress-automatic)

The provider registers itself on the `init` hook. No manual setup required beyond entering your API key.

```
use WordPress\AiClient\AiClient;

$result = AiClient::prompt('Explain quantum computing')
    ->usingProvider('opencode-zen')
    ->generateTextResult();

echo $result->toText();
```

### As a Standalone Composer Package

[](#as-a-standalone-composer-package)

```
use WordPress\AiClient\AiClient;
use AlAminAhamed\OpenCodeZenAiProvider\Provider\OpenCodeZenProvider;

$registry = AiClient::defaultRegistry();
$registry->registerProvider(OpenCodeZenProvider::class);

putenv('OPENCODE_ZEN_API_KEY=your-api-key');

$result = AiClient::prompt('Explain quantum computing')
    ->usingProvider('opencode-zen')
    ->generateTextResult();

echo $result->toText();
```

Supported Models
----------------

[](#supported-models)

Models are discovered dynamically from the OpenCode Zen API (cached for 1 hour). The fallback list includes 41 models:

- **GPT 5.x** — GPT 5.5, GPT 5.4, GPT 5.3 Codex, GPT 5.2, GPT 5.1, GPT 5, and variants
- **Claude 4.x** — Opus 4.7/4.6/4.5/4.1, Sonnet 4.6/4.5/4, Haiku 4.5, and Claude 3.5 Haiku
- **Gemini 3.x** — Gemini 3.5 Flash, 3.1 Pro, 3 Flash
- **Other** — Qwen, MiniMax M2, GLM 5.1, Kimi K2, Grok, DeepSeek, Nemotron

Architecture
------------

[](#architecture)

```
includes/
  Provider/
    OpenCodeZenProvider.php          # Registers provider ID "opencode-zen"
    OpenCodeZenTextGenerationModel.php  # OpenAI-compatible text generation
  Metadata/
    OpenCodeZenModelMetadataDirectory.php  # API model discovery + transient cache
  Settings/
    OpenCodeZenSettings.php          # WP admin settings page (logic only)
templates/
  admin/
    settings-page.php                #  wrapper
    section-general.php              # Section description
    field-model.php                  # Model
    field-temperature.php            # Temperature
    field-max-tokens.php             # Max tokens
    field-top-p.php                  # Top P
    field-presence-penalty.php       # Presence penalty
    field-frequency-penalty.php      # Frequency penalty

```

Settings page: `options-general.php?page=opencode-zen-settings`Option key: `opencode_zen_settings`

Development
-----------

[](#development)

```
# Install dependencies
composer install

# Run tests
composer test

# Lint
composer phpcs

# Auto-fix lint issues
composer phpcbf

# Static analysis
composer phpstan

# Build release zip
composer release
```

The release script runs `composer install --no-dev --optimize-autoloader` so only the plugin's own classmap is in the vendor directory — the AI Client SDK is excluded entirely (it is provided by WordPress 7.0+ at runtime).

License
-------

[](#license)

GPL-2.0-or-later

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance88

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

85d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/34349365?v=4)[Al Amin Ahamed](/maintainers/mralaminahamed)[@mralaminahamed](https://github.com/mralaminahamed)

---

Top Contributors

[![mralaminahamed](https://avatars.githubusercontent.com/u/34349365?v=4)](https://github.com/mralaminahamed "mralaminahamed (91 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/mralaminahamed-ai-provider-for-opencode-zen/health.svg)

```
[![Health](https://phpackages.com/badges/mralaminahamed-ai-provider-for-opencode-zen/health.svg)](https://phpackages.com/packages/mralaminahamed-ai-provider-for-opencode-zen)
```

###  Alternatives

[soukicz/zbozicz

Zboží.cz conversion tracking

191.3M1](/packages/soukicz-zbozicz)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
