| sd_api_start | R Documentation |
Launches a plumber-based REST API for image generation. Optionally pre-loads a model at startup.
sd_api_start(
model_path = NULL,
model_type = "sd1",
model_id = NULL,
vae_decode_only = TRUE,
host = "0.0.0.0",
port = 8080L,
api_key = NULL,
...
)
model_path |
Optional path to model file to load at startup |
model_type |
Model type for the pre-loaded model (default "sd1") |
model_id |
Identifier for the pre-loaded model (default: basename of model_path) |
vae_decode_only |
VAE decode only for the pre-loaded model (default TRUE) |
host |
Host to bind to (default "0.0.0.0") |
port |
Port to listen on (default 8080) |
api_key |
Optional API key string. When set, non-localhost requests
must include |
... |
Additional arguments passed to |
Invisibly returns the plumber router object
## Not run:
# Start with a pre-loaded model
sd_api_start("model.safetensors", model_type = "flux", port = 8080)
# Start empty, load models via API
sd_api_start(port = 8080)
# With API key
sd_api_start("model.safetensors", api_key = "my-secret-key")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.