Calling Kling v4, Seedance 2.5 & Midjourney v8.2 Outside China with One Unified Async API A developer published an engineering walkthrough showing how to integrate Kling v4, ByteDance Seedance 2.5, and Midjourney v8.2 into a single Python asyncio client through an OpenAI/media-compatible gateway at api.hop-base.com. The client uses one API key, a shared two-step submit-and-poll lifecycle, startup validation of model IDs via GET /v1/models, and per-task USD cost reconciliation through usage.cost_usd. The writeup details model-specific contracts, including Kling's 3–30s clips with native audio, Seedance's structured content segments and per-token billing, and Midjourney's four-image jobs with prompt-string parameters. If you are building a creative studio, ad-tech generator, storyboard tool, or multimodal AI agent outside China, integrating the top video and image generation models usually turns into an infrastructure headache: POST /v1/video/generate with per-second billing, another prices by 1M video tokens dreamina-seedance-2-5-260628 , while --ar and native 2K --hd inside the prompt string rather than JSON fields. In this engineering walkthrough, we will wire Kling v4 kling-v4 , ByteDance Seedance 2.5 dreamina-seedance-2-5-260628 , and Midjourney v8.2 midjourney-v8-2 into a single Python asyncio client with one API key, one polling loop, strict submit-time validation, and exact per-task USD cost reconciliation usage.cost usd . Through an OpenAI/media-compatible gateway surface https://api.hop-base.com/v1 , all three model families share a clean two-step asynchronous lifecycle: | Model Family | Exact Model IDs | Submit Endpoint | Poll Endpoint | Output & Billing Unit Official List Benchmark | |---|---|---|---|---| | Kuaishou Kling 4.0 | kling-v4 , kling-v4-flash | POST /v1/video/generate | GET /v1/video/tasks/{id} | 3–30s clip 720p $0.1471/s , 1080p $0.2206/s w/ native audio; Flash 720p $0.08824/s | | ByteDance Seedance 2.5 | dreamina-seedance-2-5-260628 , dreamina-seedance-2-5-flash-261115 | POST /v1/video/generate | GET /v1/video/tasks/{id} | 4–30s or -1 auto clip, 480p – 4k $10.70/1M video tok at 720p no-ref; Flash $7.00/1M | | Midjourney v8.2 | midjourney-v8-2 | POST /v1/images/generations 202 | GET /v1/video/tasks/{id} | 4 candidate images per job 1K $0.0441/img = $0.1765/job ; --hd 2K $0.0559/img = $0.2235/job | Note on pricing & ownership: Kling is a Kuaishou product, Seedance is a ByteDance product, and Midjourney is a Midjourney product. All prices cited above are published official vendor list price benchmarks in USD from HopBase-AI/llm-api-pricing https://github.com/HopBase-AI/llm-api-pricing always check live vendor pages; enterprise account rates on HopBase https://hop-base.com/pricing are quoted per customer . Never hardcode or guess model suffixes. Every API key is scoped to the model groups attached to it in the console—always query GET /v1/models at startup to confirm the exact IDs available to your key: export HOPBASE API KEY="sk-..." curl -sS https://api.hop-base.com/v1/models \ -H "Authorization: Bearer $HOPBASE API KEY" \ | jq -r '.data .id | select test "^ kling-v4|dreamina-seedance-2-5|midjourney-v8-2 " ' kling-v4 : 3–30s Native-Audio Video Three important kling-v4 contract details save hours of debugging: audio: false is sent, and 720p $0.1471/s list / 1080p $0.2206/s list bill identically either way. 3 to 30 . aspect ratio is ignored . For multi-shot storyboards shots with up to 6 segments or character motion transfer, use kling-v3 / kling-v3-omni or kling-v3-motion-control . Submit Kling v4 1080p 5-second video task curl -sS https://api.hop-base.com/v1/video/generate \ -H "Authorization: Bearer $HOPBASE API KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "kling-v4", "prompt": "Handheld tracking shot through a rain-soaked Tokyo alley at dusk, neon reflections on wet asphalt, footsteps and distant thunder", "duration": 5, "resolution": "1080p", "aspect ratio": "16:9", "audio": true }' Overseas Seedance 2.5 dreamina-seedance-2-5-260628 and its high-speed sibling Seedance 2.5 Flash dreamina-seedance-2-5-flash-261115 , 480p / 720p use structured content segments: duration : -1 model-chosen optimal length or integers 4 – duration: -1 and ratio: "adaptive" . https:// URLs. Note that video input switches billing into the lower per-token reference bucket $6.40 vs $10.70 per 1M video tokens at 4k , the per-million-token rate is $4.70 no video ref / $2.90 with video ref because a 4K frame contains 4x the tokens of a 1080p frame. curl -sS https://api.hop-base.com/v1/video/generate \ -H "Authorization: Bearer $HOPBASE API KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "dreamina-seedance-2-5-260628", "content": { "type": "text", "text": "Macro slow-motion espresso extraction into a warmed glass demitasse, golden crema swirling under warm morning sunlight" } , "duration": 5, "resolution": "720p", "ratio": "16:9", "generate audio": true, "watermark": false }' midjourney-v8-2 : 4-Image Async Jobs & Prompt Flags Unlike single-image synchronous endpoints, midjourney-v8-2 submits via POST /v1/images/generations returning HTTP 202 + task id and polls on the exact same GET /v1/video/tasks/{task id} endpoint: outputs valid for 24 hours; download and persist to your own S3/R2 bucket promptly . prompt , not JSON keys: HTTP 400 set the aspect ratio with --ar in the prompt . Append --ar 16:9 for widescreen 1456×816 and 2944×1648 . --q , --niji , --cref , --oref , :: multi-prompt weights, or decimal ratios like --ar 1.5:1 are rejected synchronously at submit time with curl -sS https://api.hop-base.com/v1/images/generations \ -H "Authorization: Bearer $HOPBASE API KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "midjourney-v8-2", "prompt": "architectural cutaway of a minimalist cliffside library overlooking misty fjords, warm cedar interior --ar 16:9 --hd --s 250" }' Every terminal task response completed , failed , or cancelled from GET /v1/video/tasks/{task id} includes a top-level usage object with cost usd —the exact USD amount deducted for that job 0 if rejected or timed out . That means your multi-tenant SaaS backend can record exact per-job COGS without estimating video tokens: python import asyncio import os from typing import Any import httpx BASE URL = "https://api.hop-base.com/v1" API KEY = os.environ "HOPBASE API KEY" async def run media task client: httpx.AsyncClient, submit path: str, payload: dict str, Any , , poll interval s: float = 4.0, timeout s: float = 600.0, - dict str, Any : headers = {"Authorization": f"Bearer {API KEY}"} submit resp = await client.post f"{BASE URL}{submit path}", json=payload, headers=headers submit resp.raise for status submitted = submit resp.json task id = submitted.get "id" or submitted.get "task", {} .get "id" if not task id: raise RuntimeError f"Unexpected submit payload: {submitted}" loop = asyncio.get running loop deadline = loop.time + timeout s while loop.time < deadline: await asyncio.sleep poll interval s poll resp = await client.get f"{BASE URL}/video/tasks/{task id}", headers=headers poll resp.raise for status task = poll resp.json status = task.get "status" if status == "completed": return { "task id": task id, "model": payload "model" , "outputs": task.get "outputs", , "cost usd": task.get "usage" or {} .get "cost usd", 0.0 , } if status in "failed", "cancelled" : cost usd = task.get "usage" or {} .get "cost usd", 0.0 raise RuntimeError f"Task {task id} {status} billed=${cost usd} : {task.get 'error' }" raise TimeoutError f"Task {task id} did not finish within {timeout s}s" async def main - None: async with httpx.AsyncClient timeout=30.0 as client: mj job, kling job, seedance job = await asyncio.gather run media task client, "/images/generations", { "model": "midjourney-v8-2", "prompt": "editorial product photo of brushed titanium headphones on slate stone --ar 4:3 --hd", }, , run media task client, "/video/generate", { "model": "kling-v4", "prompt": "Slow orbital camera around brushed titanium headphones on slate stone, soft studio rim light", "duration": 5, "resolution": "1080p", "aspect ratio": "16:9", }, , run media task client, "/video/generate", { "model": "dreamina-seedance-2-5-flash-261115", "content": {"type": "text", "text": "Soundwave particles rippling outward in dark studio space"} , "duration": 5, "resolution": "720p", "ratio": "16:9", }, , for res in mj job, kling job, seedance job : print f" {res 'model' } id={res 'task id' } cost usd=${res 'cost usd' } outputs={len res 'outputs' }" if name == " main ": asyncio.run main HTTP 410 afterward . Stream completed assets straight to S3, Cloudflare R2, or GCS in your worker. https://api.hop-base.com/mcp get model limits and list models without leaving your editor.