Tapra Python SDK
Official Python client for the Tapra API: Tunisian Arabic / French / English code-switching transcription, speech, translation, 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")
for event in client.translations.create_stream(input="عندي برشا خدمة", target="French"):
print(event.type, event.delta)
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 in TND. The SDK does not hardcode any price or dollar amount: it reads the same live price list the website and the meter use.
from tapra.pricing import fetch_tapra_prices, estimate_cost_tnd, estimate_cost_usd
prices = fetch_tapra_prices() # GET https://www.tapra.tn/api/pricing, no key needed
estimate_cost_tnd(prices, "tts", 1200) # 0.24 TND — 1,200 characters
estimate_cost_usd(prices, "tts", 1200) # ≈ $0.08, at the rate the list was fetched with
estimate_cost_micro_tnd returns the exact integer amount the meter charges, including the
per-request minimum for text products. The endpoint also returns tndPerUsd and the date of
the published rate, so a UI can show which rate it used.
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.
Metadata
Release files for tapra 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tapra-0.1.2.tar.gz | 54.7 kB | With provenance | Details for tapra-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tapra-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for tapra-0.1.2-py3-none-any.whl |
Total release size: 149.3 kB
Release files / tapra-0.1.2.tar.gz
| Download URL | tapra-0.1.2.tar.gz |
|---|---|
| Size | 54.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
78828af8d146514b2b3b0317808026633cd1f3ee89eafef69154c75b8d0311fc
|
|
BLAKE2b-256 checksum How to use checksums |
8d2254ea20d5cac705bb3444de0d7a262484282981dc88e3d2a21d57079fc664
|
| 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 Oct 28, 2026.
Transparency logRelease files / tapra-0.1.2-py3-none-any.whl
| Download URL | tapra-0.1.2-py3-none-any.whl |
|---|---|
| Size | 94.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
abd30e31beaf8d9b8cd71bc9c855c7b1397aa514a82cfbf5e9f434452d29a00b
|
|
BLAKE2b-256 checksum How to use checksums |
c5468b1298e13d68cfd1316bbd0b66813de190f920af1430cf4a71a529035dc2
|
| 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 Oct 28, 2026.
Transparency logSecurity for tapra 0.1.2
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.
Attestation for tapra-0.1.2.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 Oct 28, 2026.
Transparency logA 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.