Node.js HTTP API (langclaw-backend) for Langclaw and Langclaw: agent workflows, 0G integrations, Supabase persistence, usage billing, and OpenAI-compatible 0G Compute proxy.
Organization: Langclaw-AI · Frontend: Langclaw-AI/frontend · Contracts: Langclaw-AI/contracts
- Langclaw —
runLangclawWorkflow(topic)viaPOST /api/discoverand/api/discover/stream - Chat —
POST /api/chat/stream, session sync to Supabase - Account — wallet auth, API keys (HMAC), memory, automation, usage ledger
- 0G — Compute Router proxy (
/v1/*), Storage uploads, Chain registry calls - On-chain tools — optional Alchemy, Dune, DeFiLlama, etc.
cp .env.example .env
npm install
npm run devDefault: http://localhost:3001
curl http://localhost:3001/healthProduction:
npm run build && npm startDefined in src/server.ts:
| Area | Endpoints |
|---|---|
| Health | GET /health |
| Research | POST /api/discover, POST /api/discover/stream |
| Chat | POST /api/chat/stream, POST /api/chat/sessions |
| Memory | POST /api/memory, POST /api/memory/settings |
| API keys | POST /api/api-keys |
| Usage | POST /api/usage/balance, quote, deposit/verify, withdraw/request |
| Automation | POST /api/automation/*, webhooks, Telegram |
| 0G proxy | GET/POST /v1/*, GET/POST /api/0g/* |
Full request/response shapes: docs/API_REFERENCE.md.
OpenClaw runs reasoning steps (openclaw agent --json); discovery and provider calls stay in TypeScript.
runLangclawWorkflow(topic)
→ Planner (OpenClaw)
→ Discovery (TS: X/Brave, GitHub, Tavily, HackQuest)
→ Source normalizer (TS)
→ Trend scorer (OpenClaw)
→ Evidence packager (OpenClaw)
→ Verifier (OpenClaw)
→ Final conclusion (0G Compute → OpenClaw → fallback)
→ 0G Storage upload → LangclawRegistry anchor
Skills: openclaw/skills/ — see openclaw/README.md.
X discovery defaults to Brave (X_DISCOVERY_PROVIDER=brave). Use x-api only with X_BEARER_TOKEN and credits.
curl -fsSL https://openclaw.ai/install.sh | bash
openclaw onboard --install-daemon
openclaw doctorEnv (see .env.example):
OPENCLAW_ENABLED=true
OPENCLAW_WORKFLOW_ENABLED=true
OPENCLAW_AI_SYNTHESIS=trueCopy .env.example. Minimum for a useful dev server:
| Variable | Purpose |
|---|---|
SUPABASE_URL, SUPABASE_SERVICE_ROLE_KEY |
Persistence |
LANGCLAW_API_KEY_PEPPER |
API key hashing |
OG_COMPUTE_API_KEY, OG_COMPUTE_ENABLED |
Model proxy |
CORS_ORIGIN |
Frontend origin (default http://localhost:3000) |
Langclaw providers: BRAVE_SEARCH_API_KEY, GITHUB_TOKEN, TAVILY_API_KEY, …
0G proof: OG_STORAGE_*, OG_CHAIN_*, LANGCLAW_REGISTRY_ADDRESS
Billing: LANGCLAW_USAGE_VAULT_ADDRESS — deploy from Langclaw-AI/contracts
Apply migrations under supabase/migrations/. Clients never write directly; the server uses the service role key.
| Contract | Deploy | Env |
|---|---|---|
LangclawUsageVault |
Langclaw-AI/contracts | LANGCLAW_USAGE_VAULT_ADDRESS |
LangclawRegistry |
npm run deploy:registry |
LANGCLAW_REGISTRY_ADDRESS |
Registry source: contracts/LangclawRegistry.sol
Deposit verification: src/lib/usage.ts → POST /api/usage/deposit/verify
Vault spec: docs/SMART_CONTRACT_TEAM_NOTES.md
npm run dev # tsx watch src/server.ts
npm run build # tsc → dist/
npm start # node dist/server.js
npm test # node --test
npm run deploy:registry| File | Description |
|---|---|
docs/API_REFERENCE.md |
Full API |
LANGCLAW_BLUEPRINT.md |
Hackathon blueprint |
docs/DEMO_SCRIPT.md |
Demo video script |
docs/SMART_CONTRACT_TEAM_NOTES.md |
Vault requirements |