vilow.dev · Integrations · Replit
Add Vilow to a Replit project
Replit gives you a cloud IDE with a real Linux runtime, env-var Secrets, and built-in deploy. Easiest stack for personal projects. Works with the Replit Agent (their AI coding assistant) too — just describe what you want and point it at this guide.
-
Get a Vilow API key
vilow.dev/dashboard → API keys → Create. Copy the
ck_live_…string. -
Add the key to Replit Secrets
In your Repl: left sidebar → Tools → Secrets (or the 🔒 icon). Add:
VILOW_API_KEY = ck_live_... VILOW_API_BASE = https://api.vilow.dev/v1
Replit injects these as environment variables at runtime. They're encrypted at rest and never appear in the public source if your Repl is public.
-
Add a server route (Node example)
For an Express Repl:
// server.js or index.js import express from "express"; const app = express(); app.use(express.json()); const KEY = process.env.VILOW_API_KEY; const API = process.env.VILOW_API_BASE || "https://api.vilow.dev/v1"; app.post("/chat", async (req, res) => { const { user_id, character_id, message } = req.body; let cid = character_id; if (!cid) { await fetch(`${API}/users`, { method: "POST", headers: { "X-API-Key": KEY, "Content-Type": "application/json" }, body: JSON.stringify({ external_id: user_id, display_name: "Replit visitor" }), }); const r = await fetch(`${API}/users/${user_id}/characters`, { method: "POST", headers: { "X-API-Key": KEY, "Content-Type": "application/json" }, body: JSON.stringify({ name: "Aria", default_language: "auto" }), }); cid = (await r.json()).id; } const chat = await fetch(`${API}/chat/${user_id}/${cid}/send`, { method: "POST", headers: { "X-API-Key": KEY, "Content-Type": "application/json" }, body: JSON.stringify({ message }), }); res.json({ ...(await chat.json()), character_id: cid }); }); app.listen(3000);
Python (FastAPI) — equivalent shape, ask Replit Agent if you want it.
-
Frontend — call /chat from the browser
async function send(text) { const uid = localStorage.getItem("vilow_uid") || (() => { const u = "u_" + crypto.randomUUID(); localStorage.setItem("vilow_uid", u); return u; })(); const cid = localStorage.getItem("vilow_cid"); const r = await fetch("/chat", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ user_id: uid, character_id: cid && +cid, message: text }), }); const d = await r.json(); if (d.character_id) localStorage.setItem("vilow_cid", "" + d.character_id); return d.reply; }
-
Run + test
Click Run. Replit gives you a preview at
{slug}.{user}.repl.co(legacy) or{slug}.replit.app. Vilow allows both as CORS origins out of the box. -
Deploy
For always-on production: Deployments → Reserved VM or Autoscale. Secrets carry over automatically. Custom domain via Deployments → Settings → Custom domains.
With the Replit Agent
If you're driving development through the Replit AI Agent, paste this prompt:
Add a /chat endpoint that proxies to the Vilow API.
- Read VILOW_API_KEY and VILOW_API_BASE from Secrets.
- Lazy-create a Character on first message (POST /users, POST /users/{u}/characters).
- Forward every message to POST /chat/{u}/{cid}/send.
- Return the reply + character_id to the client.
- Browser stores user_id and character_id in localStorage.
Common gotchas
- "VILOW_API_KEY undefined" — restart the Repl after adding Secrets. Replit injects them at boot.
- App keeps sleeping — that's the free tier. Keep-alive pings work, or upgrade to Reserved VM for production.
- CORS error from custom domain — email info@vilow.dev with your hostname; we'll add it to the allow list.