Skip to content

feat: add Stability AI SD3.5 provider for permissive image generation#25

Merged
realityinspector merged 1 commit intomainfrom
feat/stability-ai-provider
Mar 16, 2026
Merged

feat: add Stability AI SD3.5 provider for permissive image generation#25
realityinspector merged 1 commit intomainfrom
feat/stability-ai-provider

Conversation

@realityinspector
Copy link
Collaborator

Summary

  • Adds Stability AI as a new provider for image generation using the SD3.5 Large model via REST API
  • Enables the permissive/free-distillable pipeline to generate images (previously text-only)
  • SD3.5 Large allows downstream distillation, fitting the permissive model policy
  • Includes fallback to OpenRouter (FLUX) if Stability API fails

Changes

  • New file: app/core/providers/stability.py — Stability AI REST API client (multipart/form-data to v2beta/stable-image/generate/sd3)
  • app/config.py — Add STABILITY to ProviderType, STABILITY_API_KEY to Settings, STABILITY_IMAGE to VerifiedModels, update FREE_DISTILLABLE preset with image_model: "stability-ai/sd3.5-large"
  • app/core/model_policy.py — Add stability-ai/ to PERMISSIVE_PREFIXES, handle in derive_model_provider
  • app/core/model_capabilities.py — Add STABILITY to ImageModelType, register stability-ai/sd3.5-large in image model registry, add is_stability_model() helper
  • app/core/providers/__init__.py — Export StabilityProvider
  • app/core/llm_router.py — Initialize Stability provider, route permissive mode to Stability for images, fallback to OpenRouter FLUX on failure

Configuration

Requires STABILITY_API_KEY env var (already set on Railway).

Test plan

  • Verify STABILITY_API_KEY is set in Railway environment
  • Test FREE_DISTILLABLE preset generates images via Stability API
  • Test permissive mode routes to Stability for image generation
  • Test fallback to OpenRouter FLUX when Stability is unavailable
  • Verify non-permissive presets (HD, BALANCED) still use Google as before

Add Stability AI as a new provider for image generation, enabling the
permissive/free-distillable pipeline to generate images using SD3.5 Large
which allows downstream distillation.

- Create StabilityProvider with SD3.5 REST API integration
- Register stability-ai/sd3.5-large in image model registry
- Add STABILITY to ProviderType enum and Settings
- Add stability-ai/ to PERMISSIVE_PREFIXES in model policy
- Update FREE_DISTILLABLE preset with SD3.5 image model
- Wire Stability provider into LLM router with fallback to OpenRouter
@realityinspector realityinspector merged commit e64c29d into main Mar 16, 2026
1 of 3 checks passed
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