diff --git a/docs/diffusion/api/openai_api.md b/docs/diffusion/api/openai_api.md index 2eda86fdf..30d8d5312 100644 --- a/docs/diffusion/api/openai_api.md +++ b/docs/diffusion/api/openai_api.md @@ -102,7 +102,8 @@ curl -sS -X POST "http://localhost:30010/v1/images/generations" \ ``` > **Note** -> The `response_format=url` option is not supported for `POST /v1/images/generations` and will return a `400` error. +> If `response_format=url` is used and cloud storage is not configured, the API returns +> a relative URL like `/v1/images//content`. **Edit an image** @@ -136,7 +137,8 @@ curl -sS -X POST "http://localhost:30010/v1/images/edits" \ **Download image content** -When `response_format=url` is used with `POST /v1/images/edits`, the API returns a relative URL like `/v1/images//content`. +When `response_format=url` is used with `POST /v1/images/generations` or `POST /v1/images/edits`, +the API returns a relative URL like `/v1/images//content`. **Endpoint:** `GET /v1/images/{image_id}/content` diff --git a/python/sglang/multimodal_gen/runtime/entrypoints/openai/image_api.py b/python/sglang/multimodal_gen/runtime/entrypoints/openai/image_api.py index 9dc2a043a..7d6f1a5db 100644 --- a/python/sglang/multimodal_gen/runtime/entrypoints/openai/image_api.py +++ b/python/sglang/multimodal_gen/runtime/entrypoints/openai/image_api.py @@ -159,6 +159,8 @@ async def generations( result, b64_list=b64_list, cloud_url=cloud_url, + # Provide a local fallback URL when cloud upload is unavailable, mirroring /v1/images/edits. + fallback_url=f"/v1/images/{request_id}/content", ) return ImageResponse(**response_kwargs)