Skip to content

feat: Add ModelsLabImageGenerationTool for image generation#4557

Open
adhikjoshi wants to merge 1 commit intocrewAIInc:mainfrom
adhikjoshi:feat/modelslab-tool
Open

feat: Add ModelsLabImageGenerationTool for image generation#4557
adhikjoshi wants to merge 1 commit intocrewAIInc:mainfrom
adhikjoshi:feat/modelslab-tool

Conversation

@adhikjoshi
Copy link

Summary

Adds ModelsLabImageGenerationTool — a CrewAI tool for generating images using ModelsLab's text-to-image API.

ModelsLab provides access to 200+ AI models (Flux, SDXL, Stable Diffusion, community fine-tunes) via a unified API, complementing the existing DallETool.


What this adds

File Purpose
tools/modelslab_tool/modelslab_tool.py Main tool class
tools/modelslab_tool/__init__.py Module init
tools/modelslab_tool/README.md Usage docs
tools/__init__.py Export registration

Features

  • Follows the same BaseTool pattern as DallETool
  • Configurable model, width, height, inference steps, guidance, seed, negative prompt
  • Automatic async polling for processing status responses
  • Returns JSON with image_url, all_image_urls, model, and prompt

Usage

from crewai import Agent, Task, Crew
from crewai_tools import ModelsLabImageGenerationTool

image_tool = ModelsLabImageGenerationTool(
    model="flux",
    width=1024,
    height=1024,
    negative_prompt="blurry, low quality",
)

designer = Agent(
    role="Visual Designer",
    goal="Create stunning images",
    backstory="Expert visual designer.",
    tools=[image_tool],
)

task = Task(
    description="Generate an image of a futuristic city at night.",
    agent=designer,
    expected_output="URL to the generated image.",
)

crew = Crew(agents=[designer], tasks=[task])
result = crew.kickoff()

API Reference

Adds ModelsLabImageGenerationTool, a CrewAI tool that generates images
using ModelsLab's text-to-image API (https://modelslab.com).

ModelsLab provides access to 200+ AI models (Flux, SDXL, Stable Diffusion,
community fine-tunes) via a single unified API, similar to DALL-E but
provider-agnostic.

## What this adds

- lib/crewai-tools/src/crewai_tools/tools/modelslab_tool/modelslab_tool.py
- lib/crewai-tools/src/crewai_tools/tools/modelslab_tool/__init__.py
- lib/crewai-tools/src/crewai_tools/tools/modelslab_tool/README.md
- Updated tools/__init__.py to export ModelsLabImageGenerationTool

## Features

- Generates images from text prompts via ModelsLab API
- Supports all ModelsLab community models (flux, sdxl, sd3, etc.)
- Configurable width/height/steps/guidance/seed/negative_prompt
- Automatic async polling for delayed generations (processing status)
- Returns JSON with image_url, all_image_urls, model, and prompt

## Usage

from crewai_tools import ModelsLabImageGenerationTool

image_tool = ModelsLabImageGenerationTool(model='flux', width=1024, height=1024)
agent = Agent(tools=[image_tool], ...)

## API Reference

https://docs.modelslab.com/image-generation/community-models/text2img
@cursor
Copy link

cursor bot commented Feb 21, 2026

You have run out of free Bugbot PR reviews for this billing cycle. This will reset on February 28.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant