当前位置: 首页 > Skill >

Media.io AI Image & Video Generation API

Media.io AI Image & Video Generation API

Media.io AI Image & Video Generation API

通过Media.io OpenAPI生成和编辑AI图像及视频,支持文生图、图生图、文生视频、图生视频及查询任务状态等功能。

1.0.14 2026.11.25 493
获取Skill文件查看使用说明
作 者:沈宁 许可证: 更新时间:2026.11.25
本文目录展开

MediaIO AIGC Generate Skill

Overview

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.

Requirements

Environment Variables

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.

Provenance and Credential Notes

  • Maintainer: community-maintained skill (not an official Media.io release)
  • Reference homepage: https://developer.media.io/
  • Reference API docs: https://platform.media.io/docs/
  • Target API domain used by this skill: https://openapi.media.io
  • Required credential: API_KEY (used as X-API-KEY)
  • Security recommendation: use a least-privilege/test key, avoid reusing broader platform credentials.
  • Credential loading: set API_KEY in your environment, or pass api_key explicitly to Skill.invoke(...).

API Coverage (from c_api_doc_detail.json)

The current API definition includes 24 endpoints, grouped by capability:

  • Query APIs
    • Credits (query user credit balance)
    • Task Result (query task status/result by task_id)
  • Text To Image�?�?
    • Imagen 4
    • soul_character
  • Image To Image�?�?
    • Nano Banana
    • Seedream 4.0
    • Nano Banana Pro
  • Image To Video�?4�?
    • Wan 2.6 / Wan 2.2 / Wan 2.5
    • Hailuo 02 / Hailuo 2.3
    • Kling 2.1 / Kling 2.5 Turbo / Kling 2.6 / Kling 3.0
    • Vidu Q2 / Vidu Q3
    • Google Veo 3.1 / Google Veo 3.1 Fast
    • Motion Control Kling 2.6
  • Text To Video�?�?
    • Wan 2.6 (Text To Video)
    • Vidu Q3 (Text To Video)
    • Wan 2.5 (Text To Video)

Input and Output Format

  • Input:
    • 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
  • Output:
    • Returns the raw API response payload (dict/json)

Common Response Structure

  • Success response is typically: {"code": 0, "msg": "", "data": {...}, "trace_id": "..."}
  • Asynchronous generation APIs usually return: data.task_id
  • Final artifacts should be retrieved by polling Task Result

Quick Start

1) Install Dependency

pip install requests

2) Initialize Skill

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')

3) Configure Environment Variable API_KEY

  • Purpose: provide a shared key source for local scripts.
  • Note: examples below read api_key from environment variable.

Windows PowerShell�?

$env:API_KEY="your-api-key"

macOS / Linux (bash/zsh):

export API_KEY="your-api-key"

Usage Examples (Python)

Example A: Query Credits (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)

Example B: Text-to-Image (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.

Example C: Query Task Result (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)

Task Status Reference

  • waiting: queued
  • processing: running
  • completed: completed successfully
  • failed: failed
  • timeout: timed out

Parameter Guidance (by Capability)

  • Text To Image / Image To Image / Video APIs:
    • Required parameters are defined by required=true in api_body.
    • Enum fields (for example ratio, duration, resolution) must use documented values.
  • Task Result:
    • Requires task_id, passed as {'task_id': 'xxx'} (path parameters are replaced automatically by the router).
  • Credits:
    • No business parameters are required; use params={}.

Typical Invocation Flow

  1. Call a generation API (for example Imagen 4 or Kling 3.0) to obtain task_id.
  2. Poll the same task using Task Result.
  3. When status is completed/succeeded, extract output URLs from data.result.

Error Handling Notes

  • API not found: returns {"error": "API 'xxx' not found."}
  • Request exception: returns {"error": "<exception message>"}
  • Invalid response format: returns {"error": "Invalid response", ...}

Additional Response Code Notes

  • 374004: not authenticated. Apply for an APP KEY at https://developer.media.io/.
  • 490505: insufficient credits. Recharge before invoking generation APIs.

Important Implementation Notes

  • API names in c_api_doc_detail.json are unique, including text-to-video variants.
  • The router validates duplicate names at load time and fails fast if duplicates are reintroduced.
  • For best compatibility, invoke APIs by exact name from the JSON definition.

Extension and Integration Recommendations

  • Add asynchronous invocation via asyncio or threads.
  • Auto-generate parameter validation and type hints from API metadata.
  • Package this skill as a microservice/API for multi-client integration.

External Resources

  • API documentation: https://platform.media.io/docs/
  • Product overview: https://developer.media.io/
  • Credit purchase: https://developer.media.io/pricing.html

Related Files

  • scripts/skill_router.py: core routing logic
  • scripts/c_api_doc_detail.json: API definitions

推荐文章

更多
PHP时间戳与日期字符串相互转换方法详解

本文介绍PHP中时间数值(Unix时间戳)与日期字符串之间的相互转换方法。通过strtotime和date函数,实现将当前时间、指定日期转换为时间戳,以及将时间戳格式化为可读的日期时间字符串,并提供相关在线计算工具推荐。

2025.11.30 1,016
PHP跨域配置:怎么安全地允许指定域名而非使用通配符

在 PHP 中安全地允许指定域名跨域,核心是解析请求头中的 Origin ,验证其是否在白名单内,然后动态设置 Access-Control-Allow-Origin 响应头。不要使用通配符 * ,也不要硬编码单一域名。

2025.03.29 1,004
PHP集成RabbitMQ实现消息队列的完整步骤

使用 php-amqplib 库,通过建立连接、声明交换机与队列并绑定,即可在 PHP 中实现消息的发送与消费。

2026.05.24 1,001
Apache开启.htaccess及使用方法详解

本文介绍如何在本地Apache环境中启用.htaccess文件,主要涉及修改httpd.conf中的AllowOverride参数。同时详细解析.htaccess的多种实用功能,包括自定义错误页面、目录密码保护、IP访问限制、URL自动转向、默认首页设置以及防止图片盗链等配置方法,并分析了使用.htaccess对服务器性能和安全性的潜在影响。

2026.05.09 1,001
JavaScript中利用replace结合正则实现replaceAll效果

JavaScript原生仅支持replace()进行单次或全局替换,缺乏类似Java的replaceAll()便捷方法。本文总结四种在JS中实现全量替换的方案:使用带g标志的正则、带gm标志的正则、扩展String原型以及split后join。通过对比代码示例,展示各方法的实现细节与适用场景,帮助开发者根据需求选择最优解。

2025.04.29 1,001
Linux内核提权风险待核实,先查版本与补丁

CVE-2026-78901在摘要中被称为Linux内核ext4本地提权漏洞,CVSS评分7.8,但上游正文暂未核实。本文提供通用只读排查命令,帮运维和开发者核对当前运行内核、发行版补丁及升级生效状态。

2026.12.02 1,000
Skill 文件
  • SKILL.md
    • MediaIO AIGC Generate Skill
    • Overview
    • Requirements
      • Environment Variables
    • Provenance and Credential Notes
    • API Coverage (from c_api_doc_detail.json)
    • Input and Output Format
      • Common Response Structure
    • Quick Start
      • 1) Install Dependency
      • 2) Initialize Skill
      • 3) Configure Environment Variable API_KEY
    • Usage Examples (Python)
      • Example A: Query Credits (Credits)
      • Example B: Text-to-Image (Imagen 4)
      • Example C: Query Task Result (Task Result)
      • Task Status Reference
    • Parameter Guidance (by Capability)
    • Typical Invocation Flow
    • Error Handling Notes
    • Additional Response Code Notes
    • Important Implementation Notes
    • Extension and Integration Recommendations
    • External Resources
    • Related Files
  • 项目或源文件

相关 Skill

更多
Pixshop CLI — AI Image & Video Generation Pixshop CLI — AI Image & Video Generation Pixshop CLI 命令行工具 — AI 图片/视频生成、编辑工具、应用市场、提示词库 / Pixshop CLI — command-line AI image/video generation, editing tools, apps, prompts. Use when user wants to ge...
AI Image & Video Generation AI Image & Video Generation 使用 VibeVideo API 生成图片和视频。当用户请求创建 AI 图片或视频、查询生成状态、列出可用模型等时使用。
service-qa-coach service-qa-coach Review support quality for chat, email, phone, social DM, or marketplace service teams. Use when a team needs a QA scorecard, failure-mode analysis, coaching plan, calibration checklist, or service-improvement brief without live ticketing, CRM, or contact-center system access.
高中数学作业批改助手 高中数学作业批改助手 >图片识别 直接读取学生手写作答照片,识别公式、符号、步骤 🧮 自动推导 根据题目自动生成参考答案和评分细则,无需教师预设 📊 逐步给分 每个关键步骤独立评分,体现过程分 📝 结构化报告 输出含识别内容、参考答案、逐步评分、改进建议的完整报告 🗂 批量批改 支持一次性批改多道题,最终汇总得分表
Vibration Analysis Vibration Analysis 分析来自CMS趋势、RMS/峰值、频谱及SCADA报警的风机传动链(主轴、齿轮箱、发电机)振动数据。