Configuration

LLMs, databases, and environment variables

SelectStar is model-agnostic and database-pluggable. Everything is configured via environment variables in .env.local and one shared wrapper file at src/lib/llm.ts.

LLM providers

SelectStar uses the z-ai-web-dev-sdk by default, pointed at OpenCode Zen with the big-pickle model. The SDK is OpenAI-compatible, so any provider that speaks that protocol works. Swapping providers is one config change.

.env.local
# ──────────────────────────────────────────────
# Default — z-ai-web-dev-sdk + OpenCode Zen
# ──────────────────────────────────────────────
LLM_BASE_URL=https://opencode.ai/api/v1
LLM_API_KEY=zk_...
LLM_MODEL=big-pickle

# ──────────────────────────────────────────────
# Option B — OpenAI
# ──────────────────────────────────────────────
LLM_BASE_URL=https://api.openai.com/v1
LLM_API_KEY=sk-...
LLM_MODEL=gpt-4.1

# ──────────────────────────────────────────────
# Option C — Anthropic (via OpenAI-compatible proxy)
# ──────────────────────────────────────────────
LLM_BASE_URL=https://api.anthropic.com/v1
LLM_API_KEY=sk-ant-...
LLM_MODEL=claude-sonnet-4

# ──────────────────────────────────────────────
# Option D — Ollama (on-prem, fully offline)
# ──────────────────────────────────────────────
LLM_BASE_URL=http://localhost:11434/v1
LLM_API_KEY=ollama
LLM_MODEL=llama3.1:70b

# ──────────────────────────────────────────────
# Option E — vLLM (self-hosted)
# ──────────────────────────────────────────────
LLM_BASE_URL=http://vllm.local:8000/v1
LLM_API_KEY=token-...
LLM_MODEL=Qwen/Qwen2.5-72B-Instruct

# ──────────────────────────────────────────────
# Option F — LM Studio (local)
# ──────────────────────────────────────────────
LLM_BASE_URL=http://localhost:1234/v1
LLM_API_KEY=lm-studio
LLM_MODEL=local-model

How it works: The shared wrapper at src/lib/llm.ts reads these env vars and exposes three methods every agent uses: complete(), completeJson(), and completeStream(). Swap providers by changing the env vars — no code changes needed.

Database connections

In SQL Mode, paste a connection string into the connection screen. SelectStar introspects the schema (tables, columns, PKs, FKs, approximate row counts) once on connect and caches the snapshot. Per-table COUNT queries have a 3-second statement_timeoutso a single slow table on a remote database doesn't block the whole introspection.

SQLite

sqlite:./path/to/your.db
./path/to/your.db
demo  (bundled)

Synchronous, fast, no server. Default for the demo DB.

PostgreSQL

postgresql://user:pass@host:5432/dbname

Connection pooling, information_schema introspection. Works with Supabase, CockroachDB, Neon.

MySQL

mysql://user:pass@host:3306/dbname

Parser recognizes mysql://. Install mysql2 + implement MySqlConnection class.

Classic Mode uploads

Classic Mode doesn't need a connection string — just upload files. Files are stored on disk under CLASSIC_UPLOAD_DIR (defaults to db/classic-uploads/) so sessions can be re-hydrated after a server restart.

.env.local (Classic Mode)
# Where uploaded Classic Mode files are stored
CLASSIC_UPLOAD_DIR=./db/classic-uploads

# Max file size for Classic Mode uploads (default 25 MB)
# This is enforced server-side — change in src/app/api/classic/upload/route.ts
# Allowed extensions: .csv, .tsv, .txt, .xlsx, .xlsm, .xlsb, .ods

App database (sessions, audit log)

SelectStar stores its own metadata — sessions, chat messages, canvas objects, and the write-audit log — in a separate SQLite database via Prisma. Connection strings for your connected databases are stored here too so sessions can be re-opened. In a real deployment, encrypt connection strings at rest.

.env.local (App DB)
# Prisma database URL — where SelectStar stores its own state
# Default: SQLite at db/app.db
DATABASE_URL="file:./db/app.db"

# To use Postgres for the app DB instead:
# DATABASE_URL="postgresql://user:pass@host:5432/selectstar_app"

# After changing DATABASE_URL, re-push the schema:
# bun run db:push

Zen mode (write safety)

Zen mode is per-session, off by default. It only appears as a toggle if the connected database role has write privileges. When on, the SQL agent intercepts write statements at the graph edge and registers them as pending (10-minute TTL). The user sees three actions: Confirm & execute, Dry-run (rollback), or Cancel. Every resolution is audit-logged.

Zen mode configuration
# Zen mode is configured per-session via the UI toggle,
# or via the API:

# Toggle Zen mode on
PATCH /api/sessions/:id
{ "zenMode": true }

# Pending write TTL is 10 minutes (hardcoded in src/lib/pending-writes.ts).
# To change it, edit the TTL constant and restart the server.

# Audit log entries are stored in the app DB (Prisma AuditLog model).
# View them via:
GET /api/audit?sessionId=...

All environment variables

The complete reference for every environment variable SelectStar reads.

VariableDefaultPurpose
LLM_BASE_URLhttps://opencode.ai/api/v1OpenAI-compatible LLM endpoint
LLM_API_KEY(required)API key for the LLM provider
LLM_MODELbig-pickleModel name to use for all agents
DATABASE_URLfile:./db/app.dbPrisma database URL for app state
CLASSIC_UPLOAD_DIR./db/classic-uploadsWhere Classic Mode files are stored

Next steps

Now that you're configured, dive into the architecture or browse the API.