Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: add OpenAI compatible image generation support#382

Open
freinold wants to merge 2 commits intopresenton:mainfrom
freinold:main
Open

feat: add OpenAI compatible image generation support#382
freinold wants to merge 2 commits intopresenton:mainfrom
freinold:main

Conversation

@freinold
Copy link

@freinold freinold commented Dec 24, 2025

Description

This PR introduces a new image provider openai_compatible that allows users to connect to any OpenAI-API-compatible image generation endpoint (e.g., LiteLLM, vLLM, Azure OpenAI, or self-hosted gateways). This feature decouples image generation from the text LLM provider, offering greater flexibility for enterprise and self-hosted deployments where image generation might be handled by a separate proxy or service.

Key Changes

  • New Provider: Added openai_compatible to the ImageProvider enum.
  • Configuration: Introduced new environment variables to configure the provider independently:
    • OPENAI_COMPAT_IMAGE_BASE_URL
    • OPENAI_COMPAT_IMAGE_API_KEY
    • OPENAI_COMPAT_IMAGE_MODEL (Strictly required, no default)
  • Implementation: Implemented generate_image_openai_compatible method in ImageGenerationService, utilizing the standard AsyncOpenAI client with a custom base_url.
  • Validation: Added strict validation to ensure all required configuration parameters (URL, Key, Model) are present before attempting generation.
  • Tests: Added tests/test_image_generation_openai_compatible.py with comprehensive unit tests for provider selection, successful generation, and error handling for missing config.
  • Documentation: Updated README.md with the new provider options and a specific "Using an OpenAI-Compatible Image Provider" configuration example.

How to Test

  1. Run the backend tests: uv run pytest servers/fastapi/tests/test_image_generation_openai_compatible.py.
  2. Start the server with the following environment variables:
    IMAGE_PROVIDER=openai_compatible
    OPENAI_COMPAT_IMAGE_BASE_URL=https://api.openai.com/v1 # or your proxy URL
    OPENAI_COMPAT_IMAGE_API_KEY=sk-proj-....
    OPENAI_COMPAT_IMAGE_MODEL=dall-e-3
  3. Generate a presentation and verify that images are generated using the specified endpoint.

Checklist

  • Code compiles and runs
  • Tests added/updated (test_image_generation_openai_compatible.py)
  • Documentation updated (README.md)
  • [~] Dependencies updated (not applicable)

Closes #381

@freinold
Copy link
Author

freinold commented Jan 6, 2026

@sauravniraula @surajbeston @ShivaRajBadu @sudipnext

Could one of you please review these changes?

@papandadj
Copy link

@sauravniraula @surajbeston @ShivaRajBadu @sudipnext
Could anyone review that?. This is very useful feature.

@seppel123
Copy link

Will this be mergend soon?

@sudipnext
Copy link
Collaborator

Right now, we’re preparing our contribution roadmap and guidelines so we can handle PRs in a structured way.
Once that’s published, we’ll start reviewing and merging accordingly.
Really appreciate your support around the project! @freinold

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.

Feature request: Custom OpenAI-compatible Image Generation endpoint (LiteLLM / OpenAI proxy) support

4 participants