OpenCode's @ai-sdk/openai-compatible sends stream:true and would render an
empty response because the adapter always returned a single non-streaming
chat.completion JSON body. Now when stream:true, emit OpenAI-compatible SSE
chat.completion.chunk events (role, content, [DONE]) so streaming clients
render text. Non-streaming path unchanged.
Adds a local EchoServer test that exercises the streaming route end-to-end.
A browser opening /admin can't send an Authorization header, so the
admin page was unreachable (401 blank). Serve the HTML form openly — it
exposes no data — and let the in-page ADMIN_API_KEY field drive the
auth'd /admin/agents CRUD calls.
The Elixir release's start script reads releases/COOKIE which isn't baked
in, so the service crashed on boot (cat: releases/COOKIE: No such file).
Set RELEASE_COOKIE in the systemd Environment to fix startup.
The store now starts empty and agents are added/removed exclusively through
the web admin page / admin API, persisted to AGENTS_FILE. No AGENTS env var
needed in the sops secret.
GET /admin serves a self-contained HTML page (ADMIN_API_KEY protected)
that lists agents and lets you add/update/remove them via the admin API —
no redeploy needed to add an agent.
- AgentRegistry is now file-backed (AGENTS_FILE, default
/var/lib/n8n-openai/agents.json): agents persist across restarts and
can be added/removed without a redeploy.
- New admin endpoints (separate ADMIN_API_KEY):
GET /admin/agents
POST /admin/agents {model, webhook}
DELETE /admin/agents/:model
- AGENTS env only seeds the store on first boot; the file is authoritative.
- NixOS module sets AGENTS_FILE under the writable StateDirectory.
Export nixosModules.default so the service (systemd unit, service user,
sops secret) is defined in the flake, not re-declared in each host config.
Consume with imports = [ inputs.n8n-openai-adapter.nixosModules.default ]
+ services.n8n-openai-adapter = { enable = true; domain = ...; port = ...; }.
Exposes self-hosted n8n chat agents behind /v1/chat/completions and
/v1/models. Model -> n8n webhook routing via a GenServer registry, so
multiple agents map to multiple models. Plug + Bandit, req for the
n8n webhook call, Bearer auth (ADAPTER_API_KEY). Ships a flake.nix
(beamPackages.mixRelease) so it can be consumed as a NixOS flake input.