Skip to content

Conversation

@0xsatoshi99
Copy link

@0xsatoshi99 0xsatoshi99 commented Dec 5, 2025

Summary

Adds Replicate API service for image generation, supporting FLUX and SDXL models.

#303

Features

  • FLUX.1 models (Schnell, Dev, Pro)
  • SDXL support with negative prompts
  • Async prediction with polling
  • Multiple aspect ratio support

Models Supported

Model Description
flux-schnell Fast 4-step generation
flux-dev Development model with guidance
flux-pro Professional quality
sdxl Stable Diffusion XL

Files Changed

  • neurons/generator/services/replicate_service.py - Main service implementation
  • neurons/generator/services/service_registry.py - Registry integration
  • tests/generator/replicate_service.py - Test suite

Usage

export REPLICATE_API_TOKEN=your_token
export IMAGE_SERVICE=replicate

Contribution by Gittensor, learn more at https://gittensor.io/


Note

Introduces a Replicate-backed image generation service supporting FLUX and SDXL, integrates it into the service registry, and adds a focused test suite.

  • Image Generation Service:
    • Add ReplicateService (neurons/generator/services/replicate_service.py) implementing Replicate API image generation.
    • Supports models: flux-schnell, flux-dev, flux-pro, sdxl (negative prompts only for sdxl).
    • Implements async prediction creation/polling (_create_prediction, _poll_prediction), image download, and metadata return (prediction_id, generation_time).
  • Registry Integration:
    • Register replicate in SERVICE_MAP and env options in ServiceRegistry (IMAGE_SERVICE/VIDEO_SERVICE include replicate).
  • Tests:
    • Add tests/generator/replicate_service.py covering FLUX/SDXL generation, SDXL negative prompts, invalid model, and invalid API key.

Written by Cursor Bugbot for commit 8cde0c2. This will update automatically on new commits. Configure here.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

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

@0xsatoshi99
Copy link
Author

@dylanuys Can you plz check this PR and give me your feedback? Thanks.

"openrouter": OpenRouterService,
"local": LocalService,
"stabilityai": StabilityAIService
"replicate": ReplicateService,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: StabilityAI service accidentally removed from SERVICE_MAP

The StabilityAIService is imported but was accidentally removed from SERVICE_MAP when adding ReplicateService. The diff shows "stabilityai": StabilityAIService was removed from the map while the import on line 8 remains. This breaks the ability to use Stability AI as an image generation service via IMAGE_SERVICE=stabilityai.

Fix in Cursor Fix in Web

Copy link
Contributor

@dylanuys dylanuys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do the media returned by these models contain C2PA?

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.

2 participants