LOLM Quickstart

Integrate LOLM into any platform

LOLM is an HTTP + SSE agent API with an npm client and a CLI. Use the hosted base URL or point at your own self-hosted instance — same routes, same receipts.

1 · npm

Node / browsers

lolm-nfet-client — zero deps, works with fetch.

2 · CLI

Scripts & CI

lolm-cli — exit non-zero unless code ran.

3 · HTTP

Any language

curl, Python, Go, Ruby… POST JSON, read SSE events.

4 · Self-host

Your base URL

Same API shape. Unlimited when not on the shared box.

Machine-readable catalog: GET /api/demo/integrate · openapi.json · Live usage: /api/demo/billing/usage

Quickstart (3 minutes)

npm install lolm-nfet-client

import { runCode, buildVisual, getStatus } from "lolm-nfet-client";

// optional: process.env.LOLM_BASE_URL || default public host
const baseUrl = "https://lolm.imagineqira.com";

console.log(await getStatus({ baseUrl }));

const done = await runCode({
  baseUrl,
  task: "write fizzbuzz to 20 in solution.py and run it",
  onEvent: (ev) => console.log(ev.event),
});
console.log(done?.receipt_sha || done?.receipt?.receipt_sha);

const vis = await buildVisual({ baseUrl, task: "a tiny counter app" });
// vis.html → render in iframe sandbox
npm install -g lolm-cli

lolm status
lolm code "write fizzbuzz to 20 in solution.py and run it" --save ./out
lolm build "a snake game" -o snake.html

# your own instance
lolm code "…" --base http://127.0.0.1:7866
# health
curl -sS https://lolm.imagineqira.com/api/demo/code/health | jq .

# usage remaining (no auth on free)
curl -sS https://lolm.imagineqira.com/api/demo/billing/usage | jq .

# coding agent (SSE stream)
curl -sSN -X POST https://lolm.imagineqira.com/api/demo/code/run \
  -H 'Content-Type: application/json' \
  -d '{"task":"print hello from main.py and run it"}'

# paid tier (after Stripe claim)
curl -sS https://lolm.imagineqira.com/api/demo/billing/usage \
  -H "X-LOLM-License: $LOLM_LICENSE"
import json, urllib.request

BASE = "https://lolm.imagineqira.com"

def get(path):
    with urllib.request.urlopen(BASE + path) as r:
        return json.loads(r.read().decode())

print(get("/api/demo/integrate")["endpoints"][:3])
print(get("/api/demo/billing/usage")["runs"])

# Streaming code run: use requests + iter_lines, or httpx,
# and parse SSE blocks (event: / data:). See JS parseSSEStream for the shape.

What you can call (public)

Nginx only exposes /api/demo/* on the public host. That is the stable integration surface.

MethodPathUse for
GET/api/demo/statusReady?
GET/api/demo/billing/usageQuota left
GET/api/demo/integrateThis catalog (JSON)
POST/api/demo/run/streamChat agent SSE
POST/api/demo/code/runCoding jail loop SSE
POST/api/demo/code/visualHTML/app build
GET/api/demo/code/receiptsAudit ledger
GET/api/demo/code/task_stateResume z_t by conversation_id

Integration patterns

SaaS backend

Your server calls runCode with a license header for Plus/Pro. Map your user id → conversation_id for task state continuity.

CI / scripts

lolm code "$TASK" --save ./out --json — non-zero exit if code didn’t run. Gate PRs on receipts.

Product UI

Stream SSE to show write→run→fix live. Seal ends with code_receipt for your audit log.

Self-host / VPC

Deploy the demo server; set baseUrl / --base / LOLM_BASE_URL. Unlimited local quotas.

Auth & money (for your product)

SSE shape (coding)

event: agent_note
data: {"text":"task state z_t opened…"}

event: command_started
data: {"cmd":"python3 solution.py"}

event: code_done
data: {"ok":true,"files":["solution.py"],…}

event: code_receipt
data: {"receipt_sha":"…","ok":true,"task":"…"}

Self-host base URL

# same client code — only base changes
const baseUrl = process.env.LOLM_BASE_URL || "http://127.0.0.1:7866";
await runCode({ baseUrl, task: "…" });

See install → self-host. CORS is open on the workspace app for browser demos; production backends should call from your server.

npm client npm CLI JSON catalog Pricing Live receipts

API keys (product identity)

Stable identity for integrators (better than IP free tier). Store the secret once — it is not shown again. This is not provider BYOK — those live on self-host under the Keys panel / /api/demo/keys.

curl -sS -X POST https://lolm.imagineqira.com/api/demo/api-keys \
  -H 'Content-Type: application/json' \
  -d '{"tier":"free","label":"my-app"}'

# use it
curl -sS https://lolm.imagineqira.com/api/demo/billing/usage \
  -H "X-LOLM-Api-Key: lolm_…"

# paid tiers: send X-LOLM-License from Stripe claim, then mint tier=plus|pro

BYOK (your model providers)

Self-host or loopback: paste Anthropic / OpenAI / Groq / Gemini / DeepSeek / Mistral / xAI / Fireworks / OpenRouter / Together / any OpenAI-compatible base URL. Keys apply instantly to chat, code, and visual builds. Your keys are preferred over the shared gateway.

# on your box (localhost)
curl -sS -X POST http://127.0.0.1:7866/api/demo/keys \
  -H 'Content-Type: application/json' \
  -d '{"keys":{"OPENAI_API_KEY":"sk-…","OPENAI_MODEL":"gpt-4o-mini"}}'

# prove it works
curl -sS -X POST http://127.0.0.1:7866/api/demo/keys/probe \
  -H 'Content-Type: application/json' \
  -d '{"provider":"openai"}'

Webhooks

Optional webhook_url on code runs — public HTTPS only (SSRF-guarded). Fired when the run completes with receipt summary.

curl -sSN -X POST https://lolm.imagineqira.com/api/demo/code/run \
  -H 'Content-Type: application/json' \
  -H "X-LOLM-Api-Key: $LOLM_API_KEY" \
  -d '{"task":"print 1 and run it","webhook_url":"https://your.app/hooks/lolm"}'

Python (stdlib)

from lolm_client import LOLM
c = LOLM(api_key="lolm_…")   # or LOLM() free IP
print(c.usage())
r = c.run_code_collect("write fizzbuzz to 20 in solution.py and run it")
print(r["done"], r["receipt"])

Module path: clients/python/lolm_client.py in the repo (PYTHONPATH=clients/python).