Skip to content

[Feature] sd-server: add the A1111 metadata endpoints and interrupt that clients like SDAI require #2348

Done

Description

@wiz0floyd

Feature Summary

sd-server's A1111 API (/sdapi/v1/*) is missing several metadata endpoints that A1111 client apps fetch during setup, so those apps fail before they ever reach txt2img.

Detailed Description

SDAI, an Android/iOS client with an "AUTOMATIC1111" provider, aborts setup on the first 404. Against sd-server (Vulkan build, master as of 0f8a467) these return 404:

Endpoint A1111 response shape
GET /sdapi/v1/embeddings {"loaded":{},"skipped":{}}
GET /sdapi/v1/hypernetworks []
GET /sdapi/v1/sd-modules []
GET /sdapi/v1/extensions []
GET /sdapi/v1/script-info []
GET /sdapi/v1/scripts {"txt2img":[],"img2img":[]}
POST /sdapi/v1/options {} (settings update)
POST /sdapi/v1/interrupt {} (cancel the running job)

The first error SDAI shows is Client request (GET http://host:8080/sdapi/v1/hypernetworks) invalid: 404 Not Found. The list above comes from SDAI's KtorAutomatic1111MetadataApi.kt and KtorAutomatic1111GenerationApi.kt.

Proposal:

  • Return empty results for the six metadata endpoints. sd-server has no equivalent concepts, so "nothing available" is accurate.
  • Accept POST /sdapi/v1/options as a no-op, because the server's options are fixed at launch.
  • Implement POST /sdapi/v1/interrupt with sd_cancel_generation(sd_ctx, SD_CANCEL_ALL) while an sdapi generation is active.

I have a patch for this (about 45 lines in examples/server/routes_sdapi.cpp) and will open a PR.

Alternatives you considered

A reverse proxy in front of sd-server that serves fixed responses for these paths. It works, but every A1111-client user would have to rebuild it.

Additional context

Found while serving FLUX.3 Image Klein through llama-swap to SDAI on Android.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions