Download the PHP package kode/ai-agent without Composer

On this page you can find all versions of the php package kode/ai-agent. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package ai-agent

Kode AI Agent

企业级 PHP AI Agent 框架,兼容 Symfony AI 生态,支持多 Agent 协作、短剧生成、多模态(文生图/视频)、Fiber 协程、进程管理。

PHP Version License

特性

安装

依赖包

本项目依赖以下 kode 系列包:

包名 说明
kode/tools 响应体 Message、字符串 Str、数组 Arr、时间 Time
kode/context 协程安全的上下文管理
kode/facade 门面模式支持
kode/http-client 多运行时 HTTP 客户端
kode/attributes 注解解析器

快速开始

1. 使用适配器工厂(推荐)

2. 使用构建器

3. 使用门面类

4. 多模型分工代理(总工/分析员/执行员)

4.1 通过 Ai 门面快速构建团队

5. MCP Client/Server 协作

输入校验与安全策略

支持的平台

平台 别名 适配器 认证方式 默认模型
OpenAI - OpenAiAdapter API Key gpt-4o
Anthropic claude AnthropicAdapter API Key claude-3-5-sonnet
DeepSeek - DeepSeekAdapter API Key deepseek-chat
阿里云 qwen, tongyi AliyunAdapter API Key / AppKey+AppSecret qwen-turbo
Google gemini GeminiAdapter API Key gemini-2.0-flash
百度 wenxin, ernie BaiduAdapter API Key + Secret Key completions_pro
腾讯 hunyuan TencentAdapter SecretId + SecretKey hunyuan-lite
讯飞 spark, xinghuo XunfeiAdapter AppId + API Key + API Secret generalv3.5

国内平台认证配置

API Key 管理

单 Key 模式

双 Key 模式(主备)

多 Key 轮换模式

AppKey + AppSecret 模式

适用于阿里云、百度、腾讯云等需要双凭证的平台:

从配置创建

向量数据库 (Store 组件)

内存向量存储(用于测试和简单场景)

MCP (模型上下文协议)

MCP 服务器

工具调用

注册工具

使用注解注册工具

对话管理

多模态功能

Kode AI Agent 提供完整的多模态能力支持,包括文本生成图像、文本生成视频、数字人视频生成等多种功能。

架构概述

多模态功能采用统一的架构设计:

核心组件

组件 类名 说明
能力枚举 MultimodalCapability 定义平台支持的所有多模态能力
适配器接口 MultimodalInterface 统一的多模态操作接口
抽象适配器 AbstractMultimodalAdapter 适配器基类,提供通用实现
服务类 MultimodalService 高级服务封装
响应模型 ImageResponse/VideoResponse/AvatarResponse 统一响应格式
文件上传器 FileUploaderInterface 媒体文件上传接口
本地上传器 LocalFileUploader 本地文件系统上传实现

快速开始

1. 创建自定义多模态适配器

首先,创建一个继承自 AbstractMultimodalAdapter 的适配器:

2. 初始化多模态服务

使用门面类

文本生成图像

图像编辑

图像变体生成

文本生成视频

图像生成视频

Seedance 2.0 视频生成

SeedanceService 提供直接的字节跳动 Seedance 2.0 API 调用:

获取平台能力

使用辅助函数

Kode AI Agent 提供了便捷的辅助函数,让调用更加简单:

数字人功能

数字人功能已整合到多模态架构中,通过 MultimodalServiceMultimodal 门面类统一调用。

方式1:从文本生成数字人

方式2:使用自定义视频

方式3:使用自定义音频

方式4:从 HTTP 请求上传

获取数字人和声音列表

异步生成和进度跟踪

文件上传器

支持的文件类型和大小限制

类型 支持的格式 最大大小
视频 MP4, WebM, QuickTime, AVI 500 MB
音频 MP3, WAV, OGG, WebM, AAC 50 MB
图像 JPEG, PNG, WebP, GIF 10 MB

异常处理

下载提示信息

系统会自动生成友好的下载提示,引导用户保存生成的视频:

输出示例:

响应格式

流式响应

同步流式

SSE 流式响应

管道中间件

注解处理器

输入验证

辅助函数

通用辅助函数

多模态辅助函数

异常处理

扩展适配器

配置选项

测试

项目结构

环境要求

许可证

Apache-2.0

联系方式

短剧生成系统 (v1.8.0+)

Kode AI Agent 提供完整的短剧生成工作流,支持一键生成短视频。

架构概述

核心组件

组件 类名 说明
短剧智能体 DramAgentV2 完整短剧制作流程
增强场景 EnhancedScene 支持参考图/视频的智能场景
故事板 StoryBoardV2 剧本场景结构
场景视频 SceneVideo 场景视频引用
视频合成器 VideoComposerV3 多视频合并

快速开始

生成流程

带数字人的短剧

视频合成

短剧生成系统 V2 (v1.9.0+)

增强版短剧生成系统,支持参考图/视频引导、转场效果、开场/结尾视频等高级功能。

核心组件

组件 类名 说明
增强场景 EnhancedScene 支持参考图/视频的智能场景
转场管理 TransitionManager 多种转场效果(淡入淡出、滑动、缩放等)
帧视频 FrameVideo/FrameVideoManager 开场/结尾视频管理
短剧智能体 V2 DramAgentV2 完整短剧制作流程
视频合成器 V3 VideoComposerV3 支持转场、背景音乐、字幕

转场效果类型

类型 说明 FFmpeg 滤镜
fade 淡入淡出 fade
dissolve 溶解切换 fade
slide_left 左滑 slide
slide_right 右滑 slide
slide_up 上滑 slide
slide_down 下滑 slide
zoom_in 放大 zoompan
zoom_out 缩小 zoompan
blur 模糊 boxblur
cross_wipe 交叉擦除 wiperight

增强版短剧生成示例

使用参考图/视频引导

自定义转场效果

AI 字幕生成器 (v2.0+)

支持从视频/音频自动生成字幕,兼容多种格式。

核心功能

功能 说明
语音转字幕 从视频/音频自动识别生成字幕
多格式支持 SRT、VTT、ASS、JSON
批量生成 多个视频批量生成字幕
字幕编辑 加载、解析、格式化字幕

使用示例

配音/旁白生成器 (v2.0+)

支持文本转语音,用于视频旁白、解说等场景。

核心功能

功能 说明
文本转语音 单段/批量文本转音频
多角色 旁白、男声、女声等
多风格 自然、专业、友好、情感等
音频合并 多段音频合并
音视频混合 配音与视频合成

使用示例

视频剪辑器 (v2.0+)

强大的视频剪辑功能,支持剪裁、分割、变速、旋转、裁剪等。

剪辑操作

操作 说明 示例
cut 剪裁 裁剪指定时间段
trim 修剪 去除首尾
split 分割 按时长分割
speed 变速 加速/减速播放
reverse 倒放 视频倒放
rotate 旋转 90°/180°/270°
crop 裁剪 裁剪画面区域
scale 缩放 调整分辨率

使用示例

工作流预设模板 (v2.0+)

提供多种预定义工作流模板,简化视频生成配置。

预设类型

类型 说明 适用场景
short_drama 短剧模板 短视频平台
product_showcase 产品展示 电商平台
education 教育视频 在线课程
news 新闻视频 新闻播报
social_media 社交媒体 抖音/快手
vlog Vlog模板 个人生活
commercial 商业广告 品牌宣传
music_video 音乐视频 MV制作

使用示例

日志系统 (Monolog 集成)

日志工厂

日志管理器

自动脱敏

敏感信息自动脱敏:

并行处理 (Fiber/协程)

异步任务

Fiber 池

并行执行器

进程管理

进程池

单个进程


All versions of ai-agent with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
psr/http-message Version ^2.0
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/log Version ^3.0
psr/container Version ^2.0
psr/simple-cache Version ^3.0
nyholm/psr7 Version ^1.8
kode/tools Version ^1.0
kode/context Version ^2.0
kode/http-client Version ^2.0
kode/attributes Version ^1.0
kode/facade Version ^2.0
monolog/monolog Version ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package kode/ai-agent contains the following files

Loading the files please wait ...