zenith-image-generator

WuMingDao活跃维护

多供应商 AI 图像生成器,支持 Gitee AI、HuggingFace、ModelScope 等后端,提供 OpenAI 兼容 API 与 token 轮换,可一键部署到 Cloudflare Pages。

Modern AI image generator with multi-provider support (Gitee AI, HuggingFace, ModelScope), OpenAI-compatible API, token rotation, and one-click deployment to Cloudflare Pages.

暂无版本225star120fork同步于 2026-11-11 00:02 UTC

怎么上手

由 README 提炼,执行前请确认
git clone https://github.com/WuMingDao/zenith-image-generator.git
cd zenith-image-generator
pnpm install
cp apps/web/.env.example apps/web/.env
pnpm dev:api
pnpm dev:web
硬件要求按 README 说明

README 未说明,仅要求 Node.js 18+ 与 pnpm 9+,推理在云端供应商完成

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

多供应商 AI 文生图 Web 应用,自带 OpenAI 兼容 API 与一键部署

多供应商 AI 图像生成器,支持 Gitee AI、HuggingFace、ModelScope 等后端,提供 OpenAI 兼容 API 与 token 轮换,可一键部署到 Cloudflare Pages。

核心能力

  • 接入 A4F、Gitee AI、HuggingFace、ModelScope 多供应商
  • 多 API Key 遇 429 自动轮换并按 UTC 每日重置
  • API Key 用 AES-256-GCM 加密后存 localStorage
  • 提供 OpenAI 格式 /v1/images/generations 接口
  • 支持一键部署到 Cloudflare Pages、Vercel、Netlify

容易踩的坑

多 token 必须用英文逗号分隔,中文逗号无效;本地开发需开两个终端分别跑 dev:api 和 dev:web,并先复制 .env.example;供应商返回的是原始图片 URL,HuggingFace Space 链接约 24 小时过期;使用他人部署实例时运营者可截获你的 API Key,建议自建

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

0 个版本

暂无 release 数据(可能没有发版,或尚未同步)。

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Zenith Image Generator

    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.

    中文 · Changelog · Live Demo

    Dark Mode UI Cloudflare Pages React Hono


    Features

    • 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

    Token Rotation

    Support multiple API tokens per provider for automatic rotation when hitting rate limits (429 errors).

    How to Use

    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.

    How It Works

    1. Uses the first available token to make API requests
    2. When a 429 (rate limit) error occurs, automatically switches to the next token
    3. Exhausted tokens are tracked and skipped for the rest of the day
    4. Token status resets daily at UTC 00:00
    5. UI shows real-time token statistics (total/active/exhausted)

    Quick Start

    Prerequisites

    A4F (api.a4f.co) API Key

    1. Register / login at https://www.a4f.co/
    2. Create an API key in the A4F dashboard (see docs): https://www.a4f.co/docs
    3. In Zenith Settings, select provider A4F and 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" and Authorization: Bearer a4f:<token>.

    One-Click Deploy

    Deploy to Cloudflare Deploy to Vercel Deploy to Netlify

    See Deployment Guide for detailed instructions.

    Local Development

    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:web
    

    Open http://localhost:5173

    📖 Full Development Guide

    API Usage

    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 model prefix:
      • a4f/... -> A4F (Authorization: Bearer a4f:...)
      • gitee/... -> Gitee AI (Authorization: Bearer gitee:...)
      • ms/... -> ModelScope (Authorization: Bearer ms:...)
      • no prefix -> HuggingFace (token optional; Authorization: Bearer <token> or Authorization: Bearer hf:<token>)

    📖 Full API Reference - Providers, parameters, code examples

    Documentation

    DocDescription
    ContributingLocal setup, LAN access, development
    DeploymentCloudflare, Vercel, Netlify guides
    API ReferenceEndpoints, parameters, code examples
    Providers & ModelsAll providers and model details

    Security

    How Your API Keys Are Protected

    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

    ⚠️ Third-Party Deployment Warning

    Important: If you use someone else's deployed instance, the operator can potentially access your API keys.

    This is because:

    1. The deployment owner can add logging code to capture request headers
    2. You cannot verify what code is actually deployed (even if the repo is open source)
    3. Cloudflare provides tools like wrangler tail that can inspect live requests

    Recommendations:

    ScenarioRisk LevelRecommendation
    Self-hosted deployment✅ SafeFull control over your keys
    Third-party instance⚠️ RiskyUse disposable/low-balance keys only
    Unknown source❌ UnsafeDo not enter valuable API keys

    For maximum security, always deploy your own instance.

    Tech Stack

    LayerTech
    FrontendReact 19, Vite, Tailwind CSS, shadcn/ui
    BackendHono (TypeScript)
    DeployCloudflare Pages, Vercel, Netlify

    Star History

    Star History Chart

    License

    MIT

    Acknowledgments