add api key settings and agent docs

This commit is contained in:
2026-05-09 17:34:24 +08:00
parent 2563ab8f70
commit 57287cbc67
5 changed files with 444 additions and 44 deletions

View File

@@ -29,6 +29,23 @@ The UI runs on port `3000`. The HTTP API runs separately on port `3002`.
3. Check the API:
`http://localhost:3002/api/health`
You can change the server API key without restarting:
```bash
curl -X POST http://localhost:3002/api/config/api-key \
-H "Content-Type: application/json" \
-d "{\"apiKey\":\"YOUR_GEMINI_API_KEY\",\"persist\":true}"
```
You can also pass a temporary Gemini key for one call:
```bash
curl -X POST http://localhost:3002/api/generate \
-H "Content-Type: application/json" \
-H "x-gemini-api-key: YOUR_GEMINI_API_KEY" \
-d "{\"prompt\":\"Create a clean product poster\"}"
```
### API examples
Generate or edit with JSON/base64:
@@ -58,3 +75,5 @@ curl -X POST http://localhost:3002/api/analyze-document \
```
Optional API auth: set `API_AUTH_TOKEN`, then send either `Authorization: Bearer <token>` or `x-api-key: <token>`.
For Agent-facing image editing instructions, see `API图片修改-Agent.md`.