adachsoft/ai-integration-gemini-via-openai
Composer 安装命令:
composer require adachsoft/ai-integration-gemini-via-openai
包简介
Gemini provider for adachsoft/ai-integration using the official OpenAI-compatible endpoint.
README 文档
README
Gemini provider for adachsoft/ai-integration using the official OpenAI-compatible chat completions endpoint exposed by Google.
This package exposes a ready-to-use SPI provider that can be registered under the id gemini-via-openai in the core ToolCallingChatFacadeBuilder and used for tool-calling chat scenarios.
Installation
composer require adachsoft/ai-integration adachsoft/ai-integration-gemini-via-openai
Configuration
Set the following environment variable (for example in your .env file at the project root):
GOOGLE_GEMINI_API_KEY– API key for the Gemini OpenAI-compatible endpoint.
Usage
use AdachSoft\AiIntegration\PublicApi\Builder\ToolCallingChatFacadeBuilder;
use AdachSoft\AiIntegration\PublicApi\ToolCalling\Dto\ChatMessageDto;
use AdachSoft\AiIntegration\PublicApi\ToolCalling\Dto\Collection\ChatMessageDtoCollection;
use AdachSoft\AiIntegration\PublicApi\ToolCalling\Dto\Collection\ToolDefinitionDtoCollection;
use AdachSoft\AiIntegration\PublicApi\ToolCalling\Dto\ToolCallingChatRequestDto;
use AdachSoft\AiIntegration\PublicApi\ToolCalling\Dto\ToolDefinitionDto;
use AdachSoft\AiIntegrationGeminiViaOpenAi\GeminiViaOpenAiToolCallingChatSpiFactory;
$apiKey = getenv('GOOGLE_GEMINI_API_KEY');
$spi = GeminiViaOpenAiToolCallingChatSpiFactory::create($apiKey);
$facade = ToolCallingChatFacadeBuilder::create()
->withSpiProvider('gemini-via-openai', $spi)
->build();
$tools = new ToolDefinitionDtoCollection([
new ToolDefinitionDto(
name: 'echo_tool',
description: 'Echoes back the provided input string.',
parametersSchema: [
'type' => 'object',
'properties' => [
'text' => [
'type' => 'string',
'description' => 'Text to echo back',
],
],
'required' => ['text'],
],
),
]);
$messages = new ChatMessageDtoCollection([
ChatMessageDto::createUserMessage('Call echo_tool with some example text.'),
]);
$request = new ToolCallingChatRequestDto(
providerId: 'gemini-via-openai',
modelId: 'gemini-2.0-flash',
messages: $messages,
tools: $tools,
);
$response = $facade->chat($request);
Smoke test
A simple smoke script is provided for manual end-to-end verification:
echo "GOOGLE_GEMINI_API_KEY=your_api_key_here" >> .env
php bin/smoke-gemini-via-openai-tool-chat
The script will perform a single tool-calling chat request using the gemini-2.0-flash model and print the response in JSON form.
adachsoft/ai-integration-gemini-via-openai 适用场景与选型建议
adachsoft/ai-integration-gemini-via-openai 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 01 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「google」 「chat」 「ai」 「Gemini」 「ai-integration」 「adachsoft」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 adachsoft/ai-integration-gemini-via-openai 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 adachsoft/ai-integration-gemini-via-openai 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 adachsoft/ai-integration-gemini-via-openai 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This simple PHP class allows you to easily generate Smartsupp.com JS chat code.
Client for the REST API plugin of the OpenFire Server
Magento 2 Social Login extension is designed for quick login to your Magento 2 store without procesing complex register steps
AI Agent templates for Laravel development - Skills, Agents, and Workflows for enhanced coding assistance
The Yii2 extension module to chat registered users.
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 17
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-20