mralaminahamed/ai-provider-for-opencode-zen

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

Maintainers

Package info

github.com/mralaminahamed/ai-provider-for-opencode-zen

Type:wordpress-plugin

pkg:composer/mralaminahamed/ai-provider-for-opencode-zen

Transparency log

Fund package maintenance!

alaminahamed.com/donate

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-04-30 08:38 UTC

README

AI Provider for OpenCode Zen logo

AI Provider for OpenCode Zen

One API key. 57 frontier AI models, inside WordPress. An independent OpenCode Zen provider for the WordPress AI Client — brings GPT 5.x, Claude, Gemini 3.x, Qwen, MiniMax, Kimi, Grok, and DeepSeek to every AI-enabled plugin on your site.

WordPress.org version Downloads Tested up to PHP License PRs welcome

Not affiliated with, endorsed by, or sponsored by OpenCode Zen.

What it does

WordPress 7.0 ships a built-in AI Client SDK: plugins ask it to "generate text from this prompt" without caring which AI service answers. This plugin registers OpenCode Zen as one of those services — an AI model aggregator where a single API key unlocks frontier models from OpenAI, Anthropic, Google, and more.

Activate it, paste one key, and every AI-enabled plugin on your site can generate content through 57 models — no separate accounts, no per-provider billing, no code.

Features

One key, every model

  • 57 models across GPT 5.x, Claude, Gemini 3.x, Qwen, MiniMax, Kimi, Grok, and DeepSeek — one OpenCode Zen key instead of an account per provider
  • Live model discovery from the OpenCode Zen API (cached for one hour), with a built-in 57-model fallback so generation keeps working if the API is briefly unreachable
  • A sensible default model (gpt-5.5) preselected out of the box

Native WordPress integration

  • Registers as a first-class provider for the WordPress 7.0+ AI Client — any AI-enabled plugin uses it with zero extra wiring
  • Enter your key on Settings → OpenCode Zen, the core Settings → Connectors screen, or via the OPENCODE_ZEN_API_KEY environment variable
  • Connection-status indicator on the settings page and the provider logo on the Connectors screen
  • Standard generation controls: temperature, max tokens, top P, and presence/frequency penalties

Built to stay out of the way

  • OpenAI-compatible under the hood — text generation, system instructions, stop sequences, and function declarations
  • Ships as both a WordPress plugin and a Composer package for standalone PHP use
  • No SDK bloat — WordPress core provides the AI Client at runtime, and the plugin excludes its own copy to stay collision-safe

Requirements

  • PHP 7.4+
  • WordPress 7.0+ (the AI Client SDK ships in core)

Installation

Method How
WordPress.org Search "AI Provider for OpenCode Zen" under Plugins → Add New, then install and activate
Upload Download the zip and upload it via Plugins → Add New → Upload Plugin
Composer composer require mralaminahamed/ai-provider-for-opencode-zen

Quick start

  1. Activate the plugin.
  2. Open Settings → OpenCode Zen (or the core Settings → Connectors screen) and paste your API key. Get one at opencode.ai/zen/settings/api-keys.
  3. Any AI-enabled plugin can now generate text through the opencode-zen provider:
use WordPress\AiClient\AiClient;

echo AiClient::prompt('Explain quantum computing')
    ->usingProvider('opencode-zen')
    ->generateTextResult()
    ->toText();

See docs/USAGE.md for the standalone-Composer setup and per-request options.

Configuration

Configure defaults on Settings → OpenCode Zen (option key opencode_zen_settings):

Setting Range Default
Default Model any available model gpt-5.5
Temperature 0.0–2.0 0.7
Max Tokens 1–200,000 4096
Top P 0.0–1.0 1.0
Presence Penalty -2.0–2.0 0.0
Frequency Penalty -2.0–2.0 0.0

The OPENCODE_ZEN_API_KEY environment variable takes priority over the stored key. Full resolution order is in docs/ARCHITECTURE.md.

Supported models

When a key is configured, the live model list comes straight from the OpenCode Zen API, so you always see the latest models. If the API is unavailable, a 57-model fallback keeps everything working:

  • GPT 5.x — Sol / Terra / Luna, plus Pro, Mini, Nano, and Codex variants
  • Claude — Fable 5, Opus 4.x, Sonnet 5 / 4.x, Haiku 4.5
  • Gemini 3.x — Flash, Flash Lite, and Pro
  • More — Grok, Qwen, DeepSeek, MiniMax, GLM, Kimi, and free-tier models

The complete, ID-by-ID catalogue is in docs/MODELS.md.

How it works

WordPress 7.0's AI Client is a provider-agnostic layer. Install one or more provider plugins — like this one — and any plugin built on the AI Client can generate content through whichever provider is active, switchable from the Connectors screen with no per-plugin reconfiguration. This plugin handles the OpenCode Zen side: credential resolution, live model discovery, and the OpenAI-compatible API calls. Details in docs/ARCHITECTURE.md.

Documentation

Doc What's in it
Usage WordPress + standalone Composer examples, API key resolution, generation options, credential filters
Models How model discovery and caching work, and the full 57-model fallback catalogue
Architecture Provider identity, file layout, request flow, runtime SDK dependency
Development Build/test/lint/analysis scripts, the AI Client replace guard and dev-only stub install, CI and release

Release history: CHANGELOG.md.

Development

composer install
composer test        # PHPUnit
composer phpcs       # WordPress Coding Standards
composer phpstan     # static analysis
composer release     # build the distributable zip

Full workflow — including the AI Client replace guard and the dev-only stub install that keeps PHPStan and PHPUnit green — is in docs/DEVELOPMENT.md.

Contributing

Issues and pull requests are welcome:

Support

If this plugin is useful, star the repo and leave a review on WordPress.org. Questions and bug reports go in the issue tracker.

License

GPL-2.0-or-later © Al Amin Ahamed