Modern Text-to-Image Generation Web App
A sleek, dark-mode AI image generator with multiple providers,
batch generation, and one-click deployment to Cloudflare Pages.
- Multiple AI Providers - A4F, Gitee AI, HuggingFace Spaces, ModelScope
- Dark Mode UI - Gradio-style with frosted glass effects
- Flexible Sizing - Multiple aspect ratios (1:1, 16:9, 9:16, 4:3, etc.)
- Secure Storage - API keys encrypted with AES-256-GCM
- Token Rotation - Multiple API keys with automatic failover on rate limits
- History (Lightweight) - Stores metadata (URL + params) in localStorage with 24h TTL
- Flow Mode - Visual canvas for batch generation (experimental)
- Images are referenced by remote URLs (no blob caching)
- Flow state is persisted locally
Support multiple API tokens per provider for automatic rotation when hitting rate limits (429 errors).
Enter multiple tokens in the API settings, separated by English commas (,):
token_1, token_2, token_3
Note: You must use English comma (
,), Chinese comma (,) will not work.
- Uses the first available token to make API requests
- When a 429 (rate limit) error occurs, automatically switches to the next token
- Exhausted tokens are tracked and skipped for the rest of the day
- Token status resets daily at UTC 00:00
- UI shows real-time token statistics (total/active/exhausted)
- Node.js 18+ / pnpm 9+
- Gitee AI API Key
- A4F API Key (optional)
- Register / login at https://www.a4f.co/
- Create an API key in the A4F dashboard (see docs): https://www.a4f.co/docs
- In Zenith Settings, select provider
A4Fand paste the key into the Token field
Notes:
- A4F requires a provider-prefixed model id (e.g.
provider-4/imagen-3.5). Zenith exposes these in the model dropdown. - If you call the OpenAI-compatible endpoint directly, use
model: "a4f/provider-4/imagen-3.5"andAuthorization: Bearer a4f:<token>.
See Deployment Guide for detailed instructions.
git clone https://github.com/WuMingDao/zenith-image-generator.git
cd zenith-image-generator
pnpm install
# Configure environment
cp apps/web/.env.example apps/web/.env
# Terminal 1
pnpm dev:api
# Terminal 2
pnpm dev:webOpen http://localhost:5173
After deployment, you can call the OpenAI-format API directly:
curl -X POST https://your-project.pages.dev/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer gitee:your-gitee-api-key" \
-d '{
"model": "gitee/z-image-turbo",
"prompt": "a cute cat",
"size": "1024x1024",
"steps": 9,
"n": 1,
"response_format": "url"
}'Notes:
- The API returns the raw provider image URL (e.g. HuggingFace Space
gradio_api/file=...). - Some provider URLs are temporary (HF Space files often expire around 24 hours).
- Provider routing is via the
modelprefix:a4f/...-> A4F (Authorization: Bearer a4f:...)gitee/...-> Gitee AI (Authorization: Bearer gitee:...)ms/...-> ModelScope (Authorization: Bearer ms:...)- no prefix -> HuggingFace (token optional;
Authorization: Bearer <token>orAuthorization: Bearer hf:<token>)
📖 Full API Reference - Providers, parameters, code examples
| Doc | Description |
|---|---|
| Contributing | Local setup, LAN access, development |
| Deployment | Cloudflare, Vercel, Netlify guides |
| API Reference | Endpoints, parameters, code examples |
| Providers & Models | All providers and model details |
Browser ──HTTPS──→ Cloudflare Workers ──HTTPS──→ AI Provider (Gitee/HuggingFace)
↑ ↑
AES-256-GCM Proxy Layer
encrypted (your deployment)
- Local Encryption: API keys are encrypted with AES-256-GCM before storing in localStorage
- Transport Security: All communications use HTTPS encryption
- Proxy Architecture: Your keys are sent to your own Workers, not directly to AI providers
Important: If you use someone else's deployed instance, the operator can potentially access your API keys.
This is because:
- The deployment owner can add logging code to capture request headers
- You cannot verify what code is actually deployed (even if the repo is open source)
- Cloudflare provides tools like
wrangler tailthat can inspect live requests
Recommendations:
| Scenario | Risk Level | Recommendation |
|---|---|---|
| Self-hosted deployment | ✅ Safe | Full control over your keys |
| Third-party instance | Use disposable/low-balance keys only | |
| Unknown source | ❌ Unsafe | Do not enter valuable API keys |
For maximum security, always deploy your own instance.
| Layer | Tech |
|---|---|
| Frontend | React 19, Vite, Tailwind CSS, shadcn/ui |
| Backend | Hono (TypeScript) |
| Deploy | Cloudflare Pages, Vercel, Netlify |
MIT