Deploy FastSD CPU | (Just Updated) Text-to-Image API, OpenAI-Style, No GPU, API Key Pre-Set
FastSD CPU text-to-image API: SDXS Stable Diffusion on OpenVINO, no GPU
fastsd-cpu
Just deployed
Deploy and Host FastSD CPU (Text-to-Image API) on Railway
A text-to-image API turns a written prompt into a picture over plain HTTP. This template serves SDXS-512, a one-step Stable Diffusion model, on CPU with OpenVINO, the way the FastSD CPU project runs it, behind one authenticated, OpenAI-style HTTP API. The weights are inside the image, an API key is generated at deploy, and no GPU is needed.
About Hosting FastSD CPU
FastSD CPU (the rupeshs/fastsdcpu project, MIT) is a Stable Diffusion runner built for machines with no GPU. Its fastest path is SDXS-512: a model distilled so that one denoising step is enough, converted to OpenVINO, with a tiny autoencoder to turn the result into pixels. This template runs that same path (optimum-intel's OVStableDiffusionPipeline, one step, guidance 1.0, the rupeshs/taesd-ov decoder that SDXS-512-0.9 was trained with) behind a small FastAPI server. FastSD CPU's own desktop and web interfaces are not installed; the API is the whole product.
POST /v1/images/generations takes JSON in the shape of the OpenAI images endpoint: prompt, n (1 to 4), size (512x512, the only size the model makes), response_format (b64_json by default, as OpenAI returns; png returns the image itself for one image), seed for repeatable output, and steps (1 to 4, default 1). GET /v1/models lists the model and the limits in force. Reply headers X-Processing-Seconds, X-Seconds-Per-Image, X-Model and X-Steps report what was done.
The weights are in the image, so nothing downloads at boot. /health answers 503 while the model loads and warms up, then 200 (the model itself loaded in 6 seconds on Railway). One generation runs at a time and up to 3 requests may wait; a fourth answers 429 with Retry-After: 30. A request that cannot finish within 240 seconds answers 504 before Railway's edge cuts the connection at about five minutes. A prompt over 1,000 characters answers 413. Prompts and images are held in memory for one request and never logged or written to disk.
Measured on Railway, 8 vCPU, read from X-Processing-Seconds over the public URL with the model loaded (2026-11-24):
| Request | Seconds |
|---|---|
| one 512x512 image, 6 requests in a row | 0.28 to 0.34 |
n=4 (four images in one request) | 1.10 (0.27 each) |
For comparison, the same image on a 5 vCPU machine took 2.5 to 3.6 seconds per image, so the vCPU count matters: give the service all 8. Memory after boot and warm-up was 4.96 GB and stayed at 4.98 GB after the requests above, so give the service at least 6 GB of RAM. The decoder is the speed lever: in a local test on 5 vCPU the full Stable Diffusion decoder (TINY_VAE=0) took 9 to 10 of an 11-second request, and held about 0.8 GB more memory; that option is kept for anyone who wants it, but it is not measured on Railway.
Limits. 512x512 only, no GPU, no image-to-image, no negative prompt, no streaming. One step makes a quick, slightly soft picture, good for drafts, thumbnails, placeholders and agent loops rather than print. Output differs run to run unless you pass a seed. The model has no safety checker: it draws what it is asked, so keep the API key private and run your own moderation if the service is exposed to other people.
Licence. The wrapper and FastSD CPU's approach are MIT ("Copyright (c) 2023 Rupesh Sreeraman") and Apache-2.0. The model rupeshs/sdxs-512-0.9-openvino is an OpenVINO conversion of IDKiro/sdxs-512-0.9; both declare license: openrail++ and are not gated (read 2026-11-24), and rupeshs/taesd-ov declares license: mit. The CreativeML Open RAIL++-M licence grants "a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare, publicly display, publicly perform, sublicense, and distribute the Complementary Material, the Model, and Derivatives of the Model", so commercial use is allowed, but it also says "You agree not to use the Model or Derivatives of the Model" for a list that includes "To generate or disseminate verifiably false information and/or content with the purpose of harming others", "To provide medical advice and medical results interpretation" and "To defame, disparage or otherwise harass others", and that restriction passes to everyone you let use the model. The licence text ships in the image at /licenses/CreativeML-OpenRAIL++-M-LICENSE. Commercial note: the SDXS model card says it was distilled from SD Turbo, and SD Turbo's own card calls it "a research artifact" and declares no licence; the SDXS authors call 0.9 an old version and say they withdrew 1.0 "to avoid some possible commercial and copyright risks". Read both cards and take advice before selling the output.
Agent contract
- Public URL:
https://RAILWAY_PUBLIC_DOMAIN(the generated domain of thefastsd-cpuservice) - Private URL:
http://fastsd-cpu.railway.internal:8080 - Credentials: the
API_KEYvariable of thefastsd-cpuservice - Auth:
Authorization: Bearer $API_KEYon every route exceptGET /health; no key or a wrong key answers401 - Health:
GET /healthreturns 200 once the model is loaded (503 while loading, 10 to 40 seconds)
# needs: RAILWAY_PUBLIC_DOMAIN, API_KEY (variables of the fastsd-cpu service), curl
# signup: none - the API has no user accounts, only the API_KEY bearer
R="https://$RAILWAY_PUBLIC_DOMAIN"
n=0; until [ "$(curl -s -o /dev/null -w '%{http_code}' "$R/health")" = 200 ]; do n=$((n+1)); [ "$n" -le 60 ] || break; sleep 5; done
curl -s -o /dev/null -w "health: %{http_code}\n" "$R/health"
curl -s -o /dev/null -w "write without key: %{http_code}\n" -X POST "$R/v1/images/generations" -H "Content-Type: application/json" -d '{"prompt":"a red fox in snow"}'
curl -s -o /dev/null -w "write wrong key: %{http_code}\n" -X POST "$R/v1/images/generations" -H "Authorization: Bearer not-the-key" -H "Content-Type: application/json" -d '{"prompt":"a red fox in snow"}'
curl -s -D - -o /tmp/fox.png -X POST "$R/v1/images/generations" -H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" -d '{"prompt":"a red fox in snow, golden hour, photo","response_format":"png","seed":1}' | grep -iE "^(HTTP|x-model|x-steps)"
head -c 4 /tmp/fox.png | tail -c 3; echo
A fresh deploy prints health: 200, write without key: 401, write wrong key: 401, 200 with x-model: sdxs-512 and x-steps: 1, and PNG, the start of a PNG file. For several images use the OpenAI shape and decode data[].b64_json: {"prompt":"a lighthouse at dusk","n":4}. A bad size, step count or response_format, or png with n above 1, answers 422. The API never fetches a URL.
Why Deploy FastSD CPU on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying FastSD CPU on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
- Prompts and pictures stay in your container, not in a hosted image service.
- No GPU bill and no per-image fee; you pay for the container.
- About three tenths of a second per image on 8 vCPU, measured on Railway.
- Drops into OpenAI client code: change the base URL and key.
- Nothing to configure: weights in the image, API key generated at deploy.
- Busy means
429, slow means504, never a hung request.
Common Use Cases
- Images for AI agents: an agent asks for a picture over plain HTTP and gets a PNG back in under a second.
- Placeholders and thumbnails: product, blog or game art generated on demand and cached.
- Prompt drafting: try fifty prompts in a minute before sending the best to a slower model.
Dependencies for FastSD CPU Hosting
- A service with at least 6 GB of RAM and 8 vCPU for the speeds above.
- No volume: the service keeps no state.
Deployment Dependencies
- rupeshs/fastsdcpu: the runner whose SDXS-512 OpenVINO path this serves, MIT
- rupeshs/sdxs-512-0.9-openvino: the weights, OpenRAIL++
- IDKiro/sdxs-512-0.9: the original SDXS-512-0.9 model, OpenRAIL++
- rupeshs/taesd-ov: the tiny autoencoder, MIT
- bon5co/fastsd-cpu-railway: the wrapper image this template deploys, Apache-2.0
Template Content
fastsd-cpu
ghcr.io/bon5co/fastsd-cpu-railway:1.0.0
