Source: https://sopops.dev/docs/configuration

# Configuration

## Core

| Variable | Default | What it does |
|---|---|---|
| `DATABASE_URL` | `sqlite:///sopops.db` | Postgres (`postgresql://`, needs `pip install 'sopops-server[postgres]'`) or SQLite. Alembic migrates on startup. |
| `SOP_BIN` | `sop` on `PATH` | The sop binary. Use v0.1.3 or later for explicit step ordering. |
| `HOST`, `PORT` | `127.0.0.1`, `8484` | Also `--host`, `--port`. |
| `SOPOPS_SECRET_KEY` | unset | Fernet key that encrypts platform keys, webhook secrets and GitHub tokens. Required to store them. |
| `SOPOPS_CORS_ORIGINS` | unset | Comma-separated browser origins allowed to call sopops. |
| `SOPOPS_WEB_DIR` | the built UI | Serve the UI from another folder. |

Make a `SOPOPS_SECRET_KEY`:

```sh
python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"
```

## Models

These variables set the deployment's defaults; see [Models](https://sopops.dev/docs/sessions-and-review.md#models). Each team can replace any of them with its own keys and models in Settings, under Checks.

| Variable | Default | What it does |
|---|---|---|
| `SOPOPS_MODEL_FAST`, `SOPOPS_MODEL_REASONING` | unset | The two model roles. `SOPOPS_MODEL_REASONING=rules` tries importing without a model. |
| `SOPOPS_LLM_API_BASE`, `SOPOPS_LLM_TIMEOUT`, `SOPOPS_MAX_TOKENS` | unset, `300`, `16000` | OpenAI-compatible base URL for every call; per-call timeout (s); output limit. |
| `SOPOPS_MODEL_DECISION` | unset (the fast model) | The model that answers decisions when Jev doesn't. Applies only to teams on the deployment's models. |
| `SOPOPS_LM_URL`, `SOPOPS_LM_KEY` | unset | A model gateway (an OpenAI-compatible endpoint) that serves models named `sopops/<name>`, such as `sopops/sopops-fast`. When set, teams can pick these as the provider "sopops" in setup and Settings, and never see the models behind them. |
| `TYPESAFE_API_KEY`, `SOPOPS_JEV`, `SOPOPS_JEV_MODEL` | unset, auto, `jev-1.13.0` | Jev for decisions. On when the key is set, unless `SOPOPS_JEV=off`. |
| `SOPOPS_SYSTEM1_URL`, `SOPOPS_SYSTEM1_MODEL`, `SOPOPS_SYSTEM1_KEY`, `SOPOPS_SYSTEM1` | unset, `sopops-system1`, `SOPOPS_LM_KEY`, auto | A model gateway's system-1 classifier for decisions (`POST <url>/system1`, DSPy's System One request), so the classifier's keys stay in the gateway. Used instead of `TYPESAFE_API_KEY` when both are set, except for a team's own TypeSafe key, which goes to TypeSafe directly. When the gateway's classifier is unavailable, the decision model answers. `SOPOPS_SYSTEM1=off` ignores it. |
| `SOPOPS_CHECK_MODE`, `SOPOPS_CHECK_REVIEW`, `SOPOPS_DECISIONS` | `decide`, `on`, unset | Check mode; reviewer on or off; decision thresholds and bands as JSON, e.g. `{"never": [0.05, 0.7, 0.7]}`. |
| `SOPOPS_MODEL_PRICES` | unset | Prices for spend estimates, JSON in USD per million tokens, e.g. `{"openai/gpt-5-mini": [0.25, 2]}`. Adds to or overrides the built-in table (Jev, current Claude models). |
| `SOPOPS_DSPY_CACHE_DIR` | unset | Disk cache for model responses (transcripts are written there). In memory otherwise. |

The spot-check batch size is set per workspace, not by a variable: 25 rule results by default, changed with `PUT /v1/workspaces/{ws}/spot-checks/settings` ([spot checks](https://sopops.dev/docs/api/checks-and-review.md#corrections-and-spot-checks)).

Analysis can be paused per workspace, by an owner or admin (Settings → Checks, or `PUT /v1/workspaces/{ws}/analysis` with `{"paused": true}`). Sessions still come in and show their transcripts, but no model runs on them: nothing is routed, checked, clustered, suggested or calibrated, and the daily recluster skips the workspace. Resuming queues the sessions that came in meanwhile to be checked.

## Sign-in

See [Sign in](https://sopops.dev/docs/sign-in.md). sopops sends no email: invites, join links and password resets are links to copy. For single sign-on on a self-hosted sopops, [put it behind Cloudflare Zero Trust](https://sopops.dev/docs/sign-in.md#put-sopops-behind-cloudflare-zero-trust).

| Variable | Default | What it does |
|---|---|---|
| `SOPOPS_GITHUB_OAUTH_CLIENT_ID`, `SOPOPS_GITHUB_OAUTH_CLIENT_SECRET` | unset | Sign in with GitHub. |
| `SOPOPS_GOOGLE_CLIENT_ID`, `SOPOPS_GOOGLE_CLIENT_SECRET` | unset | Sign in with Google. |
| `SOPOPS_AUTH_REQUIRED` | on when GitHub or Google is set up | `true` or `false` forces sign-in. `true` with nothing set up: email and password sign-in. |
| `SOPOPS_OPEN_SIGNUP` | `true` | Anyone can sign up (name, email, password, team name) and owns the new team, with no invite link. On wherever passwords are the way in. Set it to `0` for invites only, which a sopops on a public address and this server's model keys may want. |
| `SOPOPS_LOGIN_PROVIDERS` | unset | Comma-separated provider ids (`github`, `google`, `password`, and any a plugin registers): the only ones offered. Unset, every provider that's set up is offered. A list naming none that are set up is ignored, with a warning. |
| `SOPOPS_ALLOWED_EMAIL_DOMAINS` | unset | Comma-separated. Only verified emails at these domains can sign in. |
| `SOPOPS_PUBLIC_URL` | the request's own address | Where people reach the web UI, path included if it has one (`https://example.com/sopops`). Base of invite, join and password links, and of the pages sign-in sends people back to. Also the base of sign-in callbacks unless `SOPOPS_PUBLIC_API_URL` is set. |
| `SOPOPS_PUBLIC_API_URL` | `SOPOPS_PUBLIC_URL` | Where the browser reaches the API, when that isn't under `SOPOPS_PUBLIC_URL` (the UI at `https://example.com/app`, the API at `https://example.com/api`). Base of sign-in callbacks. |

## Serving sopops under a path

By default the UI is at `/` and the API at `/v1/...`. To put sopops under a path behind a reverse proxy, build the UI
for it and tell the server where people reach it:

```sh
SOPOPS_WEB_BASE=/sopops/ pnpm -C web build    # the UI's base; its API calls go to /sopops/v1/... too
SOPOPS_PUBLIC_URL=https://example.com/sopops   # for links and sign-in callbacks
```

The UI and the API can have separate prefixes: `SOPOPS_WEB_API_BASE=/api` at build time, and `SOPOPS_PUBLIC_API_URL`
on the server. The server reads both bases back from the built UI. A proxy can forward with the prefix still on the
path, or take it off and say which in `X-Forwarded-Prefix`; a proxy that takes it off without saying makes a redirect
loop. `web/wrangler.jsonc` builds the UI for Cloudflare Workers instead (`pnpm build:cloudflare`), for a deployment
that serves it from there; nothing in self-hosting uses it.

## Platforms and webhooks

| Variable | Default | What it does |
|---|---|---|
| `SOPOPS_REQUIRE_WEBHOOK_SECRET` | `false` | Set `true` on a hosted server. Refuses call-start webhooks for any workspace that has no webhook secret or runtime token. |
| `SOPOPS_SESSION_IDLE_MINUTES` | `30` | A streamed session with no events this long closes as incomplete. |
| `SOPOPS_POSTCALL_GRACE_SECONDS` | `120` | After ElevenLabs' monitor socket ends, how long to wait for the post-call webhook (if set up) before closing and checking. |
| `SOPOPS_LIVEKIT_ANY_HOST` | `false` | Allow a self-hosted LiveKit URL, not only LiveKit Cloud. |
| `SOPOPS_MCP_SOURCE` | `sopops[mcp] @ git+https://github.com/sopops-dev/sopops@main#subdirectory=sdks/python` | What the onboarding command's `uvx --from` installs: the client SDK with its `mcp` extra. From a clone: `/path/to/sopops/sdks/python[mcp]`. |

## GitHub

| Variable | Default | What it does |
|---|---|---|
| `SOPOPS_GITHUB_API_URL` | `https://api.github.com` | GitHub Enterprise Server: `https://HOST/api/v3`. Also set `SOPOPS_GITHUB_URL` to `https://HOST` for its install pages. |
| `SOPOPS_GITHUB_APP_ID`, `SOPOPS_GITHUB_APP_PRIVATE_KEY` (or `…_PATH`), `SOPOPS_GITHUB_WEBHOOK_SECRET`, `SOPOPS_GITHUB_APP_SLUG` | unset | The GitHub App sopops signs in as: id, private key (PEM or file), webhook secret, and name in `github.com/apps/<slug>`. Without them, Settings offers to create one (stored encrypted with `SOPOPS_SECRET_KEY`). |

## Hatchet

| Variable | Default | What it does |
|---|---|---|
| `HATCHET_CLIENT_TOKEN` | unset | Run the pipeline on Hatchet. Needs `pip install 'sopops-server[hatchet]'` and `sopops worker`. |
| `SOPOPS_RATE_LIMIT_PER_MINUTE` | `60` | Model calls per minute per model. |
| `SOPOPS_WORKSPACE_CONCURRENCY` | `4` | Runs per workspace at once. |
| `SOPOPS_WORKER_SLOTS` | `20` | Worker slots. |
| `SOPOPS_RECLUSTER_CRON` | `0 6 * * *` | Daily recluster. |
| `SOPOPS_PR_STATUS_CRON` | `*/15 * * * *` | Check pull requests and sync connected repositories. |

These settings apply only with Hatchet. Without it, run `sopops recluster` and `sopops pr-status` from cron.
