New Tool Radar

Local AI

How to Serve a Whisper.cpp Model Over HTTP with whisper-server

Build whisper.cpp, start its whisper-server on localhost port 8080, and send a WAV file to its /inference endpoint with curl to get the transcript back over HTTP.

Schematic diagram with three steps: build whisper.cpp and download the base.en model, start whisper-server on 127.0.0.1 port 8080, then send samples/jfk.wav to /inference with curl and read the JSON transcript.

whisper-cli transcribes one file in a terminal, which is enough when you are the one typing the command. When another program needs the transcript — a script, a note-taking app, a small web page — the command line is the wrong shape, because the other program would have to shell out to it. whisper.cpp ships a small HTTP server example for exactly that case: WAV files are passed to the inference model via HTTP requests, and the server answers with the transcript. This guide starts that server on your own computer and calls it with curl. It does not cover terminal transcription; that is the command-line guide’s job.

Build whisper.cpp and download a model

These are the main README’s own quick-start commands. The download script fetches the base.en model converted to ggml format, and the build produces the tools under build/bin/, including the server binary at build/bin/whisper-server, the path the server README’s own usage shows:

git clone https://github.com/ggml-org/whisper.cpp.git
cd whisper.cpp
sh ./models/download-ggml-model.sh base.en
cmake -B build
cmake --build build -j --config Release

The README’s memory table puts base at 142 MiB on disk and about 388 MB of memory, so it fits comfortably on an ordinary computer. Start with base.en unless you have a reason to go bigger or smaller.

Start the server

Start the server with the model you downloaded. The server README’s defaults are host 127.0.0.1, port 8080, model models/ggml-base.en.bin, and language en, so this command is enough for a first run:

./build/bin/whisper-server -m models/ggml-base.en.bin

Leave that terminal open: the server keeps running until you stop it. The default host 127.0.0.1 means only programs on your own computer can reach it, which is the safe default — do not change it to a public address. The default language is English; pass --language auto if the recording’s language should be detected instead. To use a different port, add --port, for example --port 8081.

Send a WAV file and read the transcript

With the server running, send an audio file to the /inference path. The server README’s own request example uses multipart form data, with the file, a temperature of 0.0, a temperature increment of 0.2, and the response format json. Use the repository’s own sample recording, samples/jfk.wav, which the main README also uses for its quick start:

curl 127.0.0.1:8080/inference \
  -H "Content-Type: multipart/form-data" \
  -F file="@samples/jfk.wav" \
  -F temperature="0.0" \
  -F temperature_inc="0.2" \
  -F response_format="json"

The response is JSON carrying the transcript text. Send a 16-bit WAV file: the main README says the command-line tool runs only with 16-bit WAV files, so convert anything else first with ffmpeg, using the README’s own example:

ffmpeg -i input.mp3 -ar 16000 -ac 1 -c:a pcm_s16le output.wav

Alternatively, start the server with --convert, which converts audio to WAV on the server — but that needs ffmpeg installed on the server, so converting the file yourself first is the simpler route.

Swap the model without restarting

If you want a different model, you do not have to stop the server. The server README gives a /load endpoint that takes a model file path:

curl 127.0.0.1:8080/load \
  -H "Content-Type: multipart/form-data" \
  -F model="models/ggml-small.en.bin"

Download that model first with the same script, sh ./models/download-ggml-model.sh small.en, then send the /load request with the path to its file. Later /inference requests use the newly loaded model.

Try it: four checks for the server

Check What you should see If you do not see it
Server starts The whisper-server command keeps running without an error, listening on 127.0.0.1 port 8080 The model file is missing — run the download script first; the default model is models/ggml-base.en.bin
Send the file curl to 127.0.0.1:8080/inference returns a response instead of “connection refused” The server is not running, or the request went to a different port
JSON transcript With response_format json, the reply is JSON carrying the transcript text of samples/jfk.wav The file was not a 16-bit WAV file — convert it with ffmpeg first, or restart the server with --convert
Swap model A curl to 127.0.0.1:8080/load with a model file path changes the model the server uses The path in -F model= does not point at a model file the server can read

Expected result. We checked whisper.cpp’s own server README for the whisper-server command, its defaults (host 127.0.0.1, port 8080, model models/ggml-base.en.bin, language en, inference path /inference), the /inference curl example with temperature 0.0, temperature_inc 0.2 and response_format json, the /load endpoint, the –convert option needing ffmpeg, and the warning against running it with administrative privileges, and the main README for the clone, download, and CMake build commands, the samples/jfk.wav file, the 16-bit WAV requirement with the ffmpeg conversion, and the base model at 142 MiB on disk and about 388 MB of memory. We did not run whisper.cpp or its server.

Limits

This is an example server, not a production service: the server README itself warns not to run it with administrative privileges and to operate it in a sandbox environment, because it accepts user file uploads and uses ffmpeg for format conversions. Keep it on 127.0.0.1 so only your own computer can reach it. It transcribes audio files sent over HTTP; it is not a live microphone service, and the model stays loaded in memory between requests, so a bigger model needs more memory — the README’s table puts large at 2.9 GiB on disk and about 3.9 GB of memory. The samples/jfk.wav file is the repository’s own sample. We did not run whisper.cpp or its server, so no transcript here is a recorded result.

Sources

See all