E52E feat: add OpenAI compatible image generation support by freinold · Pull Request #382 · presenton/presenton · GitHub
[go: up one dir, main page]

Skip to content

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.

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

2 participants

0