The gateway turns recordings into text. It answers POST /v1/audio/transcriptions, in the
same shape as OpenAI’s transcription endpoint, with a Whisper model that runs inside your
installation. This article gives you a small Python client for that endpoint, ready to
download, and walks through it. Every command below was run from a clean copy of the
download against a live installation on 29 October 2026, and the output quoted is the
output it gave.
Whisper only transcribes; it cannot speak. The client’s tts command makes speech on your
own computer, with the voices your operating system already has. That part never contacts
the gateway, and the text you give it stays on your machine. The gateway can also speak,
with a speech model of its own that reads Turkish with Turkish pronunciation: that is a
separate client, in text to speech from Python.
Before you start: you need access to a Bosphorus installation and a platform key (an API key) on it. If you would like to try it, contact Morten or write to iletisim@morten.com.tr.
Download
Download bosphorus-speech-1.0.1.zip (5 KB)
The archive holds three files: speech.py, the client; requirements.txt, its two
libraries (requests, and pyttsx3 for the local voices); and README.md, a short guide. The
client is for an installation your organisation already runs. It carries no address and no
key of its own: you give it both.
Who does what
| Step | Who | Where |
|---|---|---|
| Serve a Whisper model through the gateway | Administrator | Console, /providers → On-prem |
| Allow that model for the people who will use it | Administrator | Console, /keys → Model profiles |
| Give each developer a platform key | Administrator, or each person | /keys; or My variables (/vault), see your own key |
| Download the client, point it at the gateway, transcribe | Each developer | A terminal |
How a recording becomes text
- The client sends the file as a multipart form, with your platform key as the Bearer.
- The gateway checks the key, your model profile, the key’s requests-per-minute limit and your team’s concurrency limit, as described in how a request is checked.
- A Whisper server inside the installation transcribes the audio.
- The audit trail records the request: who sent it, the file’s name, type and size and, when your installation keeps request bodies, the transcript. The audio itself is not stored by the gateway.
Two things a chat request goes through do not apply here. No token budget is charged, because audio spends no tokens, and there is no limit on tokens per minute. The audio is not scanned by the policy engine either. If you send the transcript on to a model as a chat message, that request is checked like any other.
Part A: the administrator
A1. Serve and allow the model
On the On-prem tab of /providers, a Whisper server added with Add & check and
Type detect is filed as transcription. A model of that type answers only
/v1/audio/transcriptions.
A model profile with an empty list allows every model, so callers on the seeded default profile can use it at once. A profile that lists models allows only those. Under such a profile the client gets:
HTTP 403: model "whisper-large-v3" is not allowed by model profile "Qwen+DeepSeek". available: (none)
To allow it, open Model profiles on /keys, add the model’s id (here
OP/whisper-large-v3) to the profile’s Allowed models and press Save. Prefer the
exact id to OP/*, which would also allow every on-premises chat model. The change
applies within a minute.
A2. Tell developers the model’s id
A transcription model is not listed by /v1/models, because it answers no chat and a
chat client must not offer it. So give developers its id. The client uses
OP/whisper-large-v3 unless BOSPHORUS_STT_MODEL names another. A wrong id is refused,
and the message ends with the ids the caller may use.
Part B: the developer
B1. Install
unzip bosphorus-speech-1.0.1.zip
cd bosphorus-speech
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
On Windows, the activation line is .venv\Scripts\activate. The client was tested with
Python 3.11 on macOS.
B2. Point it at your gateway
export BOSPHORUS_URL=https://ai.corp.example
export BOSPHORUS_KEY=gpk_...
Replace the address with your gateway’s and gpk_... with your own platform key. If your
installation names its Whisper model differently, set BOSPHORUS_STT_MODEL as well.
B3. Check it end to end
The first line makes a short recording with your computer’s voice; the second sends it to the gateway:
python speech.py tts "Hello, this is a test of the speech to text pipeline." -o hello.aiff
python speech.py stt hello.aiff
wrote hello.aiff
Hello, this is a test of the speech-to-text pipeline.
tts was tested only on macOS, where the file is always AIFF whatever its extension. On
Windows pyttsx3 uses the Windows speech engine; on Linux it needs the espeak-ng package.
Any recording you already have works for the check too.
B4. Make a Turkish recording
python speech.py voices lists the voices, with each one’s language in the last column.
Choose one whose language is tr; without one, Turkish is read with English pronunciation.
(For speech made by the platform itself, with Turkish pronunciation and no voice to
install, see text to speech from Python.)
On macOS that is Yelda:
python speech.py tts "Merhaba, bu konuşmadan metne dönüşüm için bir denemedir." -o merhaba.aiff --voice com.apple.voice.compact.tr-TR.Yelda
B5. Transcribe a recording
Give the language when you know it, and pick the output you need. Subtitles for the recording from B4:
python speech.py stt merhaba.aiff --language tr --format srt
1
00:00:00,000 --> 00:00:03,440
Merhaba, bu konuşmadan metne dönüşüm için bir denemedir.
| Option | What it does |
|---|---|
--language |
The spoken language as a two-letter code, such as tr or en. Without it Whisper guesses, which can go wrong on a short clip. |
--format |
json, the default, prints just the text. text is the same text sent as plain text. verbose_json adds the detected language, the duration and timed segments. srt and vtt are subtitles. |
--prompt |
Text that helps with spelling: names, product terms, or the last sentence of the previous recording. |
-o |
Write the result to a file instead of printing it. |
The audio formats tested and working are wav, mp3, m4a, flac, ogg, webm, aiff and caf.
B6. From your own code
transcribe() returns the transcript, and raises SpeechError, with the HTTP status in
status, when the gateway refuses:
from speech import transcribe, SpeechError
print(transcribe("merhaba.aiff", language="tr"))
try:
transcribe("hello.aiff", api_key="wrong")
except SpeechError as e:
print(e.status, e)
Merhaba, bu konuşmadan metne dönüşüm için bir denemedir.
401 HTTP 401: invalid api key
It reads BOSPHORUS_URL, BOSPHORUS_KEY and BOSPHORUS_STT_MODEL unless you pass
base_url=, api_key= or model=.
B7. Without Python
The endpoint takes the same form from any HTTP client:
curl -sS "$BOSPHORUS_URL/v1/audio/transcriptions" -H "Authorization: Bearer $BOSPHORUS_KEY" -F model=OP/whisper-large-v3 -F language=tr -F file=@merhaba.aiff
{"text":" Merhaba, bu konuşmadan metne dönüşüm için bir denemedir.","usage":{"type":"duration","seconds":4}}
Whisper starts every transcript with a space, which the client removes. usage gives the
length of the audio in seconds.
Limits
-
25 MiB per request, counting the whole upload. The client refuses a larger file before sending it; the gateway answers
HTTP 413: request body too large. Split a long recording with ffmpeg and transcribe the parts in order:ffmpeg -i long.m4a -f segment -segment_time 600 -c copy part%03d.m4aA cut inside a word can change that word: in testing, metne came back as metin when a cut fell inside it. Ten-minute parts keep the cuts few, and the last sentence of one part can go to the next as
--prompt. -
No streaming. The transcript comes back in one response;
stream=trueis refused withstream is not supported on /v1/audio/transcriptions. -
Requests per minute. Over your key’s limit the gateway answers 429. Wait the number of seconds in the
retry-afterheader, then send again.
When something goes wrong
| You see | What to do |
|---|---|
set BOSPHORUS_URL to your gateway's address |
Set BOSPHORUS_URL, as in B2. |
HTTP 401: invalid api key |
Check BOSPHORUS_KEY; the key may have been replaced or revoked. |
HTTP 403: model "…" is not allowed by model profile "…" |
Ask your administrator to allow the model (A1). The message ends with what your profile does allow. |
HTTP 503: no transcription model "…" is registered |
The model id is wrong. Set one of the ids the message ends with as BOSPHORUS_STT_MODEL. |
HTTP 400: Invalid or unsupported audio file. |
The file is not audio Whisper can read. |
HTTP 413: request body too large |
Split the recording (see Limits). |
HTTP 429 |
Wait for retry-after, then retry. |