Repository navigation
M4a: forward AI chat to Gecko Suite behind AI_BACKEND - #213
Merged
Merged
Conversation
With AI_BACKEND=suite the six proxy functions (blocking and streaming, Anthropic, OpenAI-compatible, Ollama) still resolve the caller's provider row, then send the vendor and model to the suite's /ai/proxy/* as Notes on the user's behalf. The suite holds the key and records usage; Notes records none. local stays the default. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V1geD2ELWgL2sDpxYbx3Aw
davior
marked this pull request as ready for review
November 4, 2026 06:05
This was referenced Nov 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Notes' side of M4a (the suite's SN-1 and SN-7). With
AI_BACKEND=suite, the six proxy functions inrouters/settings.py(blocking and streaming, for Anthropic, OpenAI-compatible and Ollama) forward to the suite's/api/v1/ai/proxy/*(davior/gecko-suite#8).localstays the default and its code path is untouched, so this is reversible with one variable.app/suite.py. The frontend, the assistant worker and theon_deltawatching for long planning calls are unchanged: the routes still answer in the shapes they always did (the same dicts, anddelta/final/errorframes).X-Gecko-App: notes, secret,X-On-Behalf-Of), never with the browser's token, because a worker's call outlives its request.suite_unavailable(or anerrorframe when streaming) with a sentence. Nothing else in Notes depends on the suite.AI_BACKEND=suitewithoutSUITE_APP_SECRET(or an unknown value) refuses to start, rather than failing every chat.Not in this PR: speech, image generation and web search (SN-2) and the Settings pages (SN-5). They still use Notes' own keys.
Differences someone may notice in suite mode: errors from the vendor arrive as the suite's
{code, message}rather than the vendor's raw text; cache reads and writes are priced at their own rates; OpenAI's own models are sentmax_completion_tokens; the provider'sextra_paramscome from the suite's copy.Test plan
pytest -qinbackend/: 1361 passed, 1 skipped (on Python 3.13 locally; CI uses 3.11). 10 new intests/test_suite_proxy.py, through the real routes and middleware with a fake suite transport: forwarded request shape and credentials, no usage written, all three protocols, frame-for-frame streaming, refusal before streaming, suite down, ownership/protocol checks, workeron_delta, local mode never calls the suite, startup validation.Deployment
Nothing changes until
AI_BACKEND=suiteis set, so this can be deployed first.noteson the suite's Apps screen and copies the secret, which is shown once..env, defaults shown in.env.example):AI_BACKEND=local(setsuiteto switch),SUITE_BASE_URL=https://suite.geckopico.com,SUITE_APP_ID=notes,SUITE_APP_SECRET(required withsuite; the app refuses to start without it).docker compose up --build -d). No migration, no frontend change, no Caddy change.curl -f http://localhost:18081/api/health; withsuite, send a chat in the app and see it in the suite's Usage view under appnotes.AI_BACKEND=localanddocker compose up -d; nothing was written locally in suite mode.Generated by Claude Code