This project is not covered by Drupal’s security advisory policy.

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

  • Provider plugin krea for the text_to_image and image_to_image operation types of the AI module. Any module that generates images through the AI module can use it.
  • Image to image capabilities: upscale, edit, inpaint, erase, search and replace, search and recolor, remove background, style guide, style transfer and sketch. The AI module's capability filtering picks a model that supports what you ask for.
  • Per model settings (aspect ratio, resolution, seed, guidance, number of images, scale factor and more) that appear in the AI module's model configuration and can be set from code with setConfiguration().
  • Asynchronous jobs are submitted, polled and downloaded transparently. Input images are uploaded as Krea assets first. Poll interval and maximum wait are configurable.
  • A settings page that validates the API key on save, lists the available models and shows a usage summary.
  • A usage page with local request counters, recent jobs from Krea and workspace usage for the last 30 days.
  • A styles page to list, edit, share and publish Krea styles (LoRAs), and to apply one to a generation through the Style (LoRA) ID setting.
  • The krea_lora plugin for the AI Fine-tuning module (ai_finetuner): train a style, character or object LoRA from 5 to 30 images on Flux, Krea 2, Qwen, Z Image or Wan, straight from Drupal content.
  • Optional zero data retention header for requests to Krea.
  • Written against the REST API directly. No vendor SDK.

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 using the Key module.
  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.


Requirements/Dependencies

  • AI (Artificial Intelligence) module.
  • Key module, for storing the API key.
  • A Krea account with API access.
  • The AI Fine-tuning module (ai_finetuner) only if you want to train LoRAs; the provider works without it.

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.

Supporting organizations: 
Initial Documentation

Project information

Releases