Repository navigation
docs: add /images/edits and /images/variations endpoint specs - #1278
Conversation
Document the two new image API endpoints added in lemonade-sdk#1121: - POST /api/v1/images/edits: accepts multipart/form-data with a source image and prompt, returns an edited image. Supports model, image, prompt (required), mask, size, n, response_format, steps, cfg_scale, and seed parameters. - POST /api/v1/images/variations: accepts multipart/form-data with a source image, returns a variation with no prompt. Supports model, image (required), size, n, and response_format parameters. Both sections include parameter tables with status badges and example requests using curl and the OpenAI Python client. The endpoint overview list is also updated to include the two new routes.
There was a problem hiding this comment.
Pull request overview
Adds documentation for two newly introduced OpenAI-compatible image endpoints in the Lemonade Server spec, expanding the documented surface area of the server’s image APIs.
Changes:
- Add
/api/v1/images/editsendpoint documentation (multipart form upload + prompt → edited image). - Add
/api/v1/images/variationsendpoint documentation (multipart form upload → variation, no prompt). - Update the endpoints overview list to include both routes.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…pat params - Fix handle_image_edits to actually extract steps, cfg_scale, and seed from the multipart form so they are forwarded to the sd.cpp backend - Document n parameter range (1-10) with 400 error behavior for both /images/edits and /images/variations - Add undocumented OpenAI API compatibility fields (user, background, quality, input_fidelity, output_compression) to the /images/edits parameter table with a note that they are accepted but not forwarded - Add user field to /images/variations parameter table with same note Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Use pos overload of stoi/stof to reject inputs with trailing non-numeric characters (e.g. "10abc"), which stoi/stof would otherwise silently accept - Reject NaN and Inf values for cfg_scale - Update /images/variations note: prompt is not supported and will be ignored (the handler never extracted it, so "not accepted" was misleading) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Log backend error details at ERROR level when image_edits or image_variations returns an error response, so the cause is visible in server logs instead of just "Error 500" - Fix api_image_variations example to use SD-Turbo (consistent with what the test suite uses and what works reliably) instead of Flux-2-Klein-4B, which is an edit model and behaves poorly when given the "variation" placeholder prompt via img2img mode - Explicitly set response_format=b64_json in both example paths - Wrap the OpenAI client call in try/except to print error details instead of crashing silently Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@claude review this PR, specifically:
|
lazy robot! lol |
|
Lol there is a failure in the workflow. I will fix it tonight. |
|
@claude review this PR, specifically: Is the spec accurate with respect to the implementation (which already existed before this PR)? |
Review SummaryVerdict: APPROVE Blocking (must fix)None — no blocking issues found. Non-blocking (suggestions)
Good stuff
|
Add pos != val.size() guard to parse_n_from_form and output_compression parsing, matching the pattern already used in parse_int_field/parse_float_field lambdas. Update output_compression doc wording for precision. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Thanks for the thorough review! Addressed the suggestions in 934cc2e:
|
Document the two new image API endpoints added in #1121:
POST /api/v1/images/edits: accepts multipart/form-data with a source image and prompt, returns an edited image. Supports model, image, prompt (required), mask, size, n, response_format, steps, cfg_scale, and seed parameters.
POST /api/v1/images/variations: accepts multipart/form-data with a source image, returns a variation with no prompt. Supports model, image (required), size, n, and response_format parameters.
Both sections include parameter tables with status badges and example requests using curl and the OpenAI Python client. The endpoint overview list is also updated to include the two new routes.
Server-side changes (in addition to docs):
steps,cfg_scale, andseedform fields inhandle_image_edits— these were documented but not previously extracted from the multipart form"10abc"thatstoi/stofwould silently accept), and reject NaN/Inf forcfg_scaleuser,background,quality,input_fidelity,output_compression) that are accepted but not forwarded to the backendpromptin/images/variationsis ignored rather than rejected