Skip to content

fix(lumo): use the 2.0 chat/completions generation endpoint - #12

Merged
major0 merged 4 commits into
major0:mainfrom
vejeta:fix/lumo-chat-completions-endpoint
Sep 23, 2026
Merged

major0 merged 4 commits into
major0:mainfrom
vejeta:fix/lumo-chat-completions-endpoint

Conversation

@vejeta

@vejeta vejeta commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Problem

lumo serve and lumo chat fail on every generation:

sse.request url=https://lumo.proton.me/api/ai/v1/chat appversion=web-lumo@2.0.2.9
sse.error  url=https://lumo.proton.me/api/ai/v1/chat status=404 code=404 message="Path not found"
Error: lumo: chat request: api: 404/404: Path not found

Proton retired the legacy PHP generation path ai/v1/chat (404 "Path not
found"). Login, masterkeys, spaces and conversations (all under lumo/v1)
still work and the account is eligible -- only generation moved. Through
lumo serve the 404 surfaces to clients as a generic 500 "Internal server
error".

Fix

Migrate Client.Generate to the Lumo 2.0 unified endpoint
ai/v1/chat/completions, which uses an OpenAI chat/completions-shaped
protocol:

  • Request: a messages array (role + encrypted content) plus a lumo
    extension carrying the PGP-wrapped request_key and request_id,
    stream: true, stream_options.include_usage, and reasoning_effort.
  • Response: a stream of choices[].delta chunks ending in [DONE],
    parsed back into the existing GenerationResponseMessage types
    (token_data / done / harmful / error).

The AES-GCM content and request-key encryption is reused unchanged; only the
request packaging and the SSE parsing differ. Terminal conditions map to the
existing sentinels (content_filter -> ErrHarmful; an error chunk or a
stream that ends without [DONE] -> ErrStreamClosed).

Verification

  • go test ./api/lumo/... passes (the Generate tests are rewritten for the
    new request/response format).
  • Live against the real API: lumo chat returns a reply, and the lumo serve
    OpenAI-compatible endpoint returns a completion
    (/v1/chat/completions -> {"choices":[{"message":{"content":"Hello"}...}]}).
  • Confirmed the fix is independent of the app-version: generation succeeds with
    the current web-lumo@1.3.3.4 in service_config.go, so no version bump is
    bundled here.

Notes

  • StreamProcessor / the legacy generation_request types are left in place
    (still exercised by their unit tests); they can be pruned separately.
  • Server-side tool-call/tool-result and image chunks are recognized and skipped
    (this client does not surface them).

Proton retired the legacy PHP generation path `ai/v1/chat`; it now returns
404 "Path not found", so every Generate call -- and therefore `lumo serve`
and `lumo chat` -- failed with a wrapped 500 "Internal server error". The
account is still eligible and the `lumo/v1` CRUD calls (masterkeys, spaces,
conversations) keep working; only generation moved.

Migrate Generate to the Lumo 2.0 unified endpoint `ai/v1/chat/completions`,
which speaks an OpenAI chat/completions-shaped protocol: the request carries a
`messages` array plus a `lumo` extension holding the PGP-wrapped request key
and its id, and the response streams `choices[].delta` chunks terminated by
`[DONE]`. The AES-GCM content and request-key encryption is reused unchanged;
only the request packaging and the SSE response parsing differ. Terminal
conditions map to the existing sentinels (content_filter -> ErrHarmful, an
error chunk / missing [DONE] -> ErrStreamClosed).

Verified end to end against the live API: `lumo chat` returns a reply and the
`lumo serve` OpenAI-compatible endpoint returns a completion.
@vejeta
vejeta force-pushed the fix/lumo-chat-completions-endpoint branch from e01a3fa to eabba25 Compare September 23, 2026 07:00
@major0
major0 merged commit 059e902 into major0:main Sep 23, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants