Files
image2api/backend
chiyiandDevin 8b85d5623a feat(showcase): 去掉 Bento 灵感类型,只保留 hero / work
后端校验、分组、后台列表,以及后台页面与首页取图都只认
hero 和 work;启动时清掉遗留的 bento 记录。

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-10-27 15:57:12 +08:00
..

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 storage
  • internal/service/v1.go — channel-weighted dispatch, billing, job lifecycle, stale-job resume
  • internal/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