orgasm.dev

Quickstart

A sandbox live session in five minutes, followed by its events, with curl and with TypeScript.

The sandbox answers the whole contract with deterministic scenarios, so you can integrate before live analysis exists. Nothing here needs a camera.

Pick a key and a base URL

In the sandbox any key that starts with sk_test_ works. Keys namespace your sessions, so pick one of your own.

export ORGASM_KEY=sk_test_quickstart_$(whoami)
export ORGASM_API=https://orgasm.dev

Working from this repository? npm run dev serves the same sandbox at http://localhost:3000, and npm run mock at http://localhost:4010, with the WebSocket channel as well.

Create a live session

Every request that starts an analysis attests consent. In the sandbox, sandbox.scenario picks what plays and sandbox.speed how much faster than real time.

curl -s "$ORGASM_API/v1/live-sessions" \
  -H "Authorization: Bearer $ORGASM_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "consent": { "subjectIsAdult": true, "subjectConsented": true, "ageVerification": "document" },
    "sandbox": { "scenario": "woman-onset-end", "speed": 20 }
  }'

The answer is the session, with status: "starting", an ingest block (where a real device would publish) and a results block (where events arrive). Keep its id.

Follow its events

As a stream of server-sent events:

curl -N "$ORGASM_API/v1/live-sessions/ls_…/stream" -H "Authorization: Bearer $ORGASM_KEY"

Or by long polling, which suits agents and simple servers: wait holds the request until an event matches.

curl -s "$ORGASM_API/v1/live-sessions/ls_…/events?types=orgasm.onset,orgasm.end&wait=30" \
  -H "Authorization: Bearer $ORGASM_KEY"

At speed 20, the subject read arrives after about three seconds, imminence after four, and the onset about half a minute in:

{
  "id": "evt_2099smltv0t2c2wzzyzq",
  "object": "event",
  "type": "orgasm.onset",
  "mode": "test",
  "sessionId": "ls_8f3kq2m7x9w4c1n6t5ra",
  "sequence": 969,
  "streamTimeS": 542.6,
  "confidence": "high",
  "data": {
    "orgasmIndex": 1,
    "eventAtS": 538,
    "calledAtS": 542.6,
    "lagS": 4.6,
    "detector": "onset_end",
    "score": 0.71,
    "threshold": 0.5
  },
  "wallTime": "2026-10-16T14:00:55.260Z"
}

End it

curl -s -X DELETE "$ORGASM_API/v1/live-sessions/ls_…" -H "Authorization: Bearer $ORGASM_KEY"

The same in TypeScript

Node 18 or later, no dependencies. It creates a session, reads the stream and reacts to each call.

quickstart.ts
const API = process.env.ORGASM_API ?? 'https://orgasm.dev';
const KEY = process.env.ORGASM_KEY!; // sk_test_… reaches the sandbox

const auth = { Authorization: `Bearer ${KEY}` };

const created = await fetch(`${API}/v1/live-sessions`, {
  method: 'POST',
  headers: { ...auth, 'Content-Type': 'application/json', 'Idempotency-Key': crypto.randomUUID() },
  body: JSON.stringify({
    consent: { subjectIsAdult: true, subjectConsented: true, ageVerification: 'document' },
    sandbox: { scenario: 'man-peak', speed: 30 },
  }),
});
const session = await created.json();

const stream = await fetch(session.results.streamUrl, { headers: auth });
const decoder = new TextDecoder();
let buffer = '';
for await (const chunk of stream.body!) {
  buffer += decoder.decode(chunk, { stream: true });
  let end: number;
  while ((end = buffer.indexOf('\n\n')) !== -1) {
    const frame = buffer.slice(0, end);
    buffer = buffer.slice(end + 2);
    const data = frame.split('\n').find((line) => line.startsWith('data: '));
    if (!data) continue; // a keep-alive comment
    const event = JSON.parse(data.slice(6));
    if (event.type === 'imminence.updated' && event.data.p30 !== null) {
      console.log(`${event.streamTimeS}s  p30 ${event.data.p30}  p60 ${event.data.p60}`);
    }
    if (event.type.startsWith('orgasm.')) {
      console.log(`${event.type} at ${event.data.eventAtS}s, called ${event.data.lagS}s later`);
    }
  }
}

A recording instead

Recordings are a separate endpoint. Ask for an upload URL, PUT the file, then read the result once status is completed. In the sandbox the bytes are read and discarded; use any small video, never a real recording of a person.

curl -s "$ORGASM_API/v1/recordings" \
  -H "Authorization: Bearer $ORGASM_KEY" -H "Content-Type: application/json" \
  -d '{
    "consent": { "subjectIsAdult": true, "subjectConsented": true, "ageVerification": "document" },
    "source": { "type": "upload" },
    "sandbox": { "scenario": "man-peak", "speed": 60 }
  }'
# then: curl -X PUT --data-binary @test.mp4 -H "Content-Type: video/mp4" "<uploads.face.url>"
# and:  curl "$ORGASM_API/v1/recordings/rec_…" -H "Authorization: Bearer $ORGASM_KEY"

Next

  • Signals: what imminence, onset, peak and end mean, and what they don't.
  • Live sessions: the capability, the device and the enclave, end to end.
  • Presets: edge, ruin and finish as code you can start from.

On this page