定制 adachsoft/ai-image-minimax 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

adachsoft/ai-image-minimax

最新稳定版本:v0.2.0

Composer 安装命令:

composer require adachsoft/ai-image-minimax

包简介

README 文档

README

MiniMax adapter for adachsoft/ai-image-contract.

Installation

composer require adachsoft/ai-image-minimax

Usage

use AdachSoft\AiImageContract\Collections\ImageInputCollection;
use AdachSoft\AiImageContract\Models\GenerationRequest;
use AdachSoft\AiImageContract\ValueObjects\ImageSize;
use AdachSoft\AiImageContract\ValueObjects\Prompt;
use AdachSoft\AiImageMiniMax\Factory\MiniMaxImageGeneratorFactory;

$generator = MiniMaxImageGeneratorFactory::create('your-api-key');

$response = $generator->generate(new GenerationRequest(
    prompt: new Prompt('A futuristic city at sunset, cyberpunk style'),
    imageInputs: new ImageInputCollection([]),
    size: new ImageSize(1024, 1024),
    options: [
        'model' => 'image-01',
        'response_format' => 'url',
        'n' => 1,
        'prompt_optimizer' => true,
    ],
));

foreach ($response->images as $image) {
    if ($image->url !== null) {
        echo $image->url . PHP_EOL;
    }
}

Notes

This adapter supports text-to-image requests using the MiniMax image generation endpoint.

Current adapter behavior:

  • imageInputs are rejected as unsupported by this provider adapter.
  • The request size is converted into the MiniMax aspect_ratio payload field.
  • The adapter currently expects MiniMax to return image URLs.

Contract Compatibility

This package is compatible with adachsoft/ai-image-contract ^0.2.

The updated contract introduces provider-level exception semantics such as retryable failures and content moderation rejections. This adapter maps MiniMax transport and HTTP failures to the contract exceptions exposed by the library.

Exceptions

The adapter may throw exceptions from adachsoft/ai-image-contract, including:

  • InvalidInputException when unsupported request features are used.
  • RetryableException for temporary transport failures, rate limits, and 5xx responses.
  • ContentModerationException for moderation or safety-filter style rejections.
  • GenerationFailedException for non-retryable provider failures or invalid generation responses.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固