> ## Documentation Index
> Fetch the complete documentation index at: https://docs.meetjamie.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Create a token, open a stream and read your first speaker segments.

1. Sign in to the [Platform console](https://platform.meetjamie.ai) with your Jamie account. Access is enabled per account; if the console says **No Platform access yet**, contact us.
2. Claim your free credit on the console overview or under [Credits](https://platform.meetjamie.ai/credits). Until you do, new sessions are refused with `402 insufficient_credit`.
3. Create a key under [Keys](https://platform.meetjamie.ai/keys). The token is shown once; store it securely.
4. Open `wss://api.meetjamie.ai/v1/platform/diarize` with the header `Authorization: Bearer <token>`.
5. Wait for the `session` message (allow up to 30 s for the connection to open), then send audio in 100 ms binary frames (3,200 bytes each) at real-time pace.
6. Read `speakers` messages as they arrive. When the audio ends, send `{"type":"finalize"}` and read until `finished`.

> [!TIP]
>
> To hear what the diarizer does before you write code, open the [Playground](https://platform.meetjamie.ai/playground). It streams your microphone or an audio file and shows the speakers live. Playground sessions use your credit and stop after 5 minutes.

## Python

```python theme={null}
# pip install "websockets>=14"
import asyncio, json, websockets

URL = "wss://api.meetjamie.ai/v1/platform/diarize?encoding=pcm_s16le&sample_rate=16000&channels=1"
FRAME = 3200  # 100 ms of 16 kHz mono s16le

async def stream(pcm: bytes, token: str):
    headers = {"Authorization": f"Bearer {token}"}
    async with websockets.connect(URL, additional_headers=headers, open_timeout=30, ping_timeout=60) as ws:
        hello = json.loads(await ws.recv())          # {"type":"session", ...}
        print("session", hello["session_id"])

        async def send_audio():
            for i in range(0, len(pcm), FRAME):
                await ws.send(pcm[i:i + FRAME])
                await asyncio.sleep(0.1)              # real time
            await ws.send(json.dumps({"type": "finalize"}))

        sender = asyncio.create_task(send_audio())
        async for message in ws:
            frame = json.loads(message)
            if frame["type"] in ("speakers", "speakers_snapshot"):
                for s in frame["segments"]:
                    print(s["start_ms"], s["end_ms"], s["speaker"])
            elif frame["type"] == "final":
                print("speakers:", frame["speakers"], "reason:", frame["reason"])
            elif frame["type"] == "finished":
                break
        await sender
```

## Node.js

```js theme={null}
import WebSocket from 'ws'

const url = 'wss://api.meetjamie.ai/v1/platform/diarize?encoding=pcm_s16le&sample_rate=16000&channels=1'
const ws = new WebSocket(url, { headers: { Authorization: 'Bearer ' + process.env.JAMIE_PLATFORM_TOKEN } })

ws.on('message', (data) => {
  const frame = JSON.parse(data.toString())
  if (frame.type === 'session') startSendingAudio(ws)      // send 3,200-byte binary frames every 100 ms
  if (frame.type === 'speakers' || frame.type === 'speakers_snapshot') handleSegments(frame)
  if (frame.type === 'final') console.log('final', frame.speakers, frame.reason)
})
ws.on('error', (err) => console.error(err))                 // HTTP errors such as 401 or 429 arrive here
ws.on('close', (code, reason) => console.log('closed', code, reason.toString()))
// when the audio ends: ws.send(JSON.stringify({ type: 'finalize' }))
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.