Python Speech-to-Text API

Transcribe audio with httpx or the OpenAI Python SDK. Privocio is a drop-in Whisper replacement with privacy-first architecture and predictable flat-rate pricing.

  • OpenAI Python SDK compatible — change base_url only
  • Batch transcription with httpx or requests
  • Raw, Clean, and Agent output modes
  • Flat-rate pricing from $19 every 4 weeks

Install

Use the OpenAI SDK for drop-in compatibility, or httpx for direct HTTP calls.

pip install openai
pip install httpx

OpenAI SDK (recommended)

Change base_url to Privocio — no other code changes.

from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://api.privocio.com/v1",
)

with open("recording.wav", "rb") as audio_file:
    transcript = client.audio.transcriptions.create(
        model="whisper-1",
        file=audio_file,
        language="en",
    )
print(transcript.text)

httpx batch transcription

Direct POST to /v1/transcriptions with multipart form data.

import httpx

API_BASE = "https://api.privocio.com"
API_KEY = "YOUR_API_KEY"

with open("recording.wav", "rb") as audio_file:
    files = {"file": ("recording.wav", audio_file, "audio/wav")}
    data = {"model": "whisper-1", "language": "en"}
    response = httpx.post(
        f"{API_BASE}/v1/transcriptions",
        headers={"Authorization": f"Bearer {API_KEY}"},
        files=files,
        data=data,
        timeout=600.0,
    )
    response.raise_for_status()
    print(response.json())

Migrate from OpenAI Whisper

Already using OpenAI? One-line migration — see the full migration guide.

from openai import OpenAI

client = OpenAI(
    api_key="your-privocio-key",
    base_url="https://api.privocio.com/v1",  # ← only change
)

transcript = client.audio.transcriptions.create(
    model="whisper-1",
    file=open("meeting.mp3", "rb"),
)