XEN · Model Gateway

Plug any tool into XEN

An OpenAI-compatible API backed by your logged-in Claude Code — no separate API key, no console. Any "bring your own model" (BYOM) tool points at it and XEN answers. Plus a file webhook so any file reaches the brain.

Connection

Base URLhttp://100.80.76.79:8020/v1 (Nitro · Tailscale mesh)
Modelxen  (or xen-warm)
API keyyour XEN_API_TOKEN (from secrets.env) — sent as Authorization: Bearer <token>. Never share it.
Backed byclaude on Nitro (E:\.local\bin\claude.exe, config E:\.claude) — your subscription, your session.
Reachable on your Tailscale mesh only (not the public internet). Devices off the mesh can't hit it yet — a public route is the next step. The token is required: the gateway is NOT open.

Endpoints

GET/healthliveness — returns {ok:true, mode}. No auth.
GET/v1/modelslists xen, xen-warm. No auth.
POST/v1/chat/completionsstandard OpenAI chat completion (supports stream:true SSE). Auth required.
POST/media-injectsend ANY file to the brain. JSON {filename, contentType, caption, b64} (b64 = base64 of the bytes). Auth required.

Chat completion

# non-streaming
curl http://100.80.76.79:8020/v1/chat/completions \
  -H "Authorization: Bearer $XEN_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"model":"xen","messages":[{"role":"user","content":"hello"}]}'

# streaming (SSE)
curl -N http://100.80.76.79:8020/v1/chat/completions \
  -H "Authorization: Bearer $XEN_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"model":"xen","stream":true,"messages":[{"role":"user","content":"hi"}]}'

Plug a BYOM tool in

OpenAI base URLhttp://100.80.76.79:8020/v1
API key fieldpaste your XEN_API_TOKEN
Model fieldxen
Resultthe tool thinks it's calling an API; it's really hitting your live Claude Code.

File webhook (media-inject)

curl http://100.80.76.79:8020/media-inject \
  -H "Authorization: Bearer $XEN_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"filename":"note.pdf","contentType":"application/pdf","caption":"for xen","b64":"<base64>"}'
Saves the file on the brain box and notifies XEN to read it. This is what the desk PWA (/desk) and the "Xen Send File" iOS Shortcut post to.

Modes

fork (default)each call runs claude -p — shares your identity/memory, fresh per-call context, cannot disturb your live session. In use now.
sessionroutes the call through your ONE live warm session (same context, like an MCP). Built, off by default — flip with XEN_GW_MODE=session when you want it.