[GH-ISSUE #7922] [Feature]: Optional ToAPIs async scene-image and scene-video provider (tested community adapter) #4354

Closed
opened 2026-10-22 04:05:57 +07:00 by bsakaguchi · 6 comments
Owner

Originally created by @YamiAnn on GitHub (Oct 21, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/7922

Originally assigned to: @SpicyMarinara on GitHub.

What problem does this solve?

Hi @SpicyMarinara — Yami from ToAPIs here. Following your invitation to submit a focused feature request, we would like to propose ToAPIs as an optional asynchronous scene-image / scene-video API provider.

We understand that another chat provider already covered by Custom-OAI is not needed. This request is limited to the media contract: ToAPIs returns an async task id, uses dedicated image/video status routes, and accepts uploaded image URLs for reference images / first frames. Those paths differ from the pinned OpenAI-image and Seedance implementations; changing Base URL alone does not enable them.

Proposed solution

Evaluate a narrowly scoped media adapter while retaining Custom-OAI for text. We prepared a community patch against Marinara 2.5.1, staging commit d0e481913f9a0e3bab0e9b767009500d0577f98a, for assessment rather than claiming an official integration.

Initial API Provider plan:

  1. Start with ordinary gpt-image-2 (1k, one image) and seedance-2-mini (initial acceptance preset: 4s, 480p, 16:9, first frame, audio off).
  2. Reuse existing connection and Gallery UI, with explicit ToAPIs async request/status mapping, image upload, credential-safe output download, cancellation propagation and private task receipts. Never automatically repeat a paid POST after an ambiguous response.
  3. Keep text / Prompt Model on the existing Custom-OAI path. Expand model/settings coverage only after contract and application tests.
  4. If this fits your roadmap, we can help with API clarifications and evaluation credits; your team can choose whether/how to implement an official provider. We are not asking you to accept the community patch as-is.

Published, reproducible materials:

Alternatives considered

  • Custom-OAI only: suitable for text; does not by itself establish the asynchronous media mapping above.
  • Standalone scripts / manual import: our earlier external API workflow remains usable, but does not verify native video review/playback. The new local patch exercised the actual application.
  • Provider-specific existing services: the patch preserves their original paths for other hosts and gates the ToAPIs contract to exact HTTPS toapis.com / toapis.cn origins. A dedicated service entry may be preferable upstream; we welcome your direction.

Additional context

Tests completed on 2026-10-21

  • pnpm check passed, including production build; one existing unrelated hook warning, zero errors.
  • 22 offline integration checks passed. External provider HTTP is mocked in these checks, including actual Fastify connection save/masking, Test Image/Test Video and Gallery routes.
  • Two zero-paid Playwright cases passed: desktop and mobile Edge viewports. They cover Roleplay video control availability without the optional Illustrator package when a video connection is configured.
  • Live, unmocked media: one image generated through the actual application Gallery HTTP route with an explicit prompt; one first-frame video generated through the browser's native Review Video Prompt → Generate flow.
  • Image: 1696×960 PNG, fully decoded, 90.01s. Video: 4.04s, 864×496, 24fps, 97 decoded frames, no audio, 92.585s. In-app playback passed; downloaded SHA-256 matched the original; image and video persisted after refresh with no page errors.

These are local community-build results, not upstream acceptance. The optional Illustrator installation / Illustrate button, native UI reference-image editing, mobile WebKit, other model variants, concurrency and production deployment remain unverified. Historical task identity is saved privately, but there is no automatic resume UI or live billing panel.

API calling costs

Item Rate / quote This live run
Ordinary gpt-image-2, 1k, n=1 Key-scoped quote $0.015/image Task billing unavailable; final debit unknown
seedance-2-mini $3.285714 / 1M total tokens Task settled $0.13338 for the 4.04s first-frame clip
Same clip normalized to duration $0.033015/s for this case A case conversion, not a fixed per-second tariff
deepseek-v4-flash Prompt Model Public default-group reference: $0.20/M input, $0.80/M output Two model/time-window logs total $0.000708, billing phase unknown

Only $0.13338 is confirmed media settlement for this run; the image quote and unknown-phase text logs are not a confirmed combined net total. Text prices are public catalog references, not a /v1/pricing text quote. The first video preview was stopped before paid video submission to correct defaults, accounting for the two text logs.

API documentation and request mapping

POST /v1/images/generations / POST /v1/videos/generations return a task id; poll the corresponding /generations/{id} route and download result.data[0].url after status: completed. Upload inputs via POST /v1/uploads/images; image edits use reference_images, video first frames use image_with_roles: [{url, role: "first_frame"}]. Full runnable request/response mapping is included in the linked materials.

The tested server used https://toapis.cn/v1. The international option is https://toapis.com/v1; regional URL differences and network-test limits are documented. Does this scoped asynchronous media provider fit the integration path you would consider?

Thanks for taking a look!

Yami · ToAPIs

Template check

  • I DID NOT read this template and provide the requested details.
Originally created by @YamiAnn on GitHub (Oct 21, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/7922 Originally assigned to: @SpicyMarinara on GitHub. ## What problem does this solve? Hi @SpicyMarinara — Yami from ToAPIs here. Following your invitation to submit a focused feature request, we would like to propose ToAPIs as an optional **asynchronous scene-image / scene-video API provider**. We understand that another chat provider already covered by Custom-OAI is not needed. This request is limited to the media contract: ToAPIs returns an async task `id`, uses dedicated image/video status routes, and accepts uploaded image URLs for reference images / first frames. Those paths differ from the pinned OpenAI-image and Seedance implementations; changing Base URL alone does not enable them. ## Proposed solution Evaluate a narrowly scoped media adapter while retaining Custom-OAI for text. We prepared a community patch against Marinara 2.5.1, staging commit `d0e481913f9a0e3bab0e9b767009500d0577f98a`, for assessment rather than claiming an official integration. Initial API Provider plan: 1. Start with ordinary `gpt-image-2` (1k, one image) and `seedance-2-mini` (initial acceptance preset: 4s, 480p, 16:9, first frame, audio off). 2. Reuse existing connection and Gallery UI, with explicit ToAPIs async request/status mapping, image upload, credential-safe output download, cancellation propagation and private task receipts. Never automatically repeat a paid POST after an ambiguous response. 3. Keep text / Prompt Model on the existing Custom-OAI path. Expand model/settings coverage only after contract and application tests. 4. If this fits your roadmap, we can help with API clarifications and evaluation credits; your team can choose whether/how to implement an official provider. We are not asking you to accept the community patch as-is. Published, reproducible materials: - [Native setup, configuration, exact scope and prices](https://github.com/ToAPIs-2025/lower-cost-marinara-media-toapis/blob/main/native/README.md) - [Six-file source patch](https://github.com/ToAPIs-2025/lower-cost-marinara-media-toapis/blob/main/native/toapis-media.patch), with AGPL-3.0 license, backend regression and UI regression - [Sanitized live evidence](https://github.com/ToAPIs-2025/lower-cost-marinara-media-toapis/blob/main/evidence/marinara-native-2026-10-21.json) and [test summary](https://github.com/ToAPIs-2025/lower-cost-marinara-media-toapis/blob/main/native/checks-2026-10-21.md) - [Actual PNG](https://github.com/ToAPIs-2025/lower-cost-marinara-media-toapis/blob/main/examples/native-2026-10-21/scene.png), [actual MP4](https://github.com/ToAPIs-2025/lower-cost-marinara-media-toapis/blob/main/examples/native-2026-10-21/scene-video.mp4), [native playback screenshot](https://github.com/ToAPIs-2025/lower-cost-marinara-media-toapis/blob/main/examples/native-2026-10-21/03-native-video-playing.png) ## Alternatives considered - **Custom-OAI only:** suitable for text; does not by itself establish the asynchronous media mapping above. - **Standalone scripts / manual import:** our earlier external API workflow remains usable, but does not verify native video review/playback. The new local patch exercised the actual application. - **Provider-specific existing services:** the patch preserves their original paths for other hosts and gates the ToAPIs contract to exact HTTPS `toapis.com` / `toapis.cn` origins. A dedicated service entry may be preferable upstream; we welcome your direction. ## Additional context ### Tests completed on 2026-10-21 - `pnpm check` passed, including production build; one existing unrelated hook warning, zero errors. - 22 offline integration checks passed. External provider HTTP is mocked in these checks, including actual Fastify connection save/masking, Test Image/Test Video and Gallery routes. - Two zero-paid Playwright cases passed: desktop and mobile Edge viewports. They cover Roleplay video control availability without the optional Illustrator package when a video connection is configured. - **Live, unmocked media:** one image generated through the actual application Gallery HTTP route with an explicit prompt; one first-frame video generated through the browser's native Review Video Prompt → Generate flow. - Image: 1696×960 PNG, fully decoded, 90.01s. Video: 4.04s, 864×496, 24fps, 97 decoded frames, no audio, 92.585s. In-app playback passed; downloaded SHA-256 matched the original; image and video persisted after refresh with no page errors. These are local community-build results, not upstream acceptance. The optional Illustrator installation / Illustrate button, native UI reference-image editing, mobile WebKit, other model variants, concurrency and production deployment remain unverified. Historical task identity is saved privately, but there is no automatic resume UI or live billing panel. ### API calling costs | Item | Rate / quote | This live run | |---|---|---| | Ordinary `gpt-image-2`, 1k, n=1 | Key-scoped quote **$0.015/image** | Task billing unavailable; final debit unknown | | `seedance-2-mini` | **$3.285714 / 1M total tokens** | Task **settled $0.13338** for the 4.04s first-frame clip | | Same clip normalized to duration | **$0.033015/s for this case** | A case conversion, not a fixed per-second tariff | | `deepseek-v4-flash` Prompt Model | Public default-group reference: $0.20/M input, $0.80/M output | Two model/time-window logs total **$0.000708**, billing phase unknown | Only $0.13338 is confirmed media settlement for this run; the image quote and unknown-phase text logs are not a confirmed combined net total. Text prices are public catalog references, not a `/v1/pricing` text quote. The first video preview was stopped before paid video submission to correct defaults, accounting for the two text logs. ### API documentation and request mapping - [Quickstart and regional hosts](https://docs.toapis.com/docs/cn/quickstart) - [Image generation](https://docs.toapis.com/docs/cn/api-reference/images/gpt-image-2/generation), [video generation](https://docs.toapis.com/docs/cn/api-reference/videos/seedance-2/generation), [image upload](https://docs.toapis.com/docs/cn/api-reference/uploads/images) - [Image status](https://docs.toapis.com/docs/cn/api-reference/tasks/image-status), [video status](https://docs.toapis.com/docs/cn/api-reference/tasks/video-status), [pricing / billing](https://docs.toapis.com/docs/en/api-reference/account/pricing) `POST /v1/images/generations` / `POST /v1/videos/generations` return a task `id`; poll the corresponding `/generations/{id}` route and download `result.data[0].url` after `status: completed`. Upload inputs via `POST /v1/uploads/images`; image edits use `reference_images`, video first frames use `image_with_roles: [{url, role: "first_frame"}]`. Full runnable request/response mapping is included in the linked materials. The tested server used **`https://toapis.cn/v1`**. The international option is **`https://toapis.com/v1`**; regional URL differences and network-test limits are documented. Does this scoped asynchronous media provider fit the integration path you would consider? Thanks for taking a look! Yami · ToAPIs ## Template check - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-22 04:05:57 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Oct 21, 2026):

Hi Yami, thanks for the detailed proposal and the reproducible patch and evidence.

We're open to making Marinara Engine compatible with ToAPIs through the existing connection types. We want to reserve new branded provider entries for official model providers, so we would keep ToAPIs out of the provider and service lists.

The integration direction is:

  • Text / Prompt Model: continue using Custom (OAI-Compatible).
  • Images: reuse the existing OpenAI image service with a ToAPIs base URL and API key.
  • Videos: reuse the existing Seedance service with a ToAPIs base URL and API key.
  • Backend: use a narrowly scoped compatibility adapter for the ToAPIs endpoints to handle asynchronous job submission, reference uploads, polling, and result retrieval, while preserving existing behavior for other endpoints.

We understand that changing the base URL alone is insufficient with the current media implementation. Your patch already demonstrates the endpoint-based adapter approach, which fits this direction.

We'll handle the upstream follow-up from here. The patch and reported test results are useful references; acceptance will still require our own review and validation. Thanks for keeping the request focused.

<!-- gh-comment-id:6312544813 --> @SpicyMarinara commented on GitHub (Oct 21, 2026): Hi Yami, thanks for the detailed proposal and the reproducible patch and evidence. We're open to making Marinara Engine compatible with ToAPIs through the existing connection types. We want to reserve new branded provider entries for official model providers, so we would keep ToAPIs out of the provider and service lists. The integration direction is: - **Text / Prompt Model:** continue using Custom (OAI-Compatible). - **Images:** reuse the existing OpenAI image service with a ToAPIs base URL and API key. - **Videos:** reuse the existing Seedance service with a ToAPIs base URL and API key. - **Backend:** use a narrowly scoped compatibility adapter for the ToAPIs endpoints to handle asynchronous job submission, reference uploads, polling, and result retrieval, while preserving existing behavior for other endpoints. We understand that changing the base URL alone is insufficient with the current media implementation. Your patch already demonstrates the endpoint-based adapter approach, which fits this direction. We'll handle the upstream follow-up from here. The patch and reported test results are useful references; acceptance will still require our own review and validation. Thanks for keeping the request focused.
Author
Owner

@SpicyMarinara commented on GitHub (Oct 21, 2026):

Ownership: Codex is handling the upstream compatibility work for @SpicyMarinara in codex/7922-toapis-media. The change will reuse the existing OpenAI image and Seedance video selections with a ToAPIs base URL; it will not add a provider or service list entry. I will validate the asynchronous request, upload, polling, cancellation and result download paths before marking the linked PR ready.

<!-- gh-comment-id:6312636662 --> @SpicyMarinara commented on GitHub (Oct 21, 2026): Ownership: Codex is handling the upstream compatibility work for @SpicyMarinara in `codex/7922-toapis-media`. The change will reuse the existing OpenAI image and Seedance video selections with a ToAPIs base URL; it will not add a provider or service list entry. I will validate the asynchronous request, upload, polling, cancellation and result download paths before marking the linked PR ready.
Author
Owner

@YamiAnn commented on GitHub (Oct 21, 2026):

Thanks @SpicyMarinara for taking ownership of the upstream work, and for moving the compatibility forward in #7941. We’re happy to follow the existing connection and service selections as you described.

Beyond the integration, we’d love to explore a longer-term API supply partnership with Marinara. ToAPIs can support your image, video and text model needs, and we’re happy to discuss preferential pricing based on the models and expected usage, along with trial credits for evaluation.

We’re also available to help troubleshoot request parameters, reference uploads, asynchronous task handling and billing receipts as the implementation is reviewed and tested.

Would you be open to discussing an API supply collaboration alongside the compatibility work? We can continue here, or you’re welcome to reach me at yami@toapis.com to discuss the commercial details.

Thanks again — we’d be glad to support the project and build a lasting collaboration.

YamiAnn · ToAPIs team

<!-- gh-comment-id:6313140566 --> @YamiAnn commented on GitHub (Oct 21, 2026): Thanks @SpicyMarinara for taking ownership of the upstream work, and for moving the compatibility forward in #7941. We’re happy to follow the existing connection and service selections as you described. Beyond the integration, we’d love to explore a longer-term API supply partnership with Marinara. ToAPIs can support your image, video and text model needs, and we’re happy to discuss preferential pricing based on the models and expected usage, along with trial credits for evaluation. We’re also available to help troubleshoot request parameters, reference uploads, asynchronous task handling and billing receipts as the implementation is reviewed and tested. Would you be open to discussing an API supply collaboration alongside the compatibility work? We can continue here, or you’re welcome to reach me at **yami@toapis.com** to discuss the commercial details. Thanks again — we’d be glad to support the project and build a lasting collaboration. YamiAnn · ToAPIs team
Author
Owner

@SpicyMarinara commented on GitHub (Oct 21, 2026):

Implemented in #7941 and merged into staging, with no new provider or service option.

Use the existing Image Generation → OpenAI (DALL-E) or Video Generation → Seedance 2.0 connection, with https://toapis.com/v1 or https://toapis.cn/v1, your key and the model ID entered manually. Text continues through Custom (OAI-Compatible).

The initial scope is ordinary gpt-image-2: one 1k image, Auto quality and at most one reference; and seedance-2-mini: 4 seconds, 480p, 16:9, audio off, with an optional first frame. Save those video defaults before using Test Video or Gallery. Unsupported settings are rejected before task submission.

The adapter handles uploads, asynchronous polling, safe output downloads, cancellation and private reconciliation receipts. Ambiguous paid submissions cannot trigger an automatic replacement through Engine fallback. Provider reasons remain available in the UI and debug logs; operational error logs use safe metadata, including the local receipt ID when the task flow has it. A deadline message can omit the receipt identifier, so reconciliation may require locating the durable receipt manually. For package automation, update Noodle to 1.5.9 and Slurp to 0.3.53; the companion safety changes are merged and publication-verified in Marinara-Agents #1530. Existing installations are not automatically upgraded by that publication.

pnpm check, 45 offline integration checks through actual app routes and serialized logs, neighboring image-reference/timeout/security and logging regressions, and desktop/mobile Gallery playback checks passed. Final-head hosted review and required checks completed before merging. Provider HTTP was mocked in our checks: no fresh paid generation, billing settlement, live Illustrator installation or physical-device proof is claimed.

<!-- gh-comment-id:6318082192 --> @SpicyMarinara commented on GitHub (Oct 21, 2026): Implemented in #7941 and merged into `staging`, with no new provider or service option. Use the existing Image Generation → OpenAI (DALL-E) or Video Generation → Seedance 2.0 connection, with `https://toapis.com/v1` or `https://toapis.cn/v1`, your key and the model ID entered manually. Text continues through Custom (OAI-Compatible). The initial scope is ordinary `gpt-image-2`: one 1k image, Auto quality and at most one reference; and `seedance-2-mini`: 4 seconds, 480p, 16:9, audio off, with an optional first frame. Save those video defaults before using Test Video or Gallery. Unsupported settings are rejected before task submission. The adapter handles uploads, asynchronous polling, safe output downloads, cancellation and private reconciliation receipts. Ambiguous paid submissions cannot trigger an automatic replacement through Engine fallback. Provider reasons remain available in the UI and debug logs; operational error logs use safe metadata, including the local receipt ID when the task flow has it. A deadline message can omit the receipt identifier, so reconciliation may require locating the durable receipt manually. For package automation, update Noodle to 1.5.9 and Slurp to 0.3.53; the companion safety changes are merged and publication-verified in [Marinara-Agents #1530](https://github.com/Pasta-Devs/Marinara-Agents/pull/1530). Existing installations are not automatically upgraded by that publication. `pnpm check`, 45 offline integration checks through actual app routes and serialized logs, neighboring image-reference/timeout/security and logging regressions, and desktop/mobile Gallery playback checks passed. Final-head hosted review and required checks completed before merging. Provider HTTP was mocked in our checks: no fresh paid generation, billing settlement, live Illustrator installation or physical-device proof is claimed.
Author
Owner

@YamiAnn commented on GitHub (Oct 23, 2026):

Thanks @SpicyMarinara for implementing #7941 and merging the compatibility work into staging. We’ve noted the existing OpenAI image / Seedance video selections and the initial supported settings, and we’ll keep our community guide aligned with that scope.

Following up on the API supply discussion: if Marinara currently runs, or plans to run, its own hosted service, API gateway or managed model offering, ToAPIs could also serve as an optional upstream supplier. We can prepare preferential pricing around the specific image, video and text models, settings and expected usage, and coordinate evaluation credits for a small real-key acceptance run.

We respect your policy on branded provider entries; upstream supply can be evaluated through the existing connection types. Would this be relevant to your plans, and who would be the right person to discuss model supply and commercial terms with?

If useful, please share the models you care about and an approximate usage range privately at yami@toapis.com, or via business WeChat. We can then put together a focused quote and test plan.

Thank you again for the implementation and validation notes.

Yami · ToAPIs

<!-- gh-comment-id:6358542472 --> @YamiAnn commented on GitHub (Oct 23, 2026): Thanks @SpicyMarinara for implementing #7941 and merging the compatibility work into `staging`. We’ve noted the existing OpenAI image / Seedance video selections and the initial supported settings, and we’ll keep our community guide aligned with that scope. Following up on the API supply discussion: if Marinara currently runs, or plans to run, its own hosted service, API gateway or managed model offering, ToAPIs could also serve as an optional upstream supplier. We can prepare preferential pricing around the specific image, video and text models, settings and expected usage, and coordinate evaluation credits for a small real-key acceptance run. We respect your policy on branded provider entries; upstream supply can be evaluated through the existing connection types. Would this be relevant to your plans, and who would be the right person to discuss model supply and commercial terms with? If useful, please share the models you care about and an approximate usage range privately at **yami@toapis.com**, or via [business WeChat](https://work.weixin.qq.com/ca/cawcde75dee0ad367f). We can then put together a focused quote and test plan. Thank you again for the implementation and validation notes. Yami · ToAPIs
Author
Owner

@SpicyMarinara commented on GitHub (Oct 23, 2026):

@YamiAnn Thanks for the offer, but we’re not interested in an API supply or commercial partnership. We do not run, plan, or intend to host any services, API gateways, or managed model offerings.

Marinara Engine is self-hosted: users choose their own providers and supply their own API keys. We therefore have no centralized model usage or upstream supply requirements to discuss.

Thanks for understanding.

<!-- gh-comment-id:6362482001 --> @SpicyMarinara commented on GitHub (Oct 23, 2026): @YamiAnn Thanks for the offer, but we’re not interested in an API supply or commercial partnership. We do not run, plan, or intend to host any services, API gateways, or managed model offerings. Marinara Engine is self-hosted: users choose their own providers and supply their own API keys. We therefore have no centralized model usage or upstream supply requirements to discuss. Thanks for understanding.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#4354
No description provided.