Before you start
- Python 3.11 or newer with pip and an empty project directory.
- A running Velosyll service with its local models, project credits, and an owner-issued project key.
1. Install the client and set credentials
In an empty directory, create a virtual environment. Download the SDK and its dependencies from your Velosyll installation, then install the included wheels offline. These commands use Bash or Zsh. Paste the project key at the read command.
python3 -m venv .venv-client
. .venv-client/bin/activate
export VELOSYLL_URL=http://127.0.0.1:8464
read -rs VELOSYLL_API_KEY
export VELOSYLL_API_KEY
printf '\n'
curl -fSLo "velosyll-python-0.1.0.zip" "$VELOSYLL_URL/sdk/downloads/velosyll-python-0.1.0.zip"
python -m zipfile -e "velosyll-python-0.1.0.zip" velosyll-wheels
python -m pip install --no-index --find-links=velosyll-wheels -r velosyll-wheels/requirements.txt
curl -fSLo reading.wav "$VELOSYLL_URL/assets/studio-session.wav"2. Save the transcription program
The SDK streams the file upload and polls the job once per second for up to ten minutes. It raises VelosyllError on terminal failure and TimeoutError when the polling deadline passes. The SDK's HTTP transport has a separate request timeout. HTTPX retrieves the WebVTT export using the same project key.
import argparse
import os
import sys
from pathlib import Path
from urllib.parse import quote
import httpx
from velosyll import VelosyllClient, VelosyllError
def main():
parser = argparse.ArgumentParser()
inputs = parser.add_mutually_exclusive_group(required=True)
inputs.add_argument("--file", type=Path)
inputs.add_argument("--job")
args = parser.parse_args()
key = os.environ["VELOSYLL_API_KEY"]
api = VelosyllClient(key, os.getenv("VELOSYLL_URL", "http://127.0.0.1:8464"))
job_id = args.job or api.submit(args.file, language="en")["id"]
print("Job ID:", job_id, flush=True)
job = api.wait(job_id, timeout=600, interval=1)
path = "/v1/transcriptions/" + quote(job_id, safe="") + "/export"
captions = httpx.get(
api.base_url + path,
params={"format": "vtt"},
headers={"Authorization": "Bearer " + key},
timeout=30,
)
captions.raise_for_status()
output = Path("velosyll-output")
output.mkdir(exist_ok=True)
(output / "transcript.txt").write_text(job["result"]["text"], encoding="utf-8")
(output / "captions.vtt").write_bytes(captions.content)
print(job["result"]["text"])
if __name__ == "__main__":
try:
main()
except (VelosyllError, httpx.HTTPError, OSError, ValueError, KeyError) as error:
sys.exit(str(error))3. Run it and verify the transcript
The program prints the job ID before waiting and saves transcript.txt and captions.vtt under velosyll-output. The caption file starts with WEBVTT. The resume command polls the same job without uploading the media again.
python transcribe_file.py --file reading.wav
head -n 3 velosyll-output/captions.vttpython transcribe_file.py --job JOB_ID4. Add translation, Scribe and synthesis
Read a 240-character excerpt, translate it to Spanish with the balanced model, extract evidence-linked key points in English, and synthesize a Spanish WAV. The Python SDK provides translate and speak. Use its HTTPX dependency to call the notes endpoint.
import json
import os
import sys
from pathlib import Path
import httpx
from velosyll import VelosyllClient, VelosyllError
def main():
output = Path("velosyll-output")
excerpt = (output / "transcript.txt").read_text(encoding="utf-8").strip()[:240]
if not excerpt:
raise ValueError("The transcript contains no speech.")
key = os.environ["VELOSYLL_API_KEY"]
api = VelosyllClient(key, os.getenv("VELOSYLL_URL", "http://127.0.0.1:8464"))
translated = api.translate(excerpt, "en", "es")
response = httpx.post(
api.base_url + "/v1/notes",
headers={"Authorization": "Bearer " + key},
json={"text": excerpt, "language": "en", "task": "key_points"},
timeout=180,
)
response.raise_for_status()
notes = response.json()
speech = api.speak(translated["text"], "es", format="wav")
(output / "spanish.txt").write_text(translated["text"], encoding="utf-8")
(output / "key-points.json").write_text(
json.dumps(notes, ensure_ascii=False, indent=2), encoding="utf-8"
)
(output / "spanish.wav").write_bytes(speech)
print(translated["text"])
print(notes["result"])
if __name__ == "__main__":
try:
main()
except (VelosyllError, httpx.HTTPError, OSError, ValueError, KeyError) as error:
sys.exit(str(error))5. Inspect the three outputs
Run the second program once. Open spanish.txt for the translation, inspect the evidence offsets in key-points.json and play the resulting spanish.wav. Each execution makes three metered local project requests.
python transcript_tools.py
ls -lh velosyll-outputExpected result
Transcription and caption files plus machine-generated Spanish audio and key points pointing back to the English excerpt.
Troubleshooting
- The upload returned HTTP 401.
- Use the project API key shown in the studio console for this installation. A revoked or expired key needs replacing.
- The polling deadline passed.
- Copy the job ID printed before polling began and use the --job command. Jobs can finish after the client exits.
- The job entered the failed state.
- Read the failure detail printed by the script. A failed job is terminal. After correcting the media or configuration, submit a new job.
- A request returned 402, 422, 429 or 503.
- Check project credits for 402. Check the input and language code for 422. Check the project quota or service capacity for 429. Check the local worker and installed model files for 503.