@heylemon/lemonade 0.4.10 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/build-info.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
095be0769244f46020c935adb52b83f602459c8318e55f7513862d7abb51c029
|
package/dist/infra/path-env.js
CHANGED
|
@@ -61,6 +61,8 @@ function candidateBinDirs(opts) {
|
|
|
61
61
|
const miseShims = path.join(miseDataDir, "shims");
|
|
62
62
|
if (isDirectory(miseShims))
|
|
63
63
|
candidates.push(miseShims);
|
|
64
|
+
// Portable Node.js install managed by Lemon macOS app.
|
|
65
|
+
candidates.push(path.join(homeDir, ".lemonade", "node", "bin"));
|
|
64
66
|
candidates.push(...resolveBrewPathDirs({ homeDir }));
|
|
65
67
|
// Common global install locations (macOS first).
|
|
66
68
|
if (platform === "darwin") {
|
package/package.json
CHANGED
|
@@ -25,7 +25,8 @@ uv run {baseDir}/scripts/generate_image.py --prompt "combine these into one scen
|
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
API key
|
|
28
|
-
- `
|
|
28
|
+
- Automatically routed through the Lemonade backend proxy when `LEMON_BACKEND_URL` and `GATEWAY_TOKEN` are set (API key stays server-side)
|
|
29
|
+
- Or `GEMINI_API_KEY` env var for direct access
|
|
29
30
|
- Or set `skills."nano-banana-pro".apiKey` / `skills."nano-banana-pro".env.GEMINI_API_KEY` in `~/.lemonade/lemonade.json`
|
|
30
31
|
|
|
31
32
|
Notes
|
|
@@ -29,6 +29,15 @@ def get_api_key(provided_key: str | None) -> str | None:
|
|
|
29
29
|
return os.environ.get("GEMINI_API_KEY")
|
|
30
30
|
|
|
31
31
|
|
|
32
|
+
def get_proxy_config() -> tuple[str | None, str | None]:
|
|
33
|
+
"""Get backend proxy URL and gateway token for server-side API key routing."""
|
|
34
|
+
backend_url = os.environ.get("LEMON_BACKEND_URL", "").rstrip("/")
|
|
35
|
+
gateway_token = os.environ.get("GATEWAY_TOKEN", "")
|
|
36
|
+
if backend_url and gateway_token:
|
|
37
|
+
return f"{backend_url}/api/lemonade/proxy/gemini", gateway_token
|
|
38
|
+
return None, None
|
|
39
|
+
|
|
40
|
+
|
|
32
41
|
def main():
|
|
33
42
|
parser = argparse.ArgumentParser(
|
|
34
43
|
description="Generate images using Nano Banana Pro (Gemini 3 Pro Image)"
|
|
@@ -63,22 +72,30 @@ def main():
|
|
|
63
72
|
|
|
64
73
|
args = parser.parse_args()
|
|
65
74
|
|
|
66
|
-
#
|
|
75
|
+
# Prefer backend proxy (API key stays server-side), fall back to local key
|
|
76
|
+
proxy_url, gateway_token = get_proxy_config()
|
|
67
77
|
api_key = get_api_key(args.api_key)
|
|
68
|
-
|
|
69
|
-
|
|
78
|
+
|
|
79
|
+
if not proxy_url and not api_key:
|
|
80
|
+
print("Error: No API key or backend proxy available.", file=sys.stderr)
|
|
70
81
|
print("Please either:", file=sys.stderr)
|
|
71
|
-
print(" 1.
|
|
72
|
-
print(" 2.
|
|
82
|
+
print(" 1. Set LEMON_BACKEND_URL + GATEWAY_TOKEN (backend proxy)", file=sys.stderr)
|
|
83
|
+
print(" 2. Provide --api-key argument", file=sys.stderr)
|
|
84
|
+
print(" 3. Set GEMINI_API_KEY environment variable", file=sys.stderr)
|
|
73
85
|
sys.exit(1)
|
|
74
86
|
|
|
75
|
-
# Import here after checking API key to avoid slow import on error
|
|
76
87
|
from google import genai
|
|
77
88
|
from google.genai import types
|
|
78
89
|
from PIL import Image as PILImage
|
|
79
90
|
|
|
80
|
-
|
|
81
|
-
|
|
91
|
+
if proxy_url:
|
|
92
|
+
print(f"Using backend proxy for Gemini API")
|
|
93
|
+
client = genai.Client(
|
|
94
|
+
api_key=gateway_token,
|
|
95
|
+
http_options=types.HttpOptions(api_endpoint=proxy_url),
|
|
96
|
+
)
|
|
97
|
+
else:
|
|
98
|
+
client = genai.Client(api_key=api_key)
|
|
82
99
|
|
|
83
100
|
# Set up output path
|
|
84
101
|
output_path = Path(args.filename)
|