- /v1/models:单值时长也输出 {"mode":"options","options":[N]},不再发 fixed
- 导入/同步校验只接受 options / range,fixed 分支删除,报错「时长模式仅支持 options / range」
- 渠道模型预览的 fixed 展示分支去掉
- 内部存储不变(durations 数组),历史模型与下单逻辑不受影响
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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