Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Built in Go for performance and simplicity, llama-swap has zero dependencies and

- ✅ Easy to deploy and configure: one binary, one configuration file. no external dependencies
- ✅ On-demand model switching
- ✅ Use any local OpenAI compatible server (llama.cpp, vllm, tabbyAPI, stable-diffusion.cpp, etc.)
- ✅ Use any local OpenAI compatible server (llama.cpp, vllm, tabbyAPI, stable-diffusion.cpp, whisper.cpp etc.)
- future proof, upgrade your inference servers at any time.
- ✅ OpenAI API supported endpoints:
- `v1/completions`
Expand Down Expand Up @@ -69,6 +69,7 @@ llama-swap can be installed in multiple ways
### Docker Install ([download images](https://github.com/mostlygeek/llama-swap/pkgs/container/llama-swap))

Nightly container images with llama-swap and llama-server are built for multiple platforms (cuda, vulkan, intel, etc.) including [non-root variants with improved security](docs/container-security.md).
The whisper.cpp server is also included for the cuda, musa and vulkan platforms.
The stable-diffusion.cpp server is also included for the musa and vulkan platforms.

```shell
Expand Down
13 changes: 13 additions & 0 deletions docker/build-container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ fi
# variable, this permits testing with forked llama.cpp repositories
BASE_IMAGE=${BASE_LLAMACPP_IMAGE:-ghcr.io/ggml-org/llama.cpp}
SD_IMAGE=${BASE_SDCPP_IMAGE:-ghcr.io/leejet/stable-diffusion.cpp}
WH_IMAGE=${BASE_WHISPERCPP_IMAGE:-ghcr.io/ggml-org/whisper.cpp}

# Set llama-swap repository, automatically uses GITHUB_REPOSITORY variable
# to enable easy container builds on forked repos
Expand Down Expand Up @@ -112,6 +113,7 @@ else
fi

SD_TAG=master-${ARCH}
WH_TAG=main-${ARCH}

# Abort if LCPP_TAG is empty.
if [[ -z "$LCPP_TAG" ]]; then
Expand Down Expand Up @@ -157,6 +159,17 @@ for CONTAINER_TYPE in non-root root; do
-t ${CONTAINER_TAG} -t ${CONTAINER_LATEST} . ;;
esac

# For architectures with whisper.cpp support, layer whisper-server on top
case "$ARCH" in
"cuda" | "musa" | "vulkan")
log_info "Adding whisper-server to $CONTAINER_TAG"
docker build -f llama-swap-whisper.Containerfile \
--build-arg BASE=${CONTAINER_TAG} \
--build-arg WH_IMAGE=${WH_IMAGE} --build-arg WH_TAG=${WH_TAG} \
--build-arg UID=${USER_UID} --build-arg GID=${USER_GID} \
-t ${CONTAINER_TAG} -t ${CONTAINER_LATEST} . ;;
esac

if [ "$PUSH_IMAGES" == "true" ]; then
docker push ${CONTAINER_TAG}
docker push ${CONTAINER_LATEST}
Expand Down
8 changes: 8 additions & 0 deletions docker/config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ models:
-hf bartowski/SmolLM2-135M-Instruct-GGUF:Q4_K_M
--port 9999

whisper:
checkEndpoint: /v1/audio/transcriptions/
cmd: >
/app/whisper-server
--host 127.0.0.1 --port ${PORT}
-m /models/ggml-large-v3-turbo.bin
--request-path /v1/audio/transcriptions --inference-path ""

z-image:
checkEndpoint: /
cmd: |
Expand Down
14 changes: 14 additions & 0 deletions docker/llama-swap-whisper.Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
ARG WH_IMAGE=ghcr.io/ggml-org/whisper.cpp
ARG WH_TAG=main-cuda
ARG BASE=llama-swap:latest

FROM ${WH_IMAGE}:${WH_TAG} AS ws-source
FROM ${BASE}

ARG UID=10001
ARG GID=10001

COPY --from=ws-source --chown=${UID}:${GID} /app/build/bin/whisper-server /app/whisper-server
COPY --from=ws-source --chown=${UID}:${GID} /app/build/src/*.so* /app/
Copy link
Copy Markdown
Contributor Author

@rare-magma rare-magma Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mostlygeek if the ggml library version diverges between llama-server and whisper-server then the whisper-server might fail as it was built with a different shared library. In order to mitigate this problem the whisper-server binary would have to be compiled with statically linked libraries. sd-server doesn't have that problem because it is built with statically linked libs

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This creates some risk where whisper stops working with the llama-swap:cuda and musa containers. Ideally, in the container build step a statically compiled whisper is built and copied in. I attempted that before and found that it was not trivial to do.


WORKDIR /app