AgentSkillsCN

aimlapi-media-gen

通过AIMLAPI(兼容OpenAI)根据提示词生成图像或视频。当Codex需要调用AI/ML API的媒体端点、批量处理图像或视频任务,或利用AIMLAPI凭证从文本提示中生成多媒体文件时,便可使用此功能。

SKILL.md
--- frontmatter
name: aimlapi-media-gen
description: Generate images or videos via AIMLAPI (OpenAI-compatible) from prompts. Use when Codex needs to call AI/ML API media endpoints, batch image/video jobs, or produce media files from text prompts using AIMLAPI credentials.

AIMLAPI Media Generation

Overview

Generate images and videos via the AIMLAPI OpenAI-compatible API using reusable scripts that handle auth, payloads, and media downloads.

Quick start

bash
export AIMLAPI_API_KEY="sk-aimlapi-..."
python3 {baseDir}/scripts/gen_image.py --prompt "ultra-detailed studio photo of a lobster astronaut"
python3 {baseDir}/scripts/gen_video.py --prompt "slow drone shot of a foggy forest" --model aimlapi/<provider>/<video-model>

Tasks

Generate images

Use scripts/gen_image.py to call /images/generations and save results locally.

bash
python3 {baseDir}/scripts/gen_image.py \
  --prompt "cozy cabin in a snowy forest" \
  --model aimlapi/openai/gpt-image-1 \
  --size 1024x1024 \
  --count 2 \
  --out-dir ./out/images

Notes:

  • Change --base-url if your AIMLAPI endpoint differs.
  • Use --extra-json to pass provider-specific parameters without editing the script.

Generate videos

Use scripts/gen_video.py to call the video generation endpoint and save the returned media.

bash
python3 {baseDir}/scripts/gen_video.py \
  --prompt "time-lapse of clouds over a mountain range" \
  --model aimlapi/<provider>/<video-model> \
  --endpoint videos/generations \
  --out-dir ./out/videos \
  --extra-json '{"duration": 6, "size": "1024x576"}'

Notes:

  • The video endpoint and payload fields vary by provider. Confirm the correct endpoint and fields in your AIMLAPI model docs and pass them via --endpoint and --extra-json.

References

  • references/aimlapi-media.md: endpoint and payload notes, plus troubleshooting tips.