Back to browse
GitHub Repository

Pure Go bindings for stable-diffusion.cpp

7 starsGo

Gosd: High-performance Stable Diffusion inference in pure Go(no CGO)

by krakato·May 7, 2026·1 point·0 comments

AI Analysis

●●SolidBig BrainNiche Gem

Pure Go Stable Diffusion bindings that skip CGO headaches entirely.

Strengths
  • Zero CGO dependency means cross-compilation works without a C++ toolchain.
  • Supports hardware acceleration across CUDA, Metal, Vulkan, and ROCm backends.
  • Callback system allows real-time preview generation during the inference loop.
Weaknesses
  • Still requires manual installation of external stable-diffusion shared libraries.
  • Performance claims lack direct benchmark comparison against existing Go wrappers.
Category
Target Audience

Go developers building AI applications

Similar To

go-stable-diffusion · stable-diffusion.cpp

Post Description

Hello everyone,

I'm building a multimodal AI inference platform in Go and needed Stable Diffusion support for image/video generation.

Existing Go bindings for stable-diffusion.cpp were either outdated or no longer maintained, so I decided to build my own.

gosd is a set of Pure Go(no CGO - ffi-based) bindings for stable-diffusion.cpp. It is cross-platform(regularly tested on Win, Linux, Mac) and integrates seamlessly to existing Go-based codebases and applications(no C++ compiler needed for your builds).

You can generate images, videos, edit images, preprocess images with Canny, watch images/videos being generated after every step in the inference loop and much more.

Around a dozen of models can be used for generation(Wan2.2, Flux...) - please have a look at https://github.com/leejet/stable-diffusion.cpp for the full list of compatible models.

On my local setup with Radeon 7900XTX, a full HD image can be generated in about 10-30sec. You don't need a GPU for generation, CPU alone will be fine(although 10-100x slower).

The library is MIT licensed so you can use it pretty much however you want it.

I'd appreciate any feedback - hopefully you'll have as much fun with gosd as I have.

Similar Projects

AI/ML●●Solid

ExoGen – Open-Source Local Stable Diffusion Client

Everything you type and generate stays on your machine — model downloads, LoRA mixing, upscaling via Real-ESRGAN and inference run locally while the app shows real-time progress and backend logs. The app leans into practical UX (hardware-based model recommendations, visual memory allocation, generation history) which makes setup and iteration less painful. It isn't reinventing the local-UI wheel — AUTOMATIC1111 and ComfyUI still dominate — but ExoGen is a tidy, approachable alternative for people who want a desktop, privacy-first experience.

Solve My ProblemNiche Gem
andyngdz
114mo ago
Security●●Solid

mls-go – pure Go implementation of RFC 9420 (MLS)

Pure Go MLS with no CGO—interop-verified against mlspp and OpenMLS.

Niche GemWizardry
tomasvilte
311mo ago