Repository navigation
An OpenAI-compatible endpoint backed by a Gemini Canvas tab. Canvas runs your
page in a sandboxed iframe and authenticates the calls it makes; this project
carries a request there and back.
What's new
Streaming is real. Responses are forwarded as Gemini produces them instead
of being buffered and replayed as one chunk. The first token arrives when the
model produces it, and the timeout applies between events rather than to the
whole response.
The status means something. The panel reports three links separately — the
page, the extension relay, the native host — each from evidence about that link.
The host counts as connected once it announces itself, and a heartbeat demotes
the relay when it stops answering.
Speech. gemini-2.5-flash-preview-tts and gemini-2.5-pro-preview-tts work
through the same endpoint. Pass voice, get a WAV in message.audio.
Media in. Images, audio, video and PDF: any data URI whose type Gemini
accepts inline, OpenAI input_audio parts, and file parts carrying base64.
The panel. Model name read from the request, tokens split into input and
output, request and response behind toggles, generated images rendered inline,
and a player for speech.
Fixed
- Chrome passes the calling origin to a native host as a positional argument;
the parser rejected it, so the host exited on every start. - The page handed its port to
window.parent, which is not always the page
holding the relay. - Canvas renders the preview more than once; both copies claimed the same port.
- A frame with no relay answered "not connected" before the frame with the relay
could answer. - Requests routed to a tab with no relay waited out the full timeout.
- A dropped relay left the page offline for good: the retry fired once and
stopped instead of starting a new handshake. - Several system messages collapsed to the last one;
content: nullon a
tool-call turn crashed; parts without atextfield raised. - Tool results truncated at 5,000 characters without saying so. The limit is
PROXY_TOOL_RESULT_MAX_CHARSand the marker states the loss. response_format: json_schemanow maps toresponseSchema.- HTTP/1.0 only, HTML 404s, and a
/healththat reported "disconnected" in
bare-metal mode, where the connection is stdio. - The documented VPS command failed: Compose appends port lists, so the
all-interfaces bind collided with the loopback one. --start-pageis not a Chromium flag; the container never opened Gemini.setup.sh --listmodified the install, andsetup.ps1resolved a null
interpreter when onlypython3was present.toggle-vnc.shnever made it into the image, so the documented
podman exec … toggle-vnc.sh stopfailed.setup.shtold you the page would read "native host offline". It reads
"Host offline".
Removed
--standalone. It printed a banner and returned, which ended the process and
took the HTTP server with it. --http-only covers the case.
Upgrading
- Replace
extension/and reload it atchrome://extensions. - Re-paste
canvas-proxy.htmlinto the Canvas. - Re-run
./setup.sh(or.\setup.ps1). It rewrites the manifests, the
interpreter wrapper and the token; clients keep the same port, endpoints and
bearer token. - Restart the browser, or rebuild the container.
Tests
54 tests, standard library only:
python3 -m unittest discover -s tests -vTranslation, the HTTP surface, streaming, error shapes, chunk reassembly, and
the native messaging protocol against the real binary. CI runs them on Python
3.8 and 3.12 and checks the documentation against the source.
MIT licensed.