Pinch Python SDK for real-time speech translation
Project description
Pinch Python SDK
Requirements
- Python 3.10+
- A Pinch API key in
PINCH_API_KEY- Docs:
https://www.startpinch.com/docs - Create/manage API keys (Portal):
https://portal.startpinch.com/dashboard/developers
- Docs:
Authentication (PINCH_API_KEY)
The SDK reads the API key from:
PINCH_API_KEYenvironment variable (recommended)- A local
.envfile in your current working directory (optional)
Example .env file (optional):
PINCH_API_KEY=your_key_here
Install (pip)
python3 -m pip install pinch-sdk
Optional (only needed for WAV resampling support for non-16k/48k inputs):
python3 -m pip install "pinch-sdk[audio]"
Install (uv)
In a uv-managed project:
uv add pinch-sdk
Usage
Create a small script (for example translate.py) in your own project:
import asyncio
from pinch import PinchClient
async def main() -> None:
client = PinchClient() # reads PINCH_API_KEY
await client.translate_file(
input_wav_path="input.wav",
output_wav_path="output.wav",
transcript_path="transcript.txt",
# defaults:
# source_language="en-US"
# target_language="es-ES"
# audio_output_enabled=True
)
if __name__ == "__main__":
asyncio.run(main())
Run (pip environment):
export PINCH_API_KEY="..."
python3 translate.py
Run (uv environment):
export PINCH_API_KEY="..."
uv run python translate.py
Outputs:
output.wav(ifaudio_output_enabled=True)transcript.txt
Input audio notes
- Input must be 16-bit PCM WAV
- Streaming API supports sample rates: 16000 Hz (recommended) and 48000 Hz
- WAV helpers support 16000 Hz and 48000 Hz out of the box
- Other sample rates require resampling deps:
python3 -m pip install "pinch-sdk[audio]"
Repo example (for this git checkout)
This repository includes an example script and a default input WAV.
Run with pip:
python3 -m pip install -e .
export PINCH_API_KEY="..."
python3 examples/translate.py
Run with uv:
uv sync
export PINCH_API_KEY="..."
uv run python examples/translate.py
Outputs (generated):
examples/output.wavexamples/transcript.txt
Notes:
- The example reads
examples/input.wavby default. - The example does not print transcripts to stdout; it only writes
examples/transcript.txt.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pinch_sdk-0.1.1.tar.gz.
File metadata
- Download URL: pinch_sdk-0.1.1.tar.gz
- Upload date:
- Size: 206.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
374d4d82477f3a552ebbaabda2a417d9cc250eadb14a591d443319c2cd5c4593
|
|
| MD5 |
94688f27331bfbf0170ed2352c0719b7
|
|
| BLAKE2b-256 |
07e6e441cb7f03a51cdacb4ebb4fb0c48b27eda6b92e8250daba0eae81b7af66
|
Provenance
The following attestation bundles were made for pinch_sdk-0.1.1.tar.gz:
Publisher:
publish.yml on pinch-eng/pinch-python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pinch_sdk-0.1.1.tar.gz -
Subject digest:
374d4d82477f3a552ebbaabda2a417d9cc250eadb14a591d443319c2cd5c4593 - Sigstore transparency entry: 837760021
- Sigstore integration time:
-
Permalink:
pinch-eng/pinch-python-sdk@c17cf1cfcd271940806cf3c4ecad0c609d2414ef -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/pinch-eng
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c17cf1cfcd271940806cf3c4ecad0c609d2414ef -
Trigger Event:
release
-
Statement type:
File details
Details for the file pinch_sdk-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pinch_sdk-0.1.1-py3-none-any.whl
- Upload date:
- Size: 17.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2d1ac2ef87f02dbc9fc08dd61bef6e04b4c5ddc11cd0c4839766355654b8ed9
|
|
| MD5 |
653328461239304d4558e28020ce1920
|
|
| BLAKE2b-256 |
4af8674609946ab69a83666f56d265bef19662ffa7f6641d037d27fcbb2cd30d
|
Provenance
The following attestation bundles were made for pinch_sdk-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on pinch-eng/pinch-python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pinch_sdk-0.1.1-py3-none-any.whl -
Subject digest:
e2d1ac2ef87f02dbc9fc08dd61bef6e04b4c5ddc11cd0c4839766355654b8ed9 - Sigstore transparency entry: 837760057
- Sigstore integration time:
-
Permalink:
pinch-eng/pinch-python-sdk@c17cf1cfcd271940806cf3c4ecad0c609d2414ef -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/pinch-eng
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c17cf1cfcd271940806cf3c4ecad0c609d2414ef -
Trigger Event:
release
-
Statement type: