thaikolja/nominal-ai-provider-for-opencode 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

thaikolja/nominal-ai-provider-for-opencode

Composer 安装命令:

composer require thaikolja/nominal-ai-provider-for-opencode

包简介

Nominal AI Provider for OpenCode for the PHP AI Client SDK. Works as both a Composer package and WordPress plugin.

README 文档

README

Stable Version PHP Version WordPress Version License WordPress Plugin Packagist Version

This plugin is a Nominal AI Provider for OpenCode for the PHP AI Client SDK. Works as both a Composer package and a WordPress plugin.

Note: You are viewing the the development repository. You can clone or download this entire repository and use it as a plugin, but for safety and speed, you should use the built version from WordPress.org.

Description

This plugin integrates OpenCode's AI models into WordPress as a provider for the PHP AI Client SDK. Once activated, OpenCode is automatically registered as a provider – no manual configuration required.

OpenCode provides access to a variety of open-source models through a unified API, enabling text generation and chat history capabilities for WordPress sites.

Features

  • Text Generation — Use OpenCode's language models for content creation, summarization, analysis, and more.
  • Chat History — Maintain conversation context across multiple interactions.
  • Dynamic Model Discovery — Available models are fetched directly from the OpenCode API, so your plugin stays compatible with new releases automatically.
  • Automatic Provider Registration — Registers itself with the PHP AI Client on WordPress init; no manual wiring needed.

Requirements

  • PHP 7.4 or higher
  • For WordPress 6.9, the wordpress/php-ai-client package must be installed
  • For WordPress 7.0 and above, no additional changes are required
  • OpenCode API key

Installation

As a WordPress Plugin

  1. Download the latest release from the plugin's WordPress page
  2. Upload to /wp-content/plugins/nominal-ai-provider-for-opencode/
  3. Activate the plugin through the WordPress admin
  4. Configure your OpenCode API key (see Configuration)

As a Composer Package

composer require thaikolja/nominal-ai-provider-for-opencode

Then register the provider manually:

use WordPress\AiClient\AiClient;
use Nominal\AIProviderOpenCode\Provider\Nominal_AIPO_OpenCodeProvider;

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

Usage

With WordPress

  1. Install and activate the plugin, and add your API key – that's it!

You can use the provider in your WordPress theme or plugin. It automatically registers itself on the init hook. Simply ensure the plugin is active and configure your API key either on your Providers page or via a constant:

// Set your OpenCode API key (or use the OPENCODE_API_KEY environment variable)
putenv( 'OPENCODE_API_KEY=your-api-key' );

// Use the provider
$result = AiClient::prompt( 'Hello, world!' )
	->usingProvider( 'opencode' )
	->generateTextResult();

echo $result->toText();

As a Standalone Package

use WordPress\AiClient\AiClient;
use Nominal\AIProviderOpenCode\Provider\Nominal_AIPO_OpenCodeProvider;

// Register the provider
$registry = AiClient::defaultRegistry();
$registry->registerProvider( Nominal_AIPO_OpenCodeProvider::class );

// Set your API key
putenv( 'OPENCODE_API_KEY=your-api-key' );

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

echo $result->toText();

Supported Models

Available models are dynamically discovered from the OpenCode API at https://opencode.ai/zen/go/v1/models. Currently available models include:

  • DeepSeek-V4-Pro (deepseek-v4-pro) — High-quality text generation
  • DeepSeek-V4-Flash (deepseek-v4-flash) — Fast, efficient text generation
  • GLM-5.1 (glm-5.1) — Text generation
  • GLM-5 (glm-5) — Text generation
  • Hy3 Preview (hy3-preview) — Text generation
  • Kimi-K2.6 (kimi-k2.6) — Text generation
  • Kimi-K2.5 (kimi-k2.5) — Text generation
  • Mimo-V2-Pro (mimo-v2-pro) — Text generation
  • Mimo-V2-Omni (mimo-v2-omni) — Text generation
  • Mimo-V2.5-Pro (mimo-v2.5-pro) — Text generation
  • Mimo-V2.5 (mimo-v2.5) — Text generation
  • MiniMax-M3 (minimax-m3) — Text generation
  • MiniMax-M2.7 (minimax-m2.7) — Text generation
  • MiniMax-M2.5 (minimax-m2.5) — Text generation
  • Qwen3.7-Max (qwen3.7-max) — Text generation
  • Qwen3.7-Plus (qwen3.7-plus) — Text generation
  • Qwen3.6-Plus (qwen3.6-plus) — Text generation
  • Qwen3.5-Plus (qwen3.5-plus) — Text generation

All models returned from the API receive textGeneration and chatHistory capabilities automatically.

Configuration

The provider uses the OPENCODE_API_KEY environment variable for authentication. Set it via your environment, wp-config.php, or inline:

// Via wp-config.php
define( 'OPENCODE_API_KEY', 'your-api-key' );

// Or via PHP environment
putenv( 'OPENCODE_API_KEY=your-api-key' );

Visit the OpenCode Platform to sign up for a Go or Zen plan and generate an API key.

Development

# Install dependencies
composer install

# Lint (phpcs + phpstan)
composer lint

# Auto-fix coding standards issues
composer phpcbf

# Build for production (creates nominal-ai-provider-for-opencode.zip)
./scripts/build.sh

External Services

This plugin connects to the OpenCode API to provide AI capabilities within WordPress. Connection to this service is required to enable text generation, chat history, and dynamic model discovery.

What data is sent and when:

  • Your OpenCode API key is sent with every request to authenticate with the service.
  • Any text prompts, messages, or content you submit for AI processing are sent to OpenCode's servers.
  • A request is made to the OpenCode API to fetch available models when the plugin initializes.
  • Data is only transmitted when AI features are actively used.

Service provider: OpenCode

Contributors

  • Kolja Nolte (kolja.nolte@gmail.com)

License

GPL-2.0-or-later

thaikolja/nominal-ai-provider-for-opencode 适用场景与选型建议

thaikolja/nominal-ai-provider-for-opencode 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 06 月 09 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「wordpress」 「connector」 「ai」 「opencode」 「llm」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 thaikolja/nominal-ai-provider-for-opencode 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 thaikolja/nominal-ai-provider-for-opencode 我们能提供哪些服务?
定制开发 / 二次开发

基于 thaikolja/nominal-ai-provider-for-opencode 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 33
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2026-06-09