承接 thaikolja/nominal-ai-provider-for-opencode 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

thaikolja/nominal-ai-provider-for-opencode

最新稳定版本:v1.0.0

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

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固