Skip to main content

Minimal Python client for the tomfun speech-to-text web API (token auth, language hint).

Project description

tomfun-speech-to-text-client

Minimal async Python client for the tomfun speech-to-text web API.

  • Token authentication (Authorization: Bearer <token>)
  • Language hint passed to Whisper
  • Upload local files (chunked) or submit a remote URL
  • Streams status via Server-Sent Events

Single runtime dependency: aiohttp.

Install

pip install tomfun-speech-to-text-client

Usage

import asyncio
from tomfun_speech_to_text_client import Client

async def main():
    async with Client("https://speech-to-text.tomfun.co", token="YOUR_TOKEN") as c:
        r = await c.transcribe_file("audio.mp3", language="en")
        print(r.text)

        r = await c.transcribe_url("https://example.com/clip.wav", language="uk")
        print(r.srt)

asyncio.run(main())

With progress callback:

async def on_status(ev):
    print(ev["status"], ev.get("progressLast"))

await c.transcribe_file("audio.mp3", language="en", on_status=on_status)

Cancel a job:

await c.cancel(job_id)

Development (uv)

cd python_client
uv sync --group dev
uv run pytest

Publishing to PyPI

  1. Create a PyPI API token at https://pypi.org/manage/account/token/.
  2. Bump version in pyproject.toml.
  3. Build:
    uv build
    
  4. Upload:
    uv publish --token "$PYPI_TOKEN"
    
    Or via twine:
    uv tool run --with twine twine upload dist/*
    

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tomfun_speech_to_text_client-0.0.1.tar.gz (93.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tomfun_speech_to_text_client-0.0.1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file tomfun_speech_to_text_client-0.0.1.tar.gz.

File metadata

  • Download URL: tomfun_speech_to_text_client-0.0.1.tar.gz
  • Upload date:
  • Size: 93.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"21.3","id":"virginia","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for tomfun_speech_to_text_client-0.0.1.tar.gz
Algorithm Hash digest
SHA256 2b5bf2954948d79b57f09e95e08d7a3bc9b1461a1afe68a2d7b44eb3713701f3
MD5 f9193d187a4b32100885664e031b36dc
BLAKE2b-256 96b200fed08aedf51557cfeabe8e9695dac2175149ea9ab9acf86c5863011272

See more details on using hashes here.

File details

Details for the file tomfun_speech_to_text_client-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: tomfun_speech_to_text_client-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"21.3","id":"virginia","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for tomfun_speech_to_text_client-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f2d3bcb6a42348afe505ceb670ea914c4e4f4aab508500bc59f918fbf909fc84
MD5 095bd1922085f2a54d5fda6df5add036
BLAKE2b-256 327fdbf8bde4f08a4de48883a2a03df9eac6cb95ba451789544970810b07849c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page