OpenMAIC lib/media Image and Video Generation Providers: Complete 2024 Guide

OpenMAIC's lib/media module supports 11 image generation providers and 3 video generation providers through a unified adapter-based architecture.

The lib/media directory in the THU-MAIC/OpenMAIC repository provides a clean abstraction layer for image and video generation. Rather than calling third-party APIs directly, developers interact with provider-agnostic interfaces while the framework handles service-specific implementations.

Image Generation Providers in lib/media

OpenMAIC ships with 11 distinct image generation adapters, covering both commercial APIs and self-hosted solutions.

Commercial API Adapters

Specialized Platform Adapters

Self-Hosted Adapter

The comfyui-image-adapter.ts enables local image generation by interfacing with ComfyUI workflows, making OpenMAIC suitable for privacy-sensitive deployments.

Video Generation Providers in lib/media

Video generation support is more focused with 3 specialized adapters:

Provider Adapter File Notes
VEO (Google) veo-adapter.ts High-quality text-to-video
MiniMax minimax-video-adapter.ts Same vendor, separate video API
Grok (xAI) grok-video-adapter.ts Video generation via xAI

Provider Registration Architecture

All adapters are registered in centralized registry files located at the lib/media root:

This registry pattern allows the higher-level media APIs to request generation without hardcoding service details. To add a new provider, implement the adapter interface and register the mapping in the appropriate providers file.

Example: Using a Provider Programmatically

While the raw source doesn't expose usage examples, the architecture implies this interaction pattern:

// Provider selection through registry lookup
const provider = mediaRegistry.getProvider('openai-image');
const result = await provider.generate({
  prompt: 'A futuristic robot in a cyberpunk city',
  size: '1024x1024'
});

Each adapter normalizes response formats so calling code receives consistent output regardless of underlying service.

Summary

  • 11 image providers including DALL·E, Qwen, ComfyUI, and 7 others
  • 3 video providers: VEO, MiniMax, and Grok
  • All adapters live in lib/media/adapters/ with descriptive filenames
  • Registration happens in image-providers.ts and video-providers.ts
  • ComfyUI support enables fully self-hosted image generation
  • The adapter pattern isolates service-specific logic from application code

Frequently Asked Questions

How do I add a custom image provider to OpenMAIC?

Create a new file in lib/media/adapters/ implementing the adapter interface, then import and register it in image-providers.ts with a unique provider key. The existing openai-image-adapter.ts serves as the canonical reference implementation.

Does OpenMAIC support local image generation without cloud APIs?

Yes. The comfyui-image-adapter.ts enables local generation by connecting to a self-hosted ComfyUI instance. This is the only fully offline-capable adapter in the current lib/media distribution.

Why are there separate adapters for MiniMax image and video?

MiniMax operates distinct API endpoints and authentication flows for image versus video generation. The minimax-image-adapter.ts and minimax-video-adapter.ts each handle service-specific request/response formatting while exposing a unified interface to the registry.

What determines which provider is used at runtime?

The provider registry in image-providers.ts or video-providers.ts maps string keys to adapter instances. Application configuration or user selection specifies the provider name, and the registry resolves the appropriate adapter implementation transparently.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →