Krea Provider connects the Drupal AI module to the Krea API for text to image and image to image generation. It exposes 25 text to image models and 31 image to image models (Krea 2, Flux, Nano Banana, Ideogram, ChatGPT Image, Grok, Seedream, Qwen, Z Image and others, plus Krea Enhance and Topaz upscalers), handles Krea's asynchronous jobs and asset uploads for you, and adds a styles manager and a fine-tuning plugin for training your own LoRAs.

Features

Mock API for development

The ai_provider_krea_mock submodule implements every endpoint the provider uses inside your Drupal site, returns generated PNGs at the requested size and trains fake styles. Point the endpoint at it to run tests and demos without spending credits.

Agent skill included

The module ships .agents/skills/use-krea-provider, a skill for AI coding assistants covering setup, the mock, generating and upscaling images, and adding models to the registry.


Installation

  1. Install and enable: composer require drupal/ai_provider_krea, then drush en ai_provider_krea.
  2. Create an API key on krea.ai. The token has the form id:secret. Store it in an environment variable and create a Key entity with the Key module's environment provider.
  3. Go to Configuration > AI > Providers > Krea Authentication (/admin/config/ai/providers/krea) and select the key. Saving sends one request to Krea to validate it.
  4. Optionally set Krea as the default provider for text to image and image to image under Configuration > AI > Settings.

Try it from code

$provider = \Drupal::service('ai.provider')->createInstance('krea');

$provider->setConfiguration(['aspect_ratio' => '16:9']);

$images = $provider->textToImage('a red boat, watercolor', 'krea-2-medium')->getNormalized();

Every generation and every training run spends Krea credits. Use the mock submodule for automated tests and local development.


Related Modules

Requirements/Dependencies


AI disclosure

All code in this module was written with AI coding assistants under human supervision. The maintainer reviewed and tested every change before committing it and is responsible for the result.