feat(server): add /sdapi/v1/extra-single-image and /sdcpp/v1/upscale …#2
Open
mihard wants to merge 6 commits into
Open
feat(server): add /sdapi/v1/extra-single-image and /sdcpp/v1/upscale …#2mihard wants to merge 6 commits into
mihard wants to merge 6 commits into
Conversation
Introduces an OpenAPI 3.1.0 specification covering all 17 server API
endpoints across the three API families (OpenAI, sdapi WebUI, sdcpp
native), with 29 fully documented schema components.
Two new server routes are registered:
- GET /openapi.yaml — serves the embedded OpenAPI specification
- GET /docs — serves Swagger UI (via CDN) pointing at the spec
Implementation:
- examples/server/openapi.yaml — canonical spec file (for tooling)
- examples/server/routes_docs.cpp — embeds spec + Swagger UI HTML and
registers the two new routes
- examples/server/routes.h — declares register_docs_endpoints()
- examples/server/main.cpp — calls register_docs_endpoints()
- examples/server/CMakeLists.txt — adds routes_docs.cpp to the build
https://claude.ai/code/session_01UWEVrPisViQsb7DQm1eGn4
Two improvements to the OpenAPI spec plumbing: 1. openapi.yaml is now the single source of truth. A new CMake custom command runs gen_openapi_yaml_h.py to generate openapi_yaml.h at build time (rebuilds only when openapi.yaml changes). routes_docs.cpp includes the generated header instead of embedding a 1500-line copy. 2. A new validation gate (validate_openapi.py) runs as a pre-build step and fails the build if openapi.yaml paths do not match the routes registered in routes_openai.cpp, routes_sdapi.cpp, and routes_sdcpp.cpp. Parameterised httplib regex paths are mapped to their OpenAPI path template equivalents before comparison. https://claude.ai/code/session_01UWEVrPisViQsb7DQm1eGn4
Adds .github/workflows/docker-ci.yml which triggers on push to any branch descended from the `docker` base branch (determined via git merge-base ancestry check). Flow per push: 1. check-ancestry — fast gate; skips all subsequent jobs if the branch is not descended from `docker` 2. build-linux-cpu + build-linux-vulkan — run in parallel; each installs pyyaml, runs validate_openapi.py explicitly, then builds with cmake (cmake also re-runs the validator as a pre-build step) 3. build-and-push-docker — gated on both CI jobs passing; builds Dockerfile.vulkan and pushes to ghcr.io/mihard/stable-diffusion.cpp tagged <sanitized-branch>-<short-sha> https://claude.ai/code/session_01QA3cwbaLkeP2sBbxAFKQFj
- Dockerfile.vulkan: add python3 + python3-yaml to build stage so the cmake pre-build step (validate_openapi.py) can run inside the container - docker-ci.yml: drop build-linux-vulkan job — Vulkan compilation is already validated by the Docker build itself (same as upstream CI) Update build-and-push-docker needs accordingly https://claude.ai/code/session_01QA3cwbaLkeP2sBbxAFKQFj
- docker-ci.yml: change IMAGE_NAME to <repo>/vulkan so images are published as ghcr.io/mihard/stable-diffusion.cpp/vulkan:<branch>-<sha> - cleanup-ghcr.yml: weekly scheduled job (Sundays 03:00 UTC) using snok/container-retention-policy to delete vulkan image versions older than 30 days; also wired to workflow_dispatch for manual runs https://claude.ai/code/session_01QA3cwbaLkeP2sBbxAFKQFj
…endpoints
Adds standalone image upscaling to both API surfaces:
- POST /sdapi/v1/extra-single-image (synchronous, A1111-compatible)
Accepts image + upscaler_1/upscaler_2 + scale/target dims. Returns
{"image": "<base64-png>", "html_info": ""}.
- POST /sdcpp/v1/upscale (async, native sdcpp API)
Queues an upscale job, polled via GET /sdcpp/v1/jobs/{id}.
Shared upscale logic (perform_upscale) handles:
- Built-in upscalers: None (passthrough), Lanczos (CatmullRom filter),
Nearest (Box filter) via new resize_sd_image() in media_io
- Model-backed upscalers: new_upscaler_ctx/upscale from hires_upscalers_dir
- Optional two-upscaler pixel blending (upscaler_2_visibility)
- ESRGAN output → exact target size resize when dims differ
Also adds ExtraSingleImageRequest, ExtraSingleImageResponse, and
UpscaleRequest schemas to openapi.yaml (19 routes validated).
https://claude.ai/code/session_01WVK99Jp6uLuZwnXpydhK3G
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…endpoints
Adds standalone image upscaling to both API surfaces:
POST /sdapi/v1/extra-single-image (synchronous, A1111-compatible) Accepts image + upscaler_1/upscaler_2 + scale/target dims. Returns {"image": "", "html_info": ""}.
POST /sdcpp/v1/upscale (async, native sdcpp API) Queues an upscale job, polled via GET /sdcpp/v1/jobs/{id}.
Shared upscale logic (perform_upscale) handles:
Also adds ExtraSingleImageRequest, ExtraSingleImageResponse, and UpscaleRequest schemas to openapi.yaml (19 routes validated).
https://claude.ai/code/session_01WVK99Jp6uLuZwnXpydhK3G
Summary
Related Issue / Discussion
Additional Information
Checklist