feat: move base URL, API key, and model to server .env

- BASE_URL, API_KEY, MODEL now read from process.env (Bun auto-loads .env)
- requireEnv() fails fast at startup if any is missing
- request body simplifies to { prompt, size, referenceImages? }
- client drops the three fields from form and localStorage
- add .env.example as the variable-name source of truth
- AGENTS.md notes the 0.0.0.0 bind now exposes the upstream quota to
  anyone reachable on the network
This commit is contained in:
2026-05-18 23:28:12 +08:00
parent 4ef2f1ba2b
commit d5bbc14c8d
5 changed files with 64 additions and 62 deletions
+10 -28
View File
@@ -196,31 +196,13 @@
</p>
<div class="panel">
<div class="grid">
<div class="row">
<label for="baseURL">Base URL</label>
<input
id="baseURL"
type="text"
placeholder="https://api.openai.com/v1"
/>
</div>
<div class="row">
<label for="apiKey">API Key</label>
<input id="apiKey" type="password" placeholder="sk-..." />
</div>
<div class="row">
<label for="model">Model</label>
<input id="model" type="text" placeholder="gpt-image-2" />
</div>
<div class="row">
<label for="size">Size</label>
<select id="size">
<option value="1024x1024">1024x1024 (square)</option>
<option value="1536x1024">1536x1024 (landscape)</option>
<option value="1024x1536">1024x1536 (portrait)</option>
</select>
</div>
<div class="row">
<label for="size">Size</label>
<select id="size">
<option value="1024x1024">1024x1024 (square)</option>
<option value="1536x1024">1536x1024 (landscape)</option>
<option value="1024x1536">1024x1536 (portrait)</option>
</select>
</div>
<div class="row">
<label for="prompt">Prompt</label>
@@ -243,9 +225,9 @@
<span id="status" class="status"></span>
</div>
<details>
<summary>Settings are stored in your browser's localStorage</summary>
Base URL, API Key, model and size are saved locally. They are sent to
the local Bun server only when you click Generate.
<summary>Size and prompt are saved to your browser's localStorage</summary>
Base URL, API key and model live in the server's <code>.env</code>
they are never sent from the browser.
</details>
</div>