mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #7489] [MERGED] feat(image): add SpicyAPI image generation connections #7757
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#7757
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?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7489
Author: @SpicyMarinara
Created: 10/12/2026
Status: ✅ Merged
Merged: 10/12/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/spicyapi-image-generation📝 Commits (5)
bfcb1f3feat(image): add SpicyAPI image generation connectionsae0d4f0fix(image): wait for stored SpicyAPI results and tidy the editor changec69d3bbfix(image): stop SpicyAPI polling on a stateless reply or a long outage601371cfix(image): fit SpicyAPI references to its limits and survive dropped connections8f6eba6fix(image): omit SpicyAPI image_urls when every reference was skipped📊 Changes
8 files changed (+772 additions, -2 deletions)
View changed files
📝
docs/media/image-providers.md(+12 -0)📝
packages/client/src/components/connections/ConnectionEditor.tsx(+13 -2)📝
packages/client/src/localization/locales/en.json(+2 -0)📝
packages/server/src/routes/connections.routes.ts(+22 -0)📝
packages/server/src/services/image/image-generation.ts(+176 -0)➕
packages/server/src/services/image/spicyapi-image.ts(+196 -0)📝
packages/shared/src/constants/model-lists.ts(+16 -0)➕
scripts/regressions/spicyapi-image.regression.ts(+335 -0)📄 Description
Linked issue
Closes #7478
Why this change
Users couldn't get SpicyAPI (https://spicyapi.ai) to make images in Marinara. SpicyAPI's OpenAI-style address (
/v1) only handles chat and video, and it has no/v1/images/generations. A Custom image connection pointed at it had nothing to call. SpicyAPI makes images only through its own task API:POST /api/v1/jobs/createTask, thenGET /api/v1/jobs/recordInfountil the task finishes. Each model also declares its own input fields, for example an aspect ratio, a width and height, or a fixed size.What changed
spicyapi.aiBase URL and no saved service now uses the new SpicyAPI service instead of the OpenAI-compatible path. That path could never return an image from SpicyAPI, so nothing that worked before stops working. Connections whose saved service is OpenAI (DALL-E) are unchanged. They still can't make images until their service is switched to SpicyAPI.https://api.spicyapi.ai/api/v1, the modelalibaba/z-image-spicy-pro/text-to-image, and a link to the SpicyAPI console's key page.packages/server/src/services/image/spicyapi-image.tsandgenerateSpicyApiinimage-generation.ts):GET /api/v1/models/{model}) and sends only the fields that model declares. It picks the closest declaredaspect_ratioorsize, or awidth/heightfitted to the model's min, max and step.negative_promptfield, the negative prompt goes there. Otherwise it is added to the end of the prompt as text.image_urls(up to the model'smaxItems) orimage_url.sharpmodule. Extra references are then dropped from the end until the request fits. Each step logs a warning. Withoutsharp, an oversize reference is skipped. If every reference is skipped,image_urlsis left out rather than sent empty.input.?wait=50and anIdempotency-Key. If the connection drops before a reply, the same request is resent with the same key, up to 3 attempts. SpicyAPI answers a repeated key with the original task, so it isn't billed twice. Tasks still running after that are polled every 2 s, including a succeeded task whose result is still being stored.failed,canceledandexpiredtasks report SpicyAPI'serrorCodeanderrorMessage.GET /api/v1/models?modality=imagewith the key, which costs nothing. Fetch Models from API lists the account's available text-to-image and edit models.[debug/image/spicyapi] final request payloadgoes throughlogDebugOverrideandimagePayloadForLog. The API key is only ever in theAuthorizationheader and is never logged. Reference image bytes are redacted.docs/media/image-providers.md. Translation follow-up: #7491.scripts/regressions/spicyapi-image.regression.tsruns against a fake SpicyAPI server.Images only. SpicyAPI video is not part of this PR.
Validation
pnpm checkpasses locallyCONTRIBUTING.mdCommands run by the agent:
node ./scripts/run-regressions.mjs --filter scripts/regressions/spicyapi-image.regression.ts: passed. The fake SpicyAPI server checks:input;Idempotency-Keyandwait=50on task creation;Idempotency-Keyand body, and that a dropped poll connection doesn't stop polling;601371cf6and8f6eba62f: at the previous head, the new dropped-connection case failed withTypeError: fetch failed(SocketError: other side closed). With only the reference fitting switched off, the new reference case failed withSpicyAPI image generation failed (413): Request body too large. Both pass on the final code.pnpm check(localization, format, lint and typecheck, e2e and token-estimation types, full build): exit 0 on the final code (8f6eba62f). The only lint warning is an existingreact-hooks/exhaustive-depswarning in client code this PR doesn't touch.node ./scripts/run-regressions.mjs --filter image: 18/18 passed.--filter connection: 6/6 passed (rerun on601371cf6). These includefal-image,image-custom-parameters,image-generation-timeout,gpt-image-2-5andcodex-chatgpt-image.model-source-hosts,open-issues,codex-reasoning-effortandissue-sweep-5216-5218also passed; each touches the shared image source lists.ponytail:comment infitSpicyApiReferencenames that limit and the upgrade path.Reviewer findings fixed in
601371cf6:fetch failedand abandoned a paid task. Fixed: createTask is resent with the sameIdempotency-Key, and a failed poll counts like a busy reply.Local CodeRabbit review (
coderabbit review --agent --committed, three runs; the third, on8f6eba62f, reported 1 finding, the docs-i18n mirror below, which #7491 covers and which now quotes the updated English text):c69d3bb8c).docs-i18n". Follow-up #7491 is open and linked.image_urls/image_urlfield". In SpicyAPI's public catalog, every edit endpoint declares one of those two fields, and no text-to-image endpoint does. Rejecting would break Illustrator's text-to-image requests, which often carry character references. A warning would fire on every one of them. Text-to-image models skip references, as with Venice and Z.AI, and the guide says so.Manual verification notes
Not verified against the live SpicyAPI service. The agent had no SpicyAPI key. The request and response shapes come from SpicyAPI's published OpenAPI contract (
https://docs.spicyapi.ai/openapi.yaml).Manual verification needed:
https://api.spicyapi.ai/api/v1and the modelalibaba/z-image-spicy-pro/text-to-imageare filled in, and that the API key link opens the SpicyAPI console.alibaba/z-image-spicy-pro/text-to-image, then withbytedance/seedream-5.0-pro/text-to-image. Both should return an image. With Debug mode on, confirm that the server log shows[debug/image/spicyapi] final request payloadwithout the key./editmodel, such asalibaba/qwen-image-2.1/edit, and generate a scene illustration that has a character reference. Confirm the reference is used. Repeat with a character whose avatar file is over 1 MB. The image should still generate, and the server log should show no SpicyAPI 413 or 400 error.spicyapi.ai. Switch its service to SpicyAPI and confirm that Test Image now works.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)Updated
docs/media/image-providers.md. The[docs-i18n]follow-up is #7491. Per the 2026-10-12 policy,CHANGELOG.mdis untouched, and the release note comes from What changed above.UI evidence (if applicable)
None captured. The only UI change is one more card in the existing image service grid, plus a key link.
Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.