Skip to main content

MemFlow Relay

Research Preview — MemFlow Relay is currently in research preview. APIs and behaviours may change without prior notice.

MemFlow Relay is a local HTTP proxy for Gemini API requests, developed by LamoonAGI. It transparently intercepts your Gemini calls and — depending on the configured operating mode — can analyse, optimise, or shadow-test context window usage before forwarding the request to Google Gemini.


Features

  • Shadow mode — observe without modification; original request is always forwarded unchanged.
  • Safe mode — apply optimizations only when confidence is high; fall back to original on any doubt.
  • Optimize mode — apply MemFlow context optimizations and track token savings.
  • Fail-open default — if the MemFlow optimizer is unreachable or times out, the relay always forwards the original request to Gemini.
  • Credential isolation — GEMINI_API_KEY never leaves your machine; it is never sent to LamoonAGI or MemFlow cloud services.
  • Secret redaction — all logs, exceptions, and telemetry automatically strip API keys, Bearer tokens, and cookies.
  • Telemetry modes — off, metrics_only (default, no prompt content), or diagnostic.

Installation

pip install memflow-relay

Requires Python ≥ 3.11.


Quick Start

# Set credentials
export MEMFLOW_API_KEY="lago_your_key_here"
export GEMINI_API_KEY="your_gemini_key_here"

# Start relay in shadow mode (safe default)
memflow-relay serve

# Verify setup
memflow-relay doctor

# Show live stats
memflow-relay stats

Your Gemini SDK base URL should be set to http://127.0.0.1:8765.


CLI Commands

Command Description
memflow-relay serve Start the local proxy (default port 8765)
memflow-relay doctor Verify credentials, connectivity, and port availability
memflow-relay test Run end-to-end shadow mode verification
memflow-relay stats Display analyzed / optimized / bypassed counts and token savings
memflow-relay benchmark Run baseline vs optimized Gemini workload comparison
memflow-relay version Report package version and research preview status

Configuration

All configuration is via environment variables. See .env.example for a full reference.

Variable Default Description
MEMFLOW_API_KEY — LamoonAGI API key (required for optimize/safe modes)
GEMINI_API_KEY — Google Gemini API key (never sent to LamoonAGI)
MEMFLOW_API_URL https://api.lamoonagi.com MemFlow optimizer endpoint
MEMFLOW_MODE shadow Operating mode: shadow, safe, optimize
MEMFLOW_TELEMETRY metrics_only Telemetry level: off, metrics_only, diagnostic
MEMFLOW_PORT 8765 Local proxy port
MEMFLOW_FAIL_OPEN true Forward original request if optimizer fails

Security

See SECURITY.md for vulnerability disclosure policy.

Key guarantee: GEMINI_API_KEY is used exclusively to authenticate requests to generativelanguage.googleapis.com. It is never included in requests to api.lamoonagi.com or any other endpoint.


License

MIT — see LICENSE.

© 2024 LamoonAGI. MemFlow is a product of LamoonAGI. Powered by LamoonAGI Context VMM technology.

Metadata

Release files for memflow-relay 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for memflow-relay 0.1.0
File Size Uploaded
memflow_relay-0.1.0.tar.gz 25.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for memflow-relay 0.1.0
File Interpreter ABI Platform
memflow_relay-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 49.3 kB

Release files / memflow_relay-0.1.0.tar.gz

Download URL memflow_relay-0.1.0.tar.gz
Size 25.8 kB
Tags Source
SHA-256 checksum
How to use checksums
8658553e2a41e130245bd9f0a1e16a9af5eb1def45747cd6896ce9d3a068d3e6
BLAKE2b-256 checksum
How to use checksums
5ba7d5e584578870e39ac6c93ae6e2d3b9e315ee099d2feee0ac71d971191a52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.

Transparency log

Release files / memflow_relay-0.1.0-py3-none-any.whl

Download URL memflow_relay-0.1.0-py3-none-any.whl
Size 23.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
40d0959746bba824439024aedafb54116676e394abaeab2253f2e49752a82826
BLAKE2b-256 checksum
How to use checksums
87154310b2d62e68e39d394ffb63ef7f38fd556466f61f2a38734ac40a01a1ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.2

2 release files

0.1.1

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page