aimeos/prisma
Lightweight PHP package for integrating multi-media and text LLMs into your apps through one unified interface. Supports audio, image, text and video providers, with tools, schemas, citations, retries and response handling.
0.7.0 is a major capability expansion: video generation is no longer a niche path, with providers for xAI, Veo, Runway, MiniMax, Luma, Gemini Omni, BytePlus, Bedrock, Alibaba, and OpenRouter, plus video description/repaint/extend/upscale/uncrop support on selected providers. OpenRouter now also covers image and audio, and Ideogram moves to V4 with transparent image generation/editing and async support.
Minimal steps:
composer require aimeos/prisma:^0.7
src/Provider/* plus the tests for the providers you plan to use. The release notes are useful, but provider capability differences matter more than the headline list.php artisan config:cache
FileResponse with Laravel’s filesystem.First-use checklist:
storage/app/... or an S3 disk, not in the database.Wrap Prisma in an application service. Keep provider names, model IDs, timeouts, and storage rules out of controllers. A small service layer makes it easy to switch providers and to apply Laravel-specific concerns like logging, retries, and authorization.
Illustrative shape:
final class AiMediaService
{
public function generateVideo(string $prompt, array $options = []): FileResponse
{
// Adapt to the package's actual client/factory API.
return Prisma::video()
->provider(config('prisma.video_provider'))
->generate($prompt, $options);
}
}
Use queues for video generation. Video jobs are slow and expensive. Submit the request from a queued job, store the async handle/response ID, and poll in a second job or scheduled command. Avoid holding an HTTP request open while a provider renders video.
final class GenerateVideoJob implements ShouldQueue
{
public function __construct(public int $assetId, public string $prompt) {}
public function handle(AiMediaService $ai): void
{
$response = $ai->generateVideo($this->prompt);
// Persist file/URL and update asset status.
}
}
Treat async as a first-class workflow. The fromAsync() change in 0.7.0 affects FileResponse and TextResponse. In production, pass a timeout in seconds where you resolve async results, or omit the argument only when you intentionally want unlimited polling. Store the async handle and a deadline so retries and redeploys do not create orphaned jobs.
Maintain a provider capability map. The 0.7.0 release adds operations selectively. A useful starting map from the release notes:
Use this map in configuration or validation so a user cannot request “upscale” from a provider that only generates.
Use OpenRouter as a consolidation/fallback path. OpenRouter now supports video, image, and audio. This is useful when you want one credential and one routing layer for multiple modalities, but keep model/provider routing explicit in config. Log the actual model/provider returned where available for cost and quality analysis.
Use Ideogram V4 for asset pipelines. Transparent image generation/editing is useful for product cutouts, overlays, and UI assets. For slow edits, use the async option and poll through the same queued workflow as video. Validate alpha-channel output before publishing to CDN/storage.
Normalize responses at the boundary. TextResponse and FileResponse should be converted into your domain objects immediately: asset record, status, MIME type, dimensions/duration, provider, model, cost metadata if available. Do not let provider response shapes leak into controllers or Blade templates.
Laravel integration tips:
MediaGenerationStarted, MediaGenerationCompleted, and MediaGenerationFailed.sleepAsync() instead of injecting a sleep closure.Breaking change: fromAsync() signature. The third argument changed from ?Closure $sleep to int $timeout for FileResponse and TextResponse.
null now fails.sleep: arguments break.sleepAsync() instead of passing a sleep closure.Unlimited polling can hang workers. If you omit the timeout, make sure the surrounding job has its own timeout/retry policy and stores enough state to resume or fail cleanly. Prefer explicit timeouts for user-facing requests.
Provider capabilities are uneven. The release adds many video providers, but description, repaint, extension, upscaling, and uncrop are not universally supported. Validate operation/provider combinations before dispatch. Reference-guided repaint is especially provider-dependent.
Provider/model changes can be silent quality changes. OpenRouter routing and Ideogram V4 updates can change outputs even when your code is unchanged. Pin model IDs where possible and keep a small evaluation set for critical image/video pipelines.
Credentials and config caching. After changing provider keys or model defaults, clear and rebuild config cache. In Laravel, a stale config:cache is a common cause of “provider not configured” errors.
Large files need lifecycle rules. Video files are large. Use signed URLs or streamed downloads, set retention policies, and clean up failed/partial generations. Do not load video binaries into memory just to inspect metadata.
Cost and rate limits need application-level controls. Video generation and repaint/upscale operations can be expensive. Add per-user quotas, per-provider rate limits, and idempotency keys so retries do not double-charge.
Async state belongs in your database. Provider handles and file URLs are not enough. Store status, attempt count, deadline, provider, model, operation, and last error so a failed queue worker can be retried safely.
Test the migration explicitly. Add a regression test for any async path that previously passed a sleep closure or null, and update named arguments. This is the most likely place for a 0.6 → 0.7 upgrade to break.
How can I help you explore Laravel packages today?