HKUDS/DeepTutor · error · GenerationProviderError

No endpoint URL configured for image generation.

Error message

No endpoint URL configured for image generation.

What it means

Raised by OpenAICompatImagegenAdapter.generate when ImagegenConfig.base_url is empty. The adapter POSTs to join_api_path(config.base_url, 'images/generations'), so an empty base URL leaves no endpoint to call.

Source

Thrown at deeptutor/services/imagegen/adapters/openai_compat.py:37

    GenerationProviderError,
    build_auth_headers,
    join_api_path,
    raise_for_provider,
)
from deeptutor.services.imagegen.base import BaseImagegenAdapter
from deeptutor.services.imagegen.config import ImagegenConfig

logger = logging.getLogger(__name__)


class OpenAICompatImagegenAdapter(BaseImagegenAdapter):
    """POST ``{base}/images/generations`` with a JSON body, returning image bytes."""

    async def generate(
        self, prompt: str, config: ImagegenConfig, *, n: int = 1
    ) -> list[tuple[bytes, str]]:
        if not config.base_url:
            raise GenerationProviderError("No endpoint URL configured for image generation.")
        url = join_api_path(config.base_url, "images/generations")
        headers = {
            "Content-Type": "application/json",
            **build_auth_headers(config.auth_style, config.api_key),
            **(config.extra_headers or {}),
        }
        payload: dict[str, Any] = {"model": config.model, "prompt": prompt, "n": max(1, n)}
        if config.size:
            payload["size"] = config.size
        if config.quality:
            payload["quality"] = config.quality
        if config.style:
            payload["style"] = config.style
        if config.response_format:
            payload["response_format"] = config.response_format

        logger.debug(
            "imagegen url=%s model=%s n=%d size=%s", url, config.model, max(1, n), config.size

View on GitHub (pinned to 3e82f13042)

Solutions

  1. Set base_url (e.g. https://api.openai.com/v1) on the ImagegenConfig before calling generate
  2. Verify the provider config in data/user/settings/*.json or env includes the base URL
  3. Confirm the chosen provider actually exposes POST {base}/images/generations

Example fix

// before
config = ImagegenConfig(base_url="", api_key=key)
// after
config = ImagegenConfig(base_url="https://api.openai.com/v1", api_key=key)
Defensive patterns

Strategy: validation

Validate before calling

if not config.base_url:
    raise ValueError("Set ImagegenConfig.base_url (e.g. https://api.openai.com/v1) before generate()")

Type guard

def is_configured(config) -> bool:
    return bool(getattr(config, "base_url", None))

Prevention

When it happens

Trigger: Calling generate() on the OpenAI-compatible adapter with base_url None/'' — typically a provider settings entry missing the base URL, or the env var feeding it unset.

Common situations: Missing env var for the imagegen API host, typo in settings JSON, switching providers without updating the base URL field.

Related errors


AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27). Data as JSON: /api/errors/94850319200c57dd. Report an issue: GitHub.