Transcribe a Swahili voice note
Copy page
Turn a recorded service enquiry into text. Start with the sample below, then use your own recording.
Coding with an agent?
Copy a prompt into your coding agent to build this example in your project.
View prompt
Read the Msingi API documentation before writing code: - Documentation index: https://platform.msingiai.com/llms.txt - Transcribe a Swahili voice note: https://platform.msingiai.com/docs/voice-note.md - Authentication: https://platform.msingiai.com/docs/auth.md - Errors: https://platform.msingiai.com/docs/errors.md Build a Msingi transcription example in this project. Download the sample WAV from this guide, send it as a multipart file, and display the returned transcript. Make it easy to use my own recording afterwards. Use this project's language and framework. Follow the documented endpoints, formats and limits; do not invent SDKs or routes. Use https://api.msingiai.com as the default API base URL. Read MSINGI_API_KEY from a server environment variable. Keep credentials out of browser code, URLs and logs. Handle non-success responses before treating output as audio or a transcript. Follow the documented streaming protocol when applicable. Prepare the code and explain how to run it. Ask before making a billable API request.
“Habari! Naomba kujua kama huduma ya trekta inapatikana kesho asubuhi.”
Download sample WAV1 · Set up
Use a confirmed account, a funded workspace and an API key with permission for this operation. See Authentication or Pricing if needed.
In a new folder, replace the placeholder with your key. Keep it on your computer or server.
export MSINGI_API_KEY="msk_replace_with_your_key"
export MSINGI_BASE_URL="https://api.msingiai.com"2 · Save the script
Choose a language. Download the script into your new folder, or copy it into the filename shown.
voice-note.sh
#!/usr/bin/env bash
set -eo pipefail
if [ -z "$MSINGI_API_KEY" ]; then
echo "Set MSINGI_API_KEY before running this example." >&2
exit 1
fi
BASE="$MSINGI_BASE_URL"
if [ -z "$BASE" ]; then BASE="https://api.msingiai.com"; fi
audio="voice-note.wav"
if [ "$#" -gt 0 ]; then
audio="$1"
elif [ ! -f "$audio" ]; then
curl --fail --silent --show-error \
"https://platform.msingiai.com/assets/examples/swahili-voice-note.wav" --output "$audio"
fi
curl --fail-with-body --silent --show-error --max-time 120 \
"$BASE/v1/audio/transcriptions" \
-H "Authorization: Bearer $MSINGI_API_KEY" \
-F "file=@$audio"
printf '\n'
3 · Run it
Use Bash and cURL in your terminal. No extra packages are needed.
Run this in the folder containing your downloaded script:
bash voice-note.sh4 · Check the result
habari naomba kujua kama huduma ya trekta inapatikana kesho asubuhi
Python and Node.js print the transcript. cURL returns JSON containing text. Wording and punctuation may vary.
Try your own input
Replace the sample with a recording on your computer. Pass its path when you run the script.
bash voice-note.sh ./my-recording.wavIf a request fails, check Errors: 401 means check your key, 402 means check your available balance, and 403 means check the key’s permissions.
