Add environment example and README

This commit is contained in:
2026-03-21 13:41:41 +08:00
parent ec8830f372
commit 70e28fbfa4
2 changed files with 33 additions and 0 deletions

3
.env.example Normal file
View File

@@ -0,0 +1,3 @@
FLOW2API_BASE_URL=https://flow2api.imbytecat.com/v1
FLOW2API_API_KEY=
FLOW2API_MODEL=gemini-3.0-pro-image-landscape

30
README.md Normal file
View File

@@ -0,0 +1,30 @@
# nano-banano
To install dependencies:
```bash
bun install
```
Set up your environment:
```bash
cp .env.example .env
```
To run:
```bash
bun run src/index.ts "A tiny banana robot exploring a neon greenhouse"
```
What it does:
- Reads `FLOW2API_BASE_URL`, `FLOW2API_API_KEY`, and `FLOW2API_MODEL` from `.env`
- Accepts either a root endpoint or a `/v1` endpoint and normalizes root URLs to the OpenAI-compatible `/v1` base URL automatically
- Also accepts older `GEMINI_MODEL` and `OPENAI_MODEL` env names for compatibility
- Uses AI SDK's `streamText` for streaming text, then downloads the generated image from the streamed Markdown image link
- Saves the generated image into `images/` with a timestamp-based filename
- Keeps runtime code under `src/` and uses the `@/*` TypeScript alias for internal imports
This project was created using `bun init` in bun v1.3.11. [Bun](https://bun.com) is a fast all-in-one JavaScript runtime.