AI image and video generation + editing via MediaIO OpenAPI. Supports text-to-image, image-to-image, image-to-video, text-to-video, plus task and credits que...
This skill routes MediaIO OpenAPI requests based on scripts/c_api_doc_detail.json.
It provides a single entry point, Skill.invoke(api_name, params, api_key), covering credits queries, text-to-image, image-to-image, image-to-video, text-to-video, and task result lookups.
| Variable | Required | Description |
|---|---|---|
API_KEY | Yes | Media.io OpenAPI key, sent as X-API-KEY header. Apply at https://developer.media.io/. Use a least-privilege / test key; do not reuse broader platform credentials. |
https://openapi.media.ioAPI_KEY (used as X-API-KEY)API_KEY in your environment, or pass api_key explicitly to Skill.invoke(...).The current API definition includes 24 endpoints, grouped by capability:
Credits (query user credit balance)Task Result (query task status/result by task_id)Imagen 4soul_characterNano BananaSeedream 4.0Nano Banana ProWan 2.6 / Wan 2.2 / Wan 2.5Hailuo 02 / Hailuo 2.3Kling 2.1 / Kling 2.5 Turbo / Kling 2.6 / Kling 3.0Vidu Q2 / Vidu Q3Google Veo 3.1 / Google Veo 3.1 FastMotion Control Kling 2.6Wan 2.6 (Text To Video)Vidu Q3 (Text To Video)Wan 2.5 (Text To Video)api_name: API name (must exactly match the name field in c_api_doc_detail.json)params: Business parameter dictionary (only include fields defined in api_body)api_key: API key{"code": 0, "msg": "", "data": {...}, "trace_id": "..."}data.task_idTask Resultpip install requests
import os
from scripts.skill_router import Skill
skill = Skill('scripts/c_api_doc_detail.json')
api_key = os.getenv('API_KEY', '')
if not api_key:
raise RuntimeError('API_KEY is not set')
api_key from environment variable.Windows PowerShell�?
$env:API_KEY="your-api-key"
macOS / Linux (bash/zsh):
export API_KEY="your-api-key"
Credits)import os
from scripts.skill_router import Skill
skill = Skill('scripts/c_api_doc_detail.json')
api_key = os.getenv('API_KEY', '')
if not api_key:
raise RuntimeError('API_KEY is not set')
result = skill.invoke('Credits', {}, api_key=api_key)
print(result)
Imagen 4)import os
from scripts.skill_router import Skill
skill = Skill('scripts/c_api_doc_detail.json')
api_key = os.getenv('API_KEY', '')
if not api_key:
raise RuntimeError('API_KEY is not set')
result = skill.invoke(
'Imagen 4',
{
'prompt': 'a cute puppy, photorealistic, soft natural light, high detail',
'ratio': '1:1',
'counts': '1'
},
api_key=api_key
)
print(result) # When code=0, data usually contains task_id.
Task Result)import os
import time
from scripts.skill_router import Skill
skill = Skill('scripts/c_api_doc_detail.json')
api_key = os.getenv('API_KEY', '')
if not api_key:
raise RuntimeError('API_KEY is not set')
task_id = 'your-task-id'
for _ in range(24):
r = skill.invoke('Task Result', {'task_id': task_id}, api_key=api_key)
print(r)
status = (r.get('data') or {}).get('status')
if status in ('completed', 'failed', 'succeeded'):
break
time.sleep(5)
waiting: queuedprocessing: runningcompleted: completed successfullyfailed: failedtimeout: timed outrequired=true in api_body.ratio, duration, resolution) must use documented values.Task Result:
task_id, passed as {'task_id': 'xxx'} (path parameters are replaced automatically by the router).Credits:
params={}.Imagen 4 or Kling 3.0) to obtain task_id.Task Result.completed/succeeded, extract output URLs from data.result.{"error": "API 'xxx' not found."}{"error": "<exception message>"}{"error": "Invalid response", ...}374004: not authenticated. Apply for an APP KEY at https://developer.media.io/.490505: insufficient credits. Recharge before invoking generation APIs.c_api_doc_detail.json are unique, including text-to-video variants.name from the JSON definition.asyncio or threads.ZIP package — ready to use