Skip to content

video: Kling text2video dialect - #36

Merged
CMGS merged 4 commits into
mainfrom
feat/kling-video
Aug 19, 2026
Merged

video: Kling text2video dialect#36
CMGS merged 4 commits into
mainfrom
feat/kling-video

Conversation

@CMGS

@CMGS CMGS commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

What

  • Provider kling speaks Kling's real wire: POST /v1/videos/text2video (model_name, string duration, aspect_ratio, resolution: 1080p riding mode: pro), poll GET /v1/videos/text2video/{id}; the {code, data} envelope's non-zero code on an HTTP 200 is rejected as 502 (same treatment as MiniMax's base_resp); the job is keyed by data.task_id — Kling's top-level request_id is a trace id, the same trap DashScope had. succeed bills the clip's reported seconds from task_result.videos[0].duration.
  • The previously-invented sync shape stays as the generic fallback; the default config demonstrates it as vidu-video so both paths keep e2e coverage.
  • Kling image-to-video is a different endpoint pair and is not wired — an image param on a kling model answers 400 loudly.

Verification

  • cargo fmt --check / clippy -D warnings / cargo test --workspace: 541 passed / 0 failed. New: Kling submit-shape assertions (model_name, string duration, no model key, text2video URL), Kling tuple in the dialect e2e (task-id keying, units billed once, 409 before done).
  • Live (a 100-point trial package, burned to exhaustion): 13 generations settled — kling-v1-6 std/pro(1080p) at 5 s and 10 s, kling-v2-master at 5 s and 10 s — every clip billed once at the vendor-reported duration (5 s requests render 5.1 s → 6 units; 10 s → 10.6 s → 11 units), 128 billed seconds total. Two 5-way concurrent waves settled every job exactly once — no double billing under concurrency (ledger audited per task id). A transient Kling internal error (task_status: failed, 0 deduction) billed nothing; the exhausted package surfaces as a clean 429 (Account balance not enough). During the concurrent waves the same gateway served 107k rps /health and 114k rps /v1/models at p99 ≤ 1 ms — the async video brokering adds nothing to the hot path.

CMGS added 4 commits August 19, 2026 21:09
provider `kling` speaks /v1/videos/text2video: model_name instead of
model, string durations, a {code, data} envelope whose non-zero code is
a business error on HTTP 200 (rejected as 502, like MiniMax's base_resp),
the job keyed by data.task_id — never the trace request_id — and polled
at /v1/videos/text2video/{id}; succeed bills the clip's seconds from
task_result. The old invented shape stays as the generic fallback (the
default config demonstrates it as vidu-video). Auth verified live on
api-singapore.klingai.com; generation blocked on account balance.
… alias

The live-matrix bedrock account line came back (a section merge had
eaten it); the unconfigured `klingai` alias goes; the harness duration
helper falls back to the delivered-video count like the gateway does;
the image-to-video 400 guard gets its assertion.
@CMGS
CMGS merged commit 6aa20cd into main Aug 19, 2026
2 checks passed
@CMGS
CMGS deleted the feat/kling-video branch August 19, 2026 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant