mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #5746] [Feature]: Add Civitai (Orchestration API) as a native Image Generation service #3176
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#3176
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @rabbit-of-caerbannog on GitHub (Sep 2, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5746
What problem does this solve?
Marinara supports a wide range of image backends, but not Civitai. Civitai is
where a lot of this userbase already goes for checkpoints, LoRAs and character
art, and its Orchestration API will run generation on Civitai's GPUs — so a
user with no local VRAM, no checkpoint downloads and no disk headroom can still
generate images, against the exact model catalogue they already browse.
Today the only way to reach it from Marinara is an out-of-tree sidecar.
Proposed solution
A native
civitaiimage service, sitting alongside the other cloud services(Venice, Z.AI, Atlas):
IMAGE_GENERATION_SOURCES(packages/shared/src/constants/model-lists.ts)case "civitai":in thegenerateImageUncappeddispatch and theEXPLICIT_IMAGE_SOURCESset (packages/server/src/services/image/image-generation.ts)civitai-image.tsservice, roughly the shape ofvenice-image.tsbut witha poll loop, since Orchestration is job-based rather than synchronous
connections.routes.tsAs far as I can tell this needs no new connection type, no schema migration and
no new secret handling — Orchestration authenticates with
Authorization: Bearer <token>, which is the shapeapiKeyEncryptedalreadycarries, and
imageServiceis a free-form string column.Alternatives considered
An A1111-shaped sidecar, which is what I actually run: a small local server
on
:7860that answers the four SDAPI endpoints Marinara calls(
/sdapi/v1/options,/sdapi/v1/sd-models,/sdapi/v1/txt2img,/sdapi/v1/img2img) and translates each request into a Civitai workflow.This works today with an unmodified Marinara, and I want to note that it works
because of choices already made here — the top-level
modelfield added fornon-A1111 SDAPI routers (#2817),
inferImageSourcetreating:7860asautomatic1111, andautomatic1111being inLOCAL_IMAGE_BACKENDSso loopbackURLs pass the SSRF guard. So this is not a bug report; the escape hatch is real
and it's good.
It's just a second process to run, and it can only express what the A1111 API
can express.
Additional context
I'm not claiming this work and I'm not planning to open a PR — I'm staying
on the sidecar. I'm filing this so the field notes are on the record for
whoever picks it up, if anyone does. Everything below is something I got wrong
first and fixed against the live API.
Traps in the Civitai Orchestration API
sourceImageDenoiseStrenght. The denoise field is misspelled inCivitai's API. Spelling it
...Strengthis silently ignored and you get thedefault denoise, which looks like "img2img isn't respecting my strength
slider" rather than a typo.
There is no img2img endpoint. A
textToImagestep withsourceImageset is the img2img path.
sourceImageaccepts a URL, a data URI or rawbase64. Worth knowing that Marinara sends
init_images[0]as either a barebase64 string or a
data:URL depending on how the reference reached therequest, so it needs normalising.
Dimensions must be divisible by 64. Anything else is rejected outright.
This bites Marinara specifically: the default background/game size is
1280x720, and 720 is not a multiple of 64. Snap to the nearest multiple.
allowMatureContentis a body field on the workflow. There is a queryparameter of the same name and it is ignored. Setting only the query param
gets you safe-mode results with no error to explain why.
Polling: unknown status means "keep waiting", not "failed". Only treat
succeeded/failed/expired/canceled/cancelledas terminal. Ioriginally treated anything unrecognised as a failure and it broke on
preparing. Statuses get added over time, so an allowlist of terminalstates is the safe read.
Tolerate transient poll failures. A 5xx or a dropped connection while
polling does not mean the job died — it's still running on Civitai's side.
Swallow it and retry until your deadline; only let 4xx (bad id, auth)
propagate. Aborting on the first hiccup kills jobs that would have finished.
Result URLs 301 before the blob. Follow redirects, and keep the
Authorizationheader on. Also gate on the image'savailableflag beforedownloading.
outputFormatdefaults to jpeg. Marinara hardcodesimage/pngon everyA1111-shaped reply, so it's worth asking for
pngexplicitly to keep thedeclared type honest.
LoRA weights parse from the right. Using the A1111
<lora:NAME:weight>convention with a Civitai AIR as the name means the name itself contains
colons (
urn:air:sdxl:lora:civitai:1234@5678). Split the weight off theright-hand side, not the first colon.
The scheduler enum is not the A1111 sampler list. Several common A1111
sampler names are rejected rather than approximated, so they need mapping
to a near neighbour before the request goes out.
Cost note
Generation spends Buzz, and mature requests bill against yellow (purchased)
Buzz while safe ones use blue (free) Buzz. That's a per-user billing
consideration, same category as NovelAI's Anlas.
References
Template check
@Gunterlie commented on GitHub (Sep 2, 2026):
I will close this for now, we will revisit when the Lead Dev is back from Vacation :)
See also Info here: https://github.com/Pasta-Devs/Marinara-Engine/issues/5779