Authentication

Organization API keys for REST endpoints and the realtime WebSocket.

Create an API key under API keys in the dashboard. The full key is shown once at creation; ProsodyAI stores only its SHA-256 hash.

export PROSODY_API_KEY="psk_..."

Every key is scoped to one organization. It controls data isolation, speaker identity storage, agent access, usage metering, and billing.

TypeScript SDK

When constructed with no arguments, ProsodyClient reads PROSODY_API_KEY (or PROSODYAI_API_KEY):

import { ProsodyClient } from '@prosodyai/sdk';

const prosody = new ProsodyClient();

You can also pass a key explicitly:

const prosody = new ProsodyClient({
  apiKey: process.env.PROSODY_API_KEY!,
});

REST endpoints

Pass the key in the X-API-Key request header:

X-API-Key: psk_...

Realtime WebSocket

LiveSession and ProsodyRealtimeStream send the key inside the initial JSON config frame after opening WS /v1/stream/realtime:

{
  "type": "config",
  "api_key": "psk_...",
  "encoding": "pcm16",
  "sample_rate": 16000
}

Keep API keys on your server

Never embed an organization API key in browser or mobile client code. For browser voice calls, mint a short-lived participant token on your server with prosody.realtime.createSession() and send only that token to the browser.

Authentication and billing status codes

StatusSDK ErrorMeaning
401AuthenticationErrorMissing, malformed, or revoked API key
402InsufficientCreditsErrorOrganization balance cannot cover the requested audio
403AuthenticationErrorKey is valid, but the organization plan or scope does not allow the operation

On this page