Skip to main content

Tapra Python SDK

Official Python client for the Tapra API: Tunisian Arabic / French / English code-switching transcription, speech, and Arabizi ↔ Arabic conversion.

pip install "tapra[realtime]"   # drop [realtime] if you only use the REST endpoints
from tapra import Tapra

client = Tapra()  # https://api.tapra.tn; api_key defaults to TAPRA_API_KEY

with open("meeting.m4a", "rb") as audio:
    transcript = client.transcriptions.create(file=audio, timestamps="word")
print(transcript.text)

client.script.convert(text="3lech 7abit l9anoun?", direction="ZI2AR")

Pass base_url= to target another host, such as a local model host.

Async: AsyncTapra has the same methods. Errors raise typed exceptions (PaymentRequiredError for HTTP 402, UnauthorizedError, …) whose .body.error holds type and message. Pass idempotency_key= to retry metered requests safely, and use client.<resource>.with_raw_response.<method>() to read x-tapra-cost-tnd.

Realtime transcription

from tapra import connect_realtime

async with connect_realtime(language="ar-AR") as session:  # wss://api.tapra.tn
    for chunk in pcm_chunks:            # mono pcm_s16le, 16 kHz
        await session.send_audio(chunk)
    final = await session.stop()
print(final.text, final.usage)

Prices

Tapra charges and invoices in TND only. The SDK does not hardcode any price: it reads the same live price list the website and the meter use.

from tapra.pricing import fetch_tapra_prices, estimate_cost_tnd

prices = fetch_tapra_prices()  # GET https://www.tapra.tn/api/pricing, no key needed

estimate_cost_tnd(prices, "tts", 1200)  # TND for 1,200 characters of speech, at today's price

estimate_cost_micro_tnd returns the exact integer amount the meter charges, including the per-request minimum for text products.

Development

src/tapra/ is generated by Fern from openapi/tapra-api.json; do not edit it by hand. src/tapra/realtime.py and src/tapra/pricing.py are hand-written (kept by .fernignore). Tests: sdks/tests/python.

Command line

Installing the SDK also installs the tapra command (pip install "tapra[realtime]" adds tapra stream). Same commands as the npm package's:

tapra auth login                               # checks the key, then saves it
tapra transcribe call.mp3                      # Derja + French + English, speakers labelled
tapra transcribe video.mp4 --format srt -o subs.srt   # any audio/video; long files are split (needs ffmpeg)
tapra stream --partials                        # live from the microphone (ffmpeg), Ctrl+C to stop
tapra speak "حبيت نتلقاو demain" --voice zeineb -o hello.wav
tapra flip "3lech 7abit l9anoun?"               # -> علاش حبيت القانون؟
tapra balance                                  # also: models, voices, pricing, health

In a terminal, paid commands show the estimated cost and your balance and ask first (-y skips, --max-cost 0.5 sets a limit). They print the exact cost and balance on stderr when done; --json prints the full response and --dry-run shows the request without sending it. Exit codes: 0 ok, 1 error, 2 bad usage, 3 missing or invalid key, 4 balance too low. Full reference: https://www.tapra.tn/cli

Metadata

Release files for tapra 0.1.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tapra 0.1.10
File Size Uploaded Provenance Actions
tapra-0.1.10.tar.gz 96.2 kB With provenance Details for tapra-0.1.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tapra 0.1.10
File Interpreter ABI Platform Actions
tapra-0.1.10-py3-none-any.whl Python 3 none any Details for tapra-0.1.10-py3-none-any.whl

Total release size: 239.5 kB

Release files / tapra-0.1.10.tar.gz

Download URL tapra-0.1.10.tar.gz
Size 96.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4407d6c345088c4efdd80614ad20988b53cfc2a20b97206a58b272e412279084
BLAKE2b-256 checksum
How to use checksums
d53ec607ae250a739ce268f2d90a766150a62ccddecfc3b6cbaea2f778185dc8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Release files / tapra-0.1.10-py3-none-any.whl

Download URL tapra-0.1.10-py3-none-any.whl
Size 143.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
97b69b5ab653ac4a8dec56e1a7f9faaf43ff007530e4239672a6d1b4d829f9d4
BLAKE2b-256 checksum
How to use checksums
c07a1dc4c6679989e04b1ce9749d43dcdb4f76d697eda6e832b0341a69903b3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Security for tapra 0.1.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for tapra-0.1.10.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page