# Sandbox (https://orgasm.dev/docs/guides/sandbox)

Any key that starts with `sk_test_` reaches the sandbox. It answers the whole contract, and its sessions and recordings play **scenarios**: scripted, deterministic event timelines, the same ones that generate the examples throughout these docs. The same scenario always produces the same events.

## Choosing a scenario [#choosing-a-scenario]

```json
{ "sandbox": { "scenario": "man-peak", "speed": 20 } }
```

`scenario` defaults to `woman-onset-end`. `speed` plays it faster than real time, from 1 to 60: 10 by default for live sessions, 60 for recordings. Stream times in events stay on the scenario's own clock, so a call at `streamTimeS: 704.2` arrives about 35 seconds in at speed 20.

`subjectHint` and `inputs` apply as they would live: a `man` hint on a woman's scenario suppresses its onset and end calls, and `inputs.audio: false` leaves only imminence and the subject read.

## The scenarios [#the-scenarios]

### woman-onset-end [#woman-onset-end]

**A woman's orgasm: onset, then end** (sandbox scenario `woman-onset-end`). The face reads as a woman’s after about 30 seconds, imminence climbs over nine minutes, and the onset and end of one orgasm are called a few seconds after each happens.

Imminence each minute:

| streamTimeS | p30 | p60 |
| --- | --- | --- |
| 62 | 0.019 | 0.037 |
| 122 | 0.025 | 0.049 |
| 182 | 0.029 | 0.058 |
| 242 | 0.048 | 0.094 |
| 302 | 0.052 | 0.102 |
| 362 | 0.117 | 0.22 |
| 422 | 0.14 | 0.261 |
| 482 | 0.322 | 0.541 |
| 542 | 0.868 | 0.983 |
| 602 | 0.087 | 0.167 |

Orgasm calls:

| type | data |
| --- | --- |
| `orgasm.onset` | orgasm 1 at 538 s, lag 4.6 s, score 0.71 |
| `orgasm.end` | orgasm 1 at 575 s, lasted 37 s, onset_end, lag 5.2 s |

| sequence | streamTimeS | type | confidence | data |
| --- | --- | --- | --- | --- |
| 1 | 0 | `session.status` | — | ready |
| 2 | 0 | `session.status` | — | calibrating |
| 3 | 0 | `input.warning` | — | baseline_pending raised |
| 4 | 32 | `subject.identified` | high | woman, pWoman 0.94, detectors onset_end |
| 5 | 62 | `session.status` | — | analyzing |
| 6 | 62 | `input.warning` | — | baseline_pending cleared |
| 969 | 542.6 | `orgasm.onset` | high | orgasm 1 at 538 s, lag 4.6 s, score 0.71 |
| 1046 | 580.2 | `orgasm.end` | high | orgasm 1 at 575 s, lasted 37 s, onset_end, lag 5.2 s |
| 1205 | 660 | `session.status` | — | ended, media_ended |

### man-peak [#man-peak]

**A man's orgasm: peak, then end** (sandbox scenario `man-peak`). The face reads as a man’s, imminence climbs to a peak, which is called about three seconds after it happens; the end is then read from his face.

Imminence each minute:

| streamTimeS | p30 | p60 |
| --- | --- | --- |
| 62 | 0.01 | 0.02 |
| 122 | 0.017 | 0.033 |
| 182 | 0.025 | 0.05 |
| 242 | 0.043 | 0.084 |
| 302 | 0.074 | 0.142 |
| 362 | 0.086 | 0.165 |
| 422 | 0.125 | 0.234 |
| 482 | 0.206 | 0.369 |
| 542 | 0.285 | 0.488 |
| 602 | 0.467 | 0.716 |
| 662 | 0.667 | 0.889 |
| 722 | 0.318 | 0.535 |

Orgasm calls:

| type | data |
| --- | --- |
| `orgasm.peak` | orgasm 1 at 701 s, lag 3.2 s, score 0.66 |
| `orgasm.end` | orgasm 1 at 742 s, lasted 41 s, face_end, lag 3.5 s |

| sequence | streamTimeS | type | confidence | data |
| --- | --- | --- | --- | --- |
| 1 | 0 | `session.status` | — | ready |
| 2 | 0 | `session.status` | — | calibrating |
| 3 | 0 | `input.warning` | — | baseline_pending raised |
| 4 | 31 | `subject.identified` | high | man, pWoman 0.07, detectors peak, face_end |
| 5 | 62 | `session.status` | — | analyzing |
| 6 | 62 | `input.warning` | — | baseline_pending cleared |
| 1293 | 704.2 | `orgasm.peak` | high | orgasm 1 at 701 s, lag 3.2 s, score 0.66 |
| 1376 | 745.5 | `orgasm.end` | high | orgasm 1 at 742 s, lasted 41 s, face_end, lag 3.5 s |
| 1445 | 780 | `session.status` | — | ended, media_ended |

### undetermined [#undetermined]

**Subject undetermined: every detector runs** (sandbox scenario `undetermined`). The face read stays undetermined, so the onset-and-end detector and the peak detector both run, and their calls arrive with low confidence and a shared orgasm index.

Imminence each minute:

| streamTimeS | p30 | p60 |
| --- | --- | --- |
| 62 | 0.022 | 0.043 |
| 122 | 0.024 | 0.047 |
| 182 | 0.047 | 0.092 |
| 242 | 0.056 | 0.11 |
| 302 | 0.077 | 0.147 |
| 362 | 0.132 | 0.247 |
| 422 | 0.172 | 0.315 |
| 482 | 0.279 | 0.481 |
| 542 | 0.446 | 0.693 |
| 602 | 0.769 | 0.947 |
| 662 | 0.103 | 0.196 |

Orgasm calls:

| type | data |
| --- | --- |
| `orgasm.onset` | orgasm 1 at 590 s, lag 5.1 s, score 0.58 |
| `orgasm.peak` | orgasm 1 at 596 s, lag 3.4 s, score 0.55 |
| `orgasm.end` | orgasm 1 at 624 s, lasted 34 s, onset_end, lag 5.3 s |

### face-only [#face-only]

**Face only: no microphone** (sandbox scenario `face-only`). The device publishes the camera without the microphone: imminence and the subject read arrive, onset, peak and end cannot, and an audio warning says why. With no orgasm called, the approach that recedes counts as an edge.

Imminence each minute:

| streamTimeS | p30 | p60 |
| --- | --- | --- |
| 62 | 0.018 | 0.036 |
| 122 | 0.035 | 0.069 |
| 182 | 0.042 | 0.083 |
| 242 | 0.064 | 0.124 |
| 302 | 0.156 | 0.287 |
| 362 | 0.173 | 0.317 |
| 422 | 0.386 | 0.624 |
| 482 | 0.757 | 0.941 |
| 542 | 0.241 | 0.424 |

### face-lost [#face-lost]

**Face lost for 20 seconds** (sandbox scenario `face-lost`). The face leaves the frame at five minutes: imminence goes null, a warning is raised and the session is degraded until the face returns 20 seconds later.

Imminence each minute:

| streamTimeS | p30 | p60 |
| --- | --- | --- |
| 62 | 0.019 | 0.038 |
| 122 | 0.032 | 0.062 |
| 182 | 0.044 | 0.086 |
| 242 | 0.067 | 0.13 |
| 302 | null | null |
| 362 | 0.161 | 0.296 |
| 422 | 0.301 | 0.512 |
| 482 | 0.518 | 0.767 |
| 542 | 0.512 | 0.761 |
| 602 | 0.081 | 0.156 |
| 662 | 0.034 | 0.067 |

Orgasm calls:

| type | data |
| --- | --- |
| `orgasm.onset` | orgasm 1 at 520 s, lag 4.8 s, score 0.69 |
| `orgasm.end` | orgasm 1 at 556 s, lasted 36 s, onset_end, lag 5.4 s |

| sequence | streamTimeS | type | confidence | data |
| --- | --- | --- | --- | --- |
| 1 | 0 | `session.status` | — | ready |
| 2 | 0 | `session.status` | — | calibrating |
| 3 | 0 | `input.warning` | — | baseline_pending raised |
| 4 | 31 | `subject.identified` | high | woman, pWoman 0.89, detectors onset_end |
| 5 | 62 | `session.status` | — | analyzing |
| 6 | 62 | `input.warning` | — | baseline_pending cleared |
| 483 | 300 | `input.warning` | — | face_not_visible raised |
| 484 | 300 | `session.status` | — | analyzing, degraded |
| 525 | 320 | `input.warning` | — | face_not_visible cleared |
| 526 | 320 | `session.status` | — | analyzing |
| 937 | 524.8 | `orgasm.onset` | high | orgasm 1 at 520 s, lag 4.8 s, score 0.69 |
| 1012 | 561.4 | `orgasm.end` | high | orgasm 1 at 556 s, lasted 36 s, onset_end, lag 5.4 s |
| 1289 | 700 | `session.status` | — | ended, media_ended |

### edge [#edge]

**Edge: three approaches, no orgasm** (sandbox scenario `edge`). Imminence rises past the hold and back-off levels three times and falls each time stimulation is backed off, and the session ends without an orgasm: three edges, each an edge.completed.

Imminence each minute:

| streamTimeS | p30 | p60 |
| --- | --- | --- |
| 62 | 0.02 | 0.039 |
| 122 | 0.039 | 0.077 |
| 182 | 0.083 | 0.158 |
| 242 | 0.143 | 0.265 |
| 302 | 0.29 | 0.496 |
| 362 | 0.605 | 0.844 |
| 422 | 0.171 | 0.312 |
| 482 | 0.145 | 0.268 |
| 542 | 0.526 | 0.776 |
| 602 | 0.26 | 0.452 |
| 662 | 0.116 | 0.219 |
| 722 | 0.389 | 0.627 |
| 782 | 0.396 | 0.635 |
| 842 | 0.133 | 0.249 |

Each approach ends in an `edge.completed`:

| sequence | streamTimeS | type | confidence | data |
| --- | --- | --- | --- | --- |
| 1 | 0 | `session.status` | — | ready |
| 2 | 0 | `session.status` | — | calibrating |
| 3 | 0 | `input.warning` | — | baseline_pending raised |
| 4 | 31 | `subject.identified` | high | man, pWoman 0.05, detectors peak, face_end |
| 5 | 62 | `session.status` | — | analyzing |
| 6 | 62 | `input.warning` | — | baseline_pending cleared |
| 706 | 411 | `edge.completed` | high | edge 1: p30 0.6 at 362 s, peak 0.687, below 0.3 49 s later |
| 1067 | 591 | `edge.completed` | high | edge 2: p30 0.6 at 548 s, peak 0.669, below 0.3 43 s later |
| 1468 | 791 | `edge.completed` | high | edge 3: p30 0.6 at 747 s, peak 0.684, below 0.3 44 s later |
| 1686 | 900 | `session.status` | — | ended, media_ended |

### ruin [#ruin]

**Ruin: past the point of no return** (sandbox scenario `ruin`). Imminence crosses the stop level, stimulation is reported off for good, and the peak still comes a few seconds later: a ruined orgasm, whose end says so.

Imminence each minute:

| streamTimeS | p30 | p60 |
| --- | --- | --- |
| 62 | 0.023 | 0.045 |
| 122 | 0.028 | 0.054 |
| 182 | 0.049 | 0.095 |
| 242 | 0.069 | 0.134 |
| 302 | 0.074 | 0.142 |
| 362 | 0.146 | 0.27 |
| 422 | 0.306 | 0.518 |
| 482 | 0.319 | 0.536 |
| 542 | 0.558 | 0.804 |
| 602 | 0.819 | 0.967 |
| 662 | 0.119 | 0.223 |
| 722 | 0.053 | 0.104 |

Orgasm calls:

| type | data |
| --- | --- |
| `orgasm.peak` | orgasm 1 at 612 s, lag 3.3 s, score 0.57 |
| `orgasm.end` | orgasm 1 at 640 s, lasted 28 s, face_end, lag 3.9 s, ruined |

The scenario reports stimulation as a product running the [ruin preset](/docs/concepts/presets#ruin) would: on at the baseline, off where the preset stops. Its imminence is stimulation-aware from the baseline, and the orgasm's end says `ruined: true`.

| sequence | streamTimeS | type | confidence | data |
| --- | --- | --- | --- | --- |
| 1 | 0 | `session.status` | — | ready |
| 2 | 0 | `session.status` | — | calibrating |
| 3 | 0 | `input.warning` | — | baseline_pending raised |
| 4 | 31 | `subject.identified` | high | man, pWoman 0.08, detectors peak, face_end |
| 5 | 62 | `session.status` | — | analyzing |
| 6 | 62 | `input.warning` | — | baseline_pending cleared |
| 1115 | 615.3 | `orgasm.peak` | high | orgasm 1 at 612 s, lag 3.3 s, score 0.57 |
| 1172 | 643.9 | `orgasm.end` | high | orgasm 1 at 640 s, lasted 28 s, face_end, lag 3.9 s, ruined |
| 1445 | 780 | `session.status` | — | ended, media_ended |

### finish [#finish]

**Finish: two orgasms** (sandbox scenario `finish`). A build-up to an onset and an end, a second, shorter build-up, and a second onset and end, each with its own orgasm index.

Imminence each minute:

| streamTimeS | p30 | p60 |
| --- | --- | --- |
| 62 | 0.021 | 0.042 |
| 122 | 0.029 | 0.058 |
| 182 | 0.038 | 0.074 |
| 242 | 0.049 | 0.095 |
| 302 | 0.101 | 0.193 |
| 362 | 0.148 | 0.274 |
| 422 | 0.249 | 0.436 |
| 482 | 0.377 | 0.612 |
| 542 | 0.853 | 0.978 |
| 602 | 0.316 | 0.532 |
| 662 | 0.414 | 0.657 |

Orgasm calls:

| type | data |
| --- | --- |
| `orgasm.onset` | orgasm 1 at 541 s, lag 4.4 s, score 0.73 |
| `orgasm.end` | orgasm 1 at 571 s, lasted 30 s, onset_end, lag 5 s |
| `orgasm.onset` | orgasm 2 at 643 s, lag 4.2 s, score 0.67 |
| `orgasm.end` | orgasm 2 at 668 s, lasted 25 s, onset_end, lag 4.9 s |

## How the sandbox differs from live analysis [#how-the-sandbox-differs-from-live-analysis]

- **Free.** Sandbox sessions count orgasms, ruins and edges as live ones do, in their `charges` and your test usage, and draw no credits: `credits` stays 0. [Credits and billing](/docs/credits#testing-in-the-sandbox) says what each scenario counts.
- **No media.** A sandbox session starts its scenario as soon as it is created. `ingest.url` answers `501 sandbox_no_media`, and the attestation policy for test mode says there is nothing to verify.
- **Scripted.** Scenarios do not react to what you do. Reporting stimulation sets `stimulationAware` from then on but does not change the curve, or which orgasms are ruined.
- **Uploads are discarded.** Recording uploads are read and thrown away. Use any small video file, never a real recording of a person.
- **Thresholds are illustrative.** Detector `score` and `threshold` values are the sandbox's, not live operating points.
- **Usage, credits and API keys** answer with the examples in the contract.
- **State lives in memory.** Sessions, recordings and webhook endpoints last until the sandbox restarts.

## Running it yourself [#running-it-yourself]

From this repository, `npm run dev` serves the sandbox with the docs at `http://localhost:3000/v1`, and `npm run mock` serves it alone at `http://localhost:4010`, together with the WebSocket channel.
