feat(clients): media: image and video generation across 12 providers behind one job seam

Stability, BFL, Runway, Luma, Replicate, fal, Ideogram, Recraft, Leonardo,
MiniMax, Kling, Higgsfield: call tables checked against vendor specs/SDKs,
ImageGenerator/VideoGenerator seam with capped polling, /ai/media demo.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-25 15:19:43 +01:00
co-authored by Claude Sonnet 5.5
parent 3db67fcf1f
commit 5a0c18d0e0
78 changed files with 8727 additions and 3 deletions
+47
View File
@@ -0,0 +1,47 @@
// Routes: GET /ai/media (page), /status, /calls (no credential needed)
#include <cstdlib>
#include "support/Assert.hpp"
using namespace molo::example::test;
int main() {
setenv("MOLO_ENV_FILES", "off", 1);
for (const char* v : {"STABILITY_API_KEY", "BFL_API_KEY", "RUNWAY_API_KEY", "RUNWAYML_API_SECRET", "LUMA_API_KEY",
"REPLICATE_API_TOKEN", "FAL_KEY", "IDEOGRAM_API_KEY", "RECRAFT_API_TOKEN", "LEONARDO_API_KEY",
"MINIMAX_API_KEY", "KLING_ACCESS_KEY", "KLING_SECRET_KEY", "HF_API_KEY_ID", "HF_API_KEY_SECRET"})
unsetenv(v);
Fixture f;
auto page = f.client->get("/ai/media");
check(page.status == 200, "page 200");
check(contains(page.headers.get("Content-Type"), "text/html"), "html");
check(contains(page.body, "Media generation") && contains(page.body, "viewport"), "title and mobile viewport");
check(contains(page.body, "/embedded/ai_media.js"), "script wired");
check(f.client->post("/ai/media", "{}", "application/json").status == 405, "post page is 405");
auto st = f.client->get("/ai/media/status");
check(st.status == 200 && contains(st.body, "\"configured\":false"), "status without keys");
check(!contains(st.body, "\"configured\":true"), "no provider is configured");
for (const char* env : {"STABILITY_API_KEY", "BFL_API_KEY", "RUNWAY_API_KEY", "LUMA_API_KEY", "REPLICATE_API_TOKEN",
"FAL_KEY", "IDEOGRAM_API_KEY", "RECRAFT_API_TOKEN", "LEONARDO_API_KEY"})
check(contains(st.body, env), std::string("status names ") + env);
check(contains(st.body, "Midjourney") && contains(st.body, "No public API"), "Midjourney is listed as unavailable with the reason");
check(contains(st.body, "Pika"), "Pika is listed as unavailable");
check(contains(st.body, "\"evidence\":\"probe-only\"") && contains(st.body, "\"evidence\":\"openapi\""), "evidence levels shown");
check(contains(st.body, "flux-2-pro") && contains(st.body, "fal-ai/flux/dev"), "models are listed");
check(contains(st.body, "\"max_poll_attempts\":240"), "caps are shown");
check(f.client->post("/ai/media/status", "{}", "application/json").status == 405, "post status is 405");
auto all = f.client->get("/ai/media/calls");
check(all.status == 200 && contains(all.body, "\"provider\":\"stability\"") && contains(all.body, "\"provider\":\"higgsfield\""),
"calls lists every provider");
auto bfl = f.client->get("/ai/media/calls?provider=bfl");
check(bfl.status == 200 && contains(bfl.body, "/v1/flux-2-pro") && contains(bfl.body, "\"effect\":\"paid\"") &&
contains(bfl.body, "/v1/credits"),
"bfl call table");
auto fal = f.client->get("/ai/media/calls?provider=fal");
check(fal.status == 200 && contains(fal.body, "queue.fal.run") == false && contains(fal.body, "/{owner}/{app}/requests/{request_id}/status"),
"fal call table");
check(f.client->get("/ai/media/calls?provider=midjourney").status == 422, "unknown provider is 422");
return finish("ai/media/page");
}