mediaio-generate

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Media.io Generate

Media.io 生成

Submit image and video jobs through the current
mediaio
CLI contract. Treat CLI help, model/workflow/effect discovery, and
model get
/
workflow get
output as the source of truth.
通过当前
mediaio
CLI协议提交图片和视频任务。将CLI帮助信息、模型/工作流/效果发现结果以及
model get
/
workflow get
的输出作为权威依据。

Step 0 — Bootstrap

步骤0 — 初始化准备

Before any generation command:
  1. Run
    command -v mediaio
    and
    mediaio version
    . If the command is missing, tell the user that the shared Media.io CLI must be installed; do not silently install a second runtime from this skill.
  2. Network approval gate (hard requirement). Before launching the first networked
    mediaio
    process in the current task, submit that Shell/Bash tool call through the host's narrowest native network-only approval mechanism, scoped to the required destination when supported. Do not first run
    mediaio account status
    ,
    auth login
    , discovery, upload, generation, or wait commands in the default sandbox as a connectivity probe. Approval metadata belongs to the host tool call, not to
    mediaio
    CLI arguments.
  3. Wait until the approval is accepted or automatically approved before launching the process. If network-only approval is unavailable, use a general out-of-sandbox approval only after reviewing its wider scope and presenting that approval to the user. If the command may write local state (including
    auth login
    persisting credentials), also request filesystem-write authorization; do not infer whether the target is inside the sandbox. If the host cannot request the required approval, report the host limitation and stop instead of attempting a known-to-fail sandboxed request. A global Codex permission-profile edit is not a prerequisite.
  4. Run
    mediaio account status
    using the approved execution path. If authentication is genuinely missing, expired or rejected by the server, run
    mediaio auth login
    and wait for the browser flow to finish. DNS, TLS, timeout, connection and sandbox-denial errors are network failures, not authentication failures.
  5. On a network or permission failure, load
    references/troubleshooting.md
    . Retry read-only commands only after a clear pre-connection sandbox/DNS failure; never automatically retry a write with an ambiguous result.
  6. Run
    mediaio config get
    when an endpoint or environment mismatch is suspected.
在执行任何生成命令前:
  1. 运行
    command -v mediaio
    mediaio version
    。如果命令不存在,告知用户必须安装共享的Media.io CLI;切勿从本技能中静默安装第二个运行时。
  2. 网络批准门槛(硬性要求)。在当前任务中首次启动联网的
    mediaio
    进程前,通过主机最严格的原生仅网络批准机制提交该Shell/Bash工具调用,若支持则限定到所需目标地址。切勿先在默认沙箱中运行
    mediaio account status
    auth login
    、发现、上传、生成或等待命令来探测连通性。批准元数据属于主机工具调用,而非
    mediaio
    CLI参数。
  3. 等待批准被接受或自动批准后再启动进程。如果仅网络批准不可用,在审查其更广范围并向用户展示该批准请求后,再使用通用的沙箱外批准。如果命令可能写入本地状态(包括
    auth login
    持久化凭据),还需请求文件系统写入授权;不要推断目标是否在沙箱内。如果主机无法请求所需批准,报告主机限制并停止操作,不要尝试已知会失败的沙箱内请求。全局Codex权限配置文件编辑不是必要前提。
  4. 使用已批准的执行路径运行
    mediaio account status
    。如果确实缺少认证、认证过期或被服务器拒绝,运行
    mediaio auth login
    并等待浏览器流程完成。DNS、TLS、超时、连接和沙箱拒绝错误属于网络故障,而非认证故障。
  5. 遇到网络或权限故障时,加载
    references/troubleshooting.md
    。仅在明确的预连接沙箱/DNS故障后重试只读命令;切勿自动重试结果不明确的写入操作。
  6. 当怀疑端点或环境不匹配时,运行
    mediaio config get

UX Rules

用户体验规则

  1. Be concise. Do not paste raw registry output or full response payloads unless the user asks for diagnostics.
  2. Do not expose access tokens, credentials, prompts from unrelated tasks, or request debug payloads.
  3. Detect the user's language from the first message and reply in it. Technical args (
    --aspect_ratio 16:9
    ) stay English.
  4. Don't batch-ask. Pick a sane default model and ask one thing at a time only if genuinely missing.
  5. Never invent a job type or parameter. Discover both from the current CLI.
  6. Submit first, extract the returned
    task_id
    , then call
    mediaio generate wait <task_id>
    . The current
    generate create
    command does not accept
    --wait
    .
  1. 保持简洁。除非用户要求诊断信息,否则不要粘贴原始注册表输出或完整响应负载。
  2. 不要暴露访问令牌、凭据、无关任务的提示词,或请求调试负载。
  3. 从用户的第一条消息检测其语言并使用该语言回复。技术参数(如
    --aspect_ratio 16:9
    )保留英文。
  4. 不要批量提问。选择合理的默认模型,仅在确实缺少信息时逐个提问。
  5. 切勿虚构任务类型或参数。从当前CLI中发现这两者。
  6. 先提交任务,提取返回的
    task_id
    ,然后调用
    mediaio generate wait <task_id>
    。当前
    generate create
    命令不支持
    --wait
    参数。

Discovery guardrail

发现机制约束

When looking for a Media.io feature/model, first run the relevant unfiltered list, then inspect the exact job type. List output is human-readable; the current list/get commands do not accept
--json
.
Workflows and effects are separate discovery views, but they are submitted through the same command:
mediaio generate create <job_type> ...
. The current CLI has no
effect get
; never guess effect parameters from the list summary.
查找Media.io功能/模型时,先运行相关的未过滤列表,然后检查确切的任务类型。列表输出是易读的;当前的list/get命令不支持
--json
参数。
工作流和效果是分开的发现视图,但它们通过同一命令提交:
mediaio generate create <job_type> ...
。当前CLI没有
effect get
命令;切勿从列表摘要猜测效果参数。

Workflow — generic generation

工作流 — 通用生成流程

  1. Discover. Run one of:
    bash
    mediaio model list
    mediaio workflow list
    mediaio effect list
  2. Inspect. Use the exact identifier from the first column:
    bash
    mediaio model get <job_type>
    mediaio workflow get <workflow_name>
    For an effect, stop if its required parameters have not already been verified from current BIN/service evidence;
    effect list
    alone is not a parameter schema.
  3. Prepare local media and check file access. The current generator does not auto-upload local paths. Before reading or uploading each user-provided path:
    • Resolve relative paths against the current working directory without following an untrusted path blindly, and determine whether the resolved file is inside the active workspace.
    • For a path inside the workspace, continue with the normal host file-read rules.
    • For a path outside the workspace, pause and request the host's native file-read authorization for the exact file (or the smallest explicit set of files). State the paths and that they will be uploaded to Media.io. Do not launch
      mediaio upload create
      until that authorization is accepted.
    • If the host cannot provide file-read authorization, stop and ask the user to grant access or move/copy the file into the workspace. Never bypass this by broadening access silently.
    After the required file authorization and network approval are available, upload each local file first, save the returned
    file_id
    , then pass that ID using the exact parameter name shown by
    model get
    or
    workflow get
    :
    bash
    mediaio upload create ./reference.png
  4. Submit. Pass only parameters exposed by the live schema:
    bash
    mediaio generate create <job_type> [--param value]...
  5. Wait. Extract
    task_id
    from the
    data:
    line of the create response, then run:
    bash
    mediaio generate wait <task_id> --timeout 20m --interval 3s
  6. Deliver. Read the terminal response and extract the primary generated asset HTTPS URL and its type. For an image, follow this order:
    1. Create a writable temporary directory with
      mktemp -d
      , then set
      download_path
      to a new path inside it such as
      <temp-dir>/generated.bin
      .
    2. Download directly; do not use a Media.io download command because
      generate wait
      already returns the HTTPS result URL:
      bash
      curl --fail --location --retry 2 \
        --connect-timeout 15 --max-time 120 \
        --output "$download_path" "$url"
    3. Require a non-empty file, then inspect it with
      file --brief --mime-type "$download_path"
      . Continue only for
      image/*
      . Derive an accurate extension from common MIME types (
      image/png
      png
      ,
      image/jpeg
      jpg
      ,
      image/webp
      webp
      ,
      image/gif
      gif
      ) before giving the path to the host; never label an unknown image as PNG.
    4. Rename the file to a matching extension inside the writable temporary directory, then deliver it back to the host as a local-path Markdown image using the standard syntax
      ![preview](<local-path>)
      . When the local path contains spaces, parentheses, or non-ASCII characters, wrap the target in angle brackets. Prefer the local downloaded file over the remote HTTPS URL.
    5. Report completion only after providing the local Markdown image snippet, or after establishing that local-path Markdown cannot be used in the current host. In the latter case, explicitly say inline local preview is unavailable and provide the HTTPS URL as the fallback.
    6. Do not remove the temporary directory before the final response is sent, because the host may resolve the local Markdown path when rendering the reply. If local Markdown delivery fails, retain only enough diagnostic detail to retry and provide the HTTPS URL as fallback.
    For video, audio, 3D, or other non-image outputs, provide the result URL rather than attempting an image attachment.
  1. 发现。运行以下命令之一:
    bash
    mediaio model list
    mediaio workflow list
    mediaio effect list
  2. 检查。使用第一列中的确切标识符:
    bash
    mediaio model get <job_type>
    mediaio workflow get <workflow_name>
    对于效果,如果其所需参数尚未从当前BIN/服务证据中验证,则停止操作;仅
    effect list
    不足以作为参数架构依据。
  3. 准备本地媒体并检查文件访问权限。当前生成器不会自动上传本地路径。在读取或上传每个用户提供的路径前:
    • 相对于当前工作目录解析相对路径,不要盲目跟随不可信路径,并确定解析后的文件是否在活动工作区内。
    • 对于工作区内的路径,按照正常的主机文件读取规则继续操作。
    • 对于工作区外的路径,暂停并请求主机对确切文件(或最小的明确文件集)的原生文件读取授权。说明路径以及这些文件将被上传到Media.io。在获得授权前不要启动
      mediaio upload create
      命令。
    • 如果主机无法提供文件读取授权,停止操作并要求用户授予访问权限或将文件移动/复制到工作区内。切勿通过静默扩大访问权限来绕过此步骤。
    在获得所需的文件授权和网络批准后,先上传每个本地文件,保存返回的
    file_id
    ,然后使用
    model get
    workflow get
    显示的确切参数名称传递该ID:
    bash
    mediaio upload create ./reference.png
  4. 提交。仅传递实时架构中暴露的参数:
    bash
    mediaio generate create <job_type> [--param value]...
  5. 等待。从create响应的
    data:
    行提取
    task_id
    ,然后运行:
    bash
    mediaio generate wait <task_id> --timeout 20m --interval 3s
  6. 交付。读取终端响应并提取主要生成资产的HTTPS URL及其类型。对于图片,按照以下顺序操作:
    1. 使用
      mktemp -d
      创建可写临时目录,然后将
      download_path
      设置为该目录内的新路径,例如
      <temp-dir>/generated.bin
    2. 直接下载;不要使用Media.io的下载命令,因为
      generate wait
      已返回HTTPS结果URL:
      bash
      curl --fail --location --retry 2 \
        --connect-timeout 15 --max-time 120 \
        --output "$download_path" "$url"
    3. 确保文件非空,然后使用
      file --brief --mime-type "$download_path"
      检查文件类型。仅当类型为
      image/*
      时继续操作。从常见MIME类型推导准确的扩展名(
      image/png
      png
      image/jpeg
      jpg
      image/webp
      webp
      image/gif
      gif
      ),然后将路径提供给主机;切勿将未知图片标记为PNG。
    4. 在可写临时目录内将文件重命名为匹配的扩展名,然后使用标准Markdown语法
      ![preview](<local-path>)
      将其作为本地路径的图片交付给主机。当本地路径包含空格、括号或非ASCII字符时,用尖括号包裹目标路径。优先使用本地下载的文件,而非远程HTTPS URL。
    5. 仅在提供本地Markdown图片片段后,或确定当前主机无法使用本地路径Markdown后,再报告完成。在后一种情况下,明确说明无法提供内联本地预览,并提供HTTPS URL作为备选。
    6. 在发送最终响应前不要删除临时目录,因为主机在渲染回复时可能需要解析本地Markdown路径。如果本地Markdown交付失败,仅保留足够的诊断细节以重试,并提供HTTPS URL作为备选。
    对于视频、音频、3D或其他非图片输出,提供结果URL而非尝试图片附件。

Verified image generation

已验证的图片生成

For text-only GPT Image 2, current discovery exposes
text2image_gpt_image_2
with
--prompt
,
--n
,
--quality
,
--model
,
--size
, and
--output_format
.
bash
mediaio model get text2image_gpt_image_2
mediaio generate create text2image_gpt_image_2 \
  --prompt "a warm, photorealistic portrait of a golden retriever at sunset" \
  --quality high \
  --size 1024x1024 \
  --output_format png
Do not replace this with the legacy short name
gpt_image_2
; it is not the current registry key. Do not append
--wait
to the create command.
For image-to-image GPT Image 2, upload each source first and use the live repeated flag
--images <file_id>
with
image2image_gpt_image_2
.
对于纯文本的GPT Image 2,当前发现结果显示
text2image_gpt_image_2
支持
--prompt
--n
--quality
--model
--size
--output_format
参数。
bash
mediaio model get text2image_gpt_image_2
mediaio generate create text2image_gpt_image_2 \
  --prompt "a warm, photorealistic portrait of a golden retriever at sunset" \
  --quality high \
  --size 1024x1024 \
  --output_format png
不要将其替换为旧版短名称
gpt_image_2
;这不是当前注册表的键。不要在create命令后追加
--wait
参数。
对于图片转图片的GPT Image 2,先上传每个源图片,然后使用实时重复标志
--images <file_id>
image2image_gpt_image_2

Current capability boundary

当前功能边界

Only the command families printed by the current
mediaio --help
output are executable. The migrated reference set also describes future or retired surfaces that are not part of the current BIN:
  • workflow-specific create helpers, standalone cost estimation, and retired result helpers
  • optional JSON output for model/workflow/effect discovery or schema commands
  • one-shot create-and-wait flags
  • automatic upload of local paths passed directly to generation parameters
  • hard-coded 3D, audio, Virality Predictor, Soul ID, product-photoshoot, game-generation, or video-explainer routes absent from live discovery
仅可执行当前
mediaio --help
输出中显示的命令族。迁移后的参考集还描述了不属于当前BIN的未来或已停用功能:
  • 工作流专用的创建助手、独立成本估算和已停用的结果助手
  • 模型/工作流/效果发现或架构命令的可选JSON输出
  • 一次性创建并等待的标志
  • 自动上传直接传递给生成参数的本地路径
  • 实时发现中不存在的硬编码3D、音频、Virality Predictor、Soul ID、产品拍摄、游戏生成或视频解说路由

Errors

错误处理

  • flag provided but not defined: -wait
    → remove
    --wait
    , submit, then call
    mediaio generate wait <task_id>
    .
  • flag provided but not defined: -json
    → remove
    --json
    ; this command currently has no JSON mode.
  • unknown job type
    → rerun the relevant live list and use its exact first-column identifier.
  • missing required flag(s)
    or
    invalid value
    → inspect the live schema and pass only exposed values.
  • endpoint
    404
    during create → verify the BIN build routes creation through the configured combo_alg endpoint; do not switch models because this is not a prompt/model-selection error.
  • missing credentials, an HTTP 401, or an explicit token-refresh rejection → run
    mediaio auth login
    .
  • flag provided but not defined: -wait
    → 删除
    --wait
    参数,提交任务,然后调用
    mediaio generate wait <task_id>
  • flag provided but not defined: -json
    → 删除
    --json
    参数;此命令当前无JSON模式。
  • unknown job type
    → 重新运行相关的实时列表并使用其第一列的确切标识符。
  • missing required flag(s)
    invalid value
    → 检查实时架构并仅传递暴露的值。
  • 创建时端点返回
    404
    → 验证BIN构建是否通过配置的combo_alg端点创建路由;不要切换模型,因为这不是提示词/模型选择错误。
  • 缺少凭据、HTTP 401或明确的令牌刷新拒绝 → 运行
    mediaio auth login

Reference docs

参考文档

Load references on demand:
  • references/prompt-engineering.md
    for prompt-writing guidance
  • references/media-inputs.md
    when the user provides local or uploaded media
  • references/workflows.md
    for a job type returned by live workflow discovery
  • references/troubleshooting.md
    after a current command fails
按需加载参考文档:
  • references/prompt-engineering.md
    :提示词编写指南
  • references/media-inputs.md
    :用户提供本地或已上传媒体时参考
  • references/workflows.md
    :实时工作流发现返回的任务类型参考
  • references/troubleshooting.md
    :当前命令失败后参考