Agent Chat (browser → LLM endpoint)
Your key stays in sessionStorage (this tab only). Requests go straight from your browser to the endpoint below — nothing passes through an HF server. Default is Muse Spark 1.3 Contributor via OpenRouter (same weights as standard, ~$0.10/$0.20 per 1M tokens; Meta may train on the data). For coding-agent behavior, keep the system prompt strict and paste file contents into chat (Static has no filesystem).
Scheduler (export; Static can't run jobs alone)
Honest limitation: a Static Space is just HTML/JS — no Python, no cron, no background process. A tab left open can poll with setInterval, but real always-on scheduling needs (a) the Docker upgrade, (b) your Windows Task Scheduler running opencode, or (c) HF Jobs / an external cron hitting an endpoint. Build tasks here, export them, paste into the backend later. Tasks save to localStorage in this browser.
| Name | Cron | Prompt |
|---|
# add a task to preview exports
Backend wiring (when you upgrade)
# supercronic crontab (Docker Method 2) — mounts tasks.json, calls your agent endpoint
0 */6 * * * curl -sf -X POST http://127.0.0.1:4096/run-task -H 'Content-Type: application/json' -d @/data/tasks.json >>/var/log/agent-cron.log 2>&1
*/5 * * * * curl -sf https://sakibkhandokar31-opencode-agent.hf.space/ >/dev/null || true
Always-on / Uptime Pinger
Good news: this Static Space needs no pinger — Static needs no hardware, so there's nothing to sleep. Pingers matter once you move to Docker/Gradio compute.
| Target | URL to ping |
|---|---|
| Space page | https://huggingface.co/spaces/SakibKhandokar31/opencode-agent |
| Direct app | https://sakibkhandokar31-opencode-agent.hf.space/ |
When you upgrade to Docker/Gradio, do this
# 1) never-sleep (paid hardware only)
hf spaces settings SakibKhandokar31/opencode-agent --sleep-time -1
# 2) external pinger every 2-5 min GET / (UptimeRobot / cron-job.org / BetterUptime)
# 3) in-container self-ping as backup (supercronic):
*/5 * * * * curl -sf http://127.0.0.1:7860/ >/dev/null || true
A pinger can't conjure paid hardware. If the Space is stopped for billing/quota, pings just get error pages. Fix billing first, then ping.
Method 2: full Docker VNC (needs PRO / 30-day account / grant)
Tested Sep 12 on your account: Docker + cpu-basic → 402 PRO required; Docker + zero-a10g → Gradio-only; Gradio + zero-a10g → PRO or 30-day wait / grant. Your account (~Sep 7) hits the new-account gate. Path: keep this Static live now → ~Oct 7 retry ZeroGPU, or subscribe PRO, or request a community GPU grant (Space Community tab → “Apply for a GPU community grant: Personal project”).
Architecture (single port 7860)
7860 nginx ─┬─ / → opencode web (4096, `opencode serve --host 0.0.0.0 --port 4096`)
├─ /code/ → code-server (8080, browser VS Code — lighter than full VNC)
├─ /vnc/ → KasmVNC/noVNC (6901, Xfce) — heavy; skip unless you need a real desktop
└─ /healthz→ 200 (pinger target)
supercronic runs /data/tasks.json (bucket-mounted /data persists; container disk is wiped on restart)
secrets (ANTHROPIC_API_KEY / OPENAI_API_KEY / OPENCODE_API_KEY / HF_TOKEN) as Space Secrets, never baked in
USER 1000, COPY --chown=user, no GPU at build time
Minimal Dockerfile (opencode web, no desktop — start here)
FROM node:22-bookworm
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
WORKDIR /home/user/app
RUN npm i -g opencode-ai && pip install --no-cache-dir supervisor || true
COPY --chown=user . /home/user/app
EXPOSE 7860
CMD ["opencode","serve","--host","0.0.0.0","--port","7860"]
Full desktop (Xfce + KasmVNC + nginx + code-server + supercronic) is ~1.5 GB and slow to build — say the word after PRO/grant lands and I'll push that variant by flipping this Space's sdk: to docker.
Windows note
Your .exe can't run on Spaces (Linux only). Run the Linux opencode-ai build in the container, keep the Windows desktop app for local work, share tasks via tasks.json export above.