外掛說明
This plugin provides Google AI (Gemini) integration for the PHP AI Client SDK. It enables WordPress sites to use Google’s Gemini models for text generation, image generation, text to speech, embedding generation, and other AI capabilities.
外掛功能
- 使用 Gemini 模型產生內容
- 使用 Imagen 模型產生圖片
- Embedding generation with any embedding-capable Google model, including multimodal embeddings from images, audio, video, and PDF documents
- Text to Speech conversion with Gemini models
- Function calling support
- 自動註冊提供者
Available models are dynamically discovered from the Google AI API, including Gemini models for text generation, Imagen models for image generation, and embedding models for embedding generation.
環境需求
- PHP 7.4 或更新版本
- WordPress 7.0 or higher
- Google Gemini API 金鑰
安裝方式
- 將外掛安裝套件 ZIP 壓縮檔解壓縮所得的
ai-provider-for-google資料夾上傳至網站的/wp-content/plugins/目錄中。 - 在 WordPress 管理後台的 [外掛] 選單中啟用外掛。
- 透過
GOOGLE_API_KEY環境變數或常數組態 Google API 金鑰。
常見問題集
-
如何取得 Google API 金鑰?
-
前往 Google AI Studio 以取得 Gemini API 的 API 金鑰。
-
這個外掛是否不需要與 PHP AI Client 搭配使用?
-
否。這個外掛需要安裝並啟用 PHP AI Client 外掛,而這個外掛提供 PHP AI Client 所使用的 Google 專屬實作方案。
使用者評論
這個外掛目前沒有任何使用者評論。
參與者及開發者
變更記錄
1.3.1 – 2026-12-04
Changed
- Bump WordPress tested-up-to version 7.2 (#59).
- Bump WordPress minimum supported version to 7.0 (#59).
Fixed
- Handle Gemini candidates without generated content and map newer finish reasons without failing (#57).
1.3.0 – 2026-11-17
Added
- Added support for embedding generation (#30).
1.2.1 – 2026-10-27
Changed
- Hardened response file handling by validating and explicitly encoding all model-supplied file data (URLs, MIME types, base64 payloads, including TTS audio) before
Fileconstruction, with clearer indexedResponseExceptionerrors and expanded test coverage (#55).
Fixed
- Google tool-calling compatibility by switching function declarations to
parametersJsonSchema, normalizing schema maps/empty schemas to JSON objects, filtering unsupported declaration fields (e.g.,annotations), and preserving Gemini function call IDs across continuation requests (#51).
Developer
- Excluded
tests/andphpunit.xml.distfrom Composer package archives by addingexport-ignorerules to.gitattributes, so these development/testing files are no longer shipped in consumers’vendor/directories (#48). - Added unit tests for
GoogleTextToSpeechConversionModel, covering request preparation, prompt parsing, audio/WAV response handling, and authentication behavior (#49). - Added security issue reporting guidance to
SECURITY.md, including responsible disclosure instructions and a link to the official WordPress HackerOne program for submitting security concerns (#52). - Added a
.github/CODEOWNERSglobal fallback entry assigning ownership of all files to@WordPress/ai-provider-for-google-maintainerswhen no more specific rule matches (#53). - Added maintainer and contribution documentation by introducing
CONTRIBUTING.mdand updatingREADME.mdwith current maintainer contacts (#54).
1.2.0 – 2026-09-21
Added
- Support for text to speech conversion (#31).
- WordPress Playground preview blueprint that installs and activates the AI plugin and Google provider, enables AI and image generation/editing settings, logs in automatically, opens the Connectors screen, and configures Playground networking for provider requests after credentials are set (#43).
Changed
- Updated the supported development baseline to PHP AI Client 1.3.1 and added automated compatibility testing across PHP 7.4–8.4 with the lowest and latest supported dependencies (#40).
Fixed
- Google thought signature round-tripping and thought token usage compatibility for tool-calling requests (#26).
- Gemini tool-calling by preserving
thoughtSignaturevalues across turns so function calls remain valid in multi-step conversations (#36). - Gemini usage parsing to use Google’s authoritative
totalTokenCountwhen available, ensuring prompt tokens are included in reported totals while keeping a backward-compatible fallback for older responses (#44).
Older changelog entries can be found in the CHANGELOG.md file.
