- README/README.en 重写:同构网关 + vivid 四端点 + 渠道同步/调度, 明确不支持 OpenAI 协议上游;移除账号池/七大平台/OpenAI 兼容描述 - backend/frontend README、.env.example 更新(补 RUSTFS/COOKIE_SECURE/ CHANNEL_SECRET) - docker-compose 增加 CHANNEL_SECRET(渠道 key AES-GCM 密钥) - 清掉代码注释/文档示例里的 OpenAI/gpt-image-2 残留 Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1.0 KiB
1.0 KiB
image2api backend
Go backend for image2api — a vivid-protocol gateway that routes generation
jobs across same-protocol upstream channels. Stack: Gin · GORM (PostgreSQL) ·
go-redis.
Architecture sketch
internal/upstream— vivid-protocol client (NDJSON generate + jobId resume,/v1/uploads,/v1/models,/v1/balance, error classification)internal/service/channel.go— channel CRUD, upstream model sync (save = full sync), AES-GCM key storageinternal/service/v1.go— channel-weighted dispatch, billing, job lifecycle, stale-job resumeinternal/http/handler/v1.go— public vivid endpoints (/v1/generate/v1/uploads/v1/models/v1/balance)
Environment
See .env.example. Required: POSTGRES_DSN, REDIS_ADDR, RUSTFS_*.
Important: CHANNEL_SECRET encrypts stored channel API keys (AES-GCM) — set a
random value and keep it stable; rotating it makes saved keys undecryptable.
cp .env.example .env # fill in values
go build -o bin/api ./cmd/api && ./bin/api