Files
image2api/backend
chiyiandDevin 539c251f9f feat(logs): 日志页搜索合并为单个搜索框
后端新增 /logs?kw=:命中提示词/模型/错误,或命中用户
(名称/邮箱/ID) 的记录均保留;前端两个搜索框合并为一个。
首页导航恢复 ✦ 品牌小星标,与其他页一致。

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

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-10-27 16:43:34 +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