Skip to main content

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

Authentication (PINCH_API_KEY)

The SDK reads the API key from:

  1. PINCH_API_KEY environment variable (recommended)
  2. A local .env file 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 (if audio_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.wav
  • examples/transcript.txt

Notes:

  • The example reads examples/input.wav by default.
  • The example does not print transcripts to stdout; it only writes examples/transcript.txt.

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

pinch_sdk-0.1.1.tar.gz (206.5 kB view details)

Uploaded Source

Built Distribution

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

pinch_sdk-0.1.1-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

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

Hashes for pinch_sdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 374d4d82477f3a552ebbaabda2a417d9cc250eadb14a591d443319c2cd5c4593
MD5 94688f27331bfbf0170ed2352c0719b7
BLAKE2b-256 07e6e441cb7f03a51cdacb4ebb4fb0c48b27eda6b92e8250daba0eae81b7af66

See more details on using hashes here.

Provenance

The following attestation bundles were made for pinch_sdk-0.1.1.tar.gz:

Publisher: publish.yml on pinch-eng/pinch-python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for pinch_sdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e2d1ac2ef87f02dbc9fc08dd61bef6e04b4c5ddc11cd0c4839766355654b8ed9
MD5 653328461239304d4558e28020ce1920
BLAKE2b-256 4af8674609946ab69a83666f56d265bef19662ffa7f6641d037d27fcbb2cd30d

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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