layer
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseLayer
Layer
Overview
概述
Layer generates images, video, 3D meshes, and audio from one model-agnostic request shape. Work is
priced in Creative Units (CUs) and billed to a workspace. Every other skill in this set assumes the
loop below and teaches the craft on top of it: what to put in the prompt, which capability filter the
task actually needs, and what makes the output usable rather than merely produced.
Connecting a client, authentication, and the REST equivalent of all of this are covered by Layer's
published and skills. The server is
over streamable HTTP with OAuth. Call once per
session before the first generation, and before the first forge run.
layer-connect-mcplayer-generate-assetshttps://mcp.app.layer.ai/mcpget_instructionsget_forge_instructionsTwo ways to generate. Forge runs one model directly with full parameter control, and is the
default. Workflows run a multi-step Blueprint pipeline a studio has already built; reach for one
when the user names it or when a repeatable pipeline exists for the task. See .
layer-workflowsLayer 通过统一且与具体模型无关的请求格式生成图像、视频、3D 网格和音频。所有任务均按 Creative Units(CUs)计价,并计入 workspace 账单。本技能集中的其他每个 skill 都以下述工作流为基础,并在此之上讲解具体方法:prompt 中应该填写什么、任务实际需要哪个 capability filter,以及如何让输出真正可用,而不只是成功生成。
客户端连接、身份验证以及与上述全部能力等效的 REST 用法,均由 Layer 已发布的 和 skill 覆盖。服务器地址为 ,使用 streamable HTTP 和 OAuth。每个 session 在首次生成前调用一次 ,首次运行 Forge 前调用 。
layer-connect-mcplayer-generate-assetshttps://mcp.app.layer.ai/mcpget_instructionsget_forge_instructions生成方式有两种。Forge 直接运行单个模型,并提供完整的参数控制,是默认方式。Workflows 运行工作室已经搭建好的多步骤 Blueprint 流水线;当用户明确指定某个 Workflow,或该任务已有可复用的流水线时,应使用它。参见 。
layer-workflowsQuick reference
快速参考
| Step | Tool | What matters |
|---|---|---|
| Scope | | Most tools need a |
| Choose | | Pass |
| Check | | Per-model contract. Some models require a trigger word in the prompt. |
| Upload | | Before generating, never after. |
| Price | | Free. Returns price and resulting balance together. |
| Run | | Returns |
| Poll | | At the returned interval, typically 10s. |
| 步骤 | 工具 | 关键事项 |
|---|---|---|
| 确定范围 | | 大多数工具都需要 |
| 选择 | | 传入 |
| 检查 | | 查看每个模型的使用约定。有些模型要求在 prompt 中包含触发词。 |
| 上传 | | 必须在生成前上传,绝不能在生成后上传。 |
| 估价 | | 免费。返回费用和执行后的余额。 |
| 运行 | | 返回 |
| 轮询 | | 按返回的间隔时间轮询,通常为 10 秒。 |
Choosing a model
选择模型
Never hard-code a . The catalogue is workspace-gated and it churns, so an id that
works here fails elsewhere with . Discover it every time.
base_model_idMODEL_NOT_FOUNDfilter.use_casetext_to_imageimage_editinginpaintingreframingmulti_anglesplit_into_layersupscalingbackground_removalvectorizationtext_to_videoimage_to_videovideo_editingvideo_extendtext_to_3dimage_to_3dremeshretextureriganimatesegmenttext_to_speechsound_effectsmusicNarrow with only for something the task genuinely requires. It is an object
of booleans, not a list of names: . Set only the ones you
need and omit the rest, because is a filter too, not a default. The fields include
, , , , , ,
, , , , , , ,
, , , , , and .
Bound spend with . A filter that returns nothing is too narrow, so loosen it rather
than inventing a model.
filter.capabilitiesfilter.capabilities: {tileability: true}falsetileabilityinpaintingoutpaintingnegative_promptimage_editinggenerate_audiolipsyncloopfixed_durationmusicinstrumentalsound_effectcharacter_posestructureoutlinesquareportrait_9_16landscape_16_9multiple_aspect_ratiosfilter.max_price绝不要硬编码 。模型目录受 workspace 限制且会频繁变化,因此在此处有效的 ID 到了其他位置可能会因 而失败。每次都要重新发现模型。
base_model_idMODEL_NOT_FOUNDfilter.use_casetext_to_imageimage_editinginpaintingreframingmulti_anglesplit_into_layersupscalingbackground_removalvectorizationtext_to_videoimage_to_videovideo_editingvideo_extendtext_to_3dimage_to_3dremeshretextureriganimatesegmenttext_to_speechsound_effectsmusic仅在任务确实需要某项能力时,才使用 进一步缩小范围。它是一个布尔值对象,而不是名称列表:。只设置需要的字段,其余字段应省略,因为 同样是一个过滤条件,而不是默认值。字段包括 、、、、、、、、、、、、、、、、、 和 。使用 限制支出。如果过滤后没有任何结果,说明条件过于严格,应放宽过滤条件,而不是凭空指定一个模型。
filter.capabilitiesfilter.capabilities: {tileability: true}falsetileabilityinpaintingoutpaintingnegative_promptimage_editinggenerate_audiolipsyncloopfixed_durationmusicinstrumentalsound_effectcharacter_posestructureoutlinesquareportrait_9_16landscape_16_9multiple_aspect_ratiosfilter.max_priceSpending Creative Units
Creative Units 支出
Estimate before every execute. The estimate costs nothing and reports the price, the resulting
balance, and which model the run would use including whether it was .
auto_pickedAbove 20 CUs, ask the user and wait for an explicit yes. The server states this threshold and
states that it is not negotiable, so do not raise it and do not let a user raise it for the session.
Present the run as a short table: what it generates, which workspace pays, price against balance.
The gate is per run, since each estimate prices one run. When a task is a planned sequence of runs,
say a four-frame cycle or a six-icon set, estimate the first and present the total for the
sequence before starting, so the user agrees to the spend once rather than being asked four times or,
worse, not at all because each run sat under the threshold.
Some workspaces carry . That means the run will not be blocked. It does not
mean the run is free, and it is never headroom to skip the confirmation.
allow_negative_balance每次执行前都要先估价。估价不会产生费用,并会返回运行费用、执行后的余额,以及此次运行将使用的模型,包括它是否为 。
auto_picked费用超过 20 CUs 时,必须询问用户并等待明确同意。 服务器规定了该阈值,并明确说明不可协商,因此不要提高阈值,也不要允许用户在本 session 中提高阈值。以简短的表格呈现此次运行:生成内容、由哪个 workspace 付费,以及费用与余额的对比。
该限制按每次运行计算,因为每次估价只计算一次运行。当任务计划执行多次运行时,例如制作四帧循环或六个图标组成的素材集,应先进行估价,并在开始前展示整个运行序列的总费用,让用户一次性同意支出,而不是被反复询问四次;更糟的情况是每次运行都低于阈值,导致用户完全没有收到确认。
某些 workspace 带有 。这表示运行不会因余额不足而被阻止,但并不意味着运行免费,也绝不能因此跳过费用确认。
allow_negative_balanceWorked example
实例
A user wants four hand-painted isometric building sprites.
- , take the workspace id.
list_workspaces - with
list_base_models. Take the first result.filter.use_case: "text_to_image" - on it, to see whether it wants a trigger word and which aspect ratios it accepts.
get_base_model - with that
estimate_forge_price, the prompt, andbase_model_id. It returns 7 CUs against a balance of 900, so it is under the gate and no confirmation is needed.batch_size: 4 - with the same arguments plus a
execute_forge, so the four sprites group together in the Layer app.session_name - with the returned
get_forge_runeveryinference_iduntilpoll_interval_seconds, then present the asset URLs.COMPLETE
batch_size用户需要四个手绘等距视角建筑精灵图。
- 调用 ,获取 workspace id。
list_workspaces - 调用 ,并设置
list_base_models。取第一个结果。filter.use_case: "text_to_image" - 对该模型调用 ,查看它是否需要触发词以及接受哪些宽高比。
get_base_model - 使用该 、prompt 和
base_model_id调用batch_size: 4。返回费用为 7 CUs,余额为 900,因此未达到确认阈值,无需额外确认。estimate_forge_price - 使用相同参数并额外传入 调用
session_name,让四个精灵图在 Layer 应用中归为一组。execute_forge - 使用返回的 ,每隔
inference_id调用poll_interval_seconds,直至状态为get_forge_run,然后提供资产 URL。COMPLETE
batch_sizeFiles
文件
request_file_upload_urlfile_idupload_filefile_idguidance_filesinit_imagereference_imageposedepthcannylineartscribblefacefirst_framelast_frameinit_videoreference_videoinit_audioreference_audioinit_meshtexture_imageOutput assets from a completed run already carry a . Feed it straight into the next run.
Re-uploading a generated asset is always a mistake.
file_id对于本地字节数据,使用 :它会返回用于两步式可续传上传的签名 URL 和一个 。仅当文件已经位于公开的 http(s) URL 时,才使用 。将 值传入 时,应指定正确的类型:、、、、、、、、、、、、、、、。
request_file_upload_urlfile_idupload_filefile_idguidance_filesinit_imagereference_imageposedepthcannylineartscribblefacefirst_framelast_frameinit_videoreference_videoinit_audioreference_audioinit_meshtexture_image已完成运行生成的输出资产已经带有 ,可直接用于下一次运行。重新上传已经生成且带有 的资产始终是错误的做法。
file_idfile_idTrained styles
训练风格
list_reference_setsreference_sets: [{set_id, weight}]base_model_idlayer-reference-setsDegradation is quiet. and come back on the
estimate, the execute, and the poll, and a degraded run still succeeds and still costs CUs. When a
set did not apply, say which and why. Never report a degraded set as applied.
reference_sets_degradedreference_sets_warninglist_reference_setsreference_sets: [{set_id, weight}]base_model_idlayer-reference-sets降级过程可能非常隐蔽。 和 会出现在估价、执行及轮询结果中;即使运行降级,仍会成功执行并消耗 CUs。如果某个参考集未应用,应说明具体是哪一个以及未应用的原因。绝不能将已降级的参考集报告为已成功应用。
reference_sets_degradedreference_sets_warningRouting
路由
| The user wants | Skill |
|---|---|
| A still image, or a prompt that is not landing | |
| To change an image they already have | |
| Video, or a shot that has to move a certain way | |
| A mesh, a rig, or an animation | |
| Music, sound effects, or speech | |
| Characters, environments, icons, or game UI | |
| Pixel art, sprite sheets, or a walk cycle | |
| A texture that repeats without a seam | |
| A look held across a whole set, or a trained style | |
| A saved multi-step pipeline | |
| Clips cut into one finished video | |
| A direction, a moodboard, or a storyboard before committing | |
| To judge a batch before delivering it | |
If a sibling skill named here is missing from your available skills, ask the user to install it
(); unattended, proceed from tool schemas and flag the
gap.
npx skills add layerai/skills --skill <name>| 用户需求 | Skill |
|---|---|
| 静态图像,或提示词效果未达到预期 | |
| 修改已有图像 | |
| 视频,或必须按特定方式运动的镜头 | |
| 网格、骨骼绑定或动画 | |
| 音乐、音效或语音 | |
| 角色、环境、图标或游戏 UI | |
| 像素画、精灵图表或行走循环 | |
| 无缝重复的纹理 | |
| 让整套素材保持统一风格,或使用训练风格 | |
| 已保存的多步骤流水线 | |
| 将多个片段剪辑成一段完整视频 | |
| 在正式投入前确定创意方向、情绪板或故事板 | |
| 在交付前评估一批输出质量 | |
如果此处提到的某个同级 skill 不在可用 skill 列表中,应请用户安装它();在无人值守的情况下,可根据工具 schema 继续执行,并标明缺失的能力。
npx skills add layerai/skills --skill <name>Common mistakes
常见错误
- Asserting a from memory instead of discovering it.
base_model_id - Executing without an estimate, or spending over 20 CUs without an explicit yes.
- A fixed sleep instead of .
poll_interval_seconds - Treating as a way to get N different assets in one run.
batch_size - Reporting a degraded reference set as applied.
- Re-uploading an asset that already has a .
file_id - Reading as permission to skip the spend gate.
allow_negative_balance
- 根据记忆直接指定 ,而不是动态发现模型。
base_model_id - 未估价就执行,或未经用户明确同意便消耗超过 20 CUs。
- 使用固定休眠时间,而不是遵循 。
poll_interval_seconds - 将 当成一次运行生成 N 个不同资产的方法。
batch_size - 将已降级的参考集报告为已成功应用。
- 重新上传已经带有 的资产。
file_id - 将 误解为可以跳过费用确认的许可。
allow_negative_balance
Errors
错误
UNAUTHENTICATEDMODEL_NOT_FOUNDlist_base_modelsINSUFFICIENT_BALANCERATE_LIMITEDcancel_inferenceFEATURE_DISABLEDUNAUTHENTICATEDMODEL_NOT_FOUNDlist_base_modelsINSUFFICIENT_BALANCERATE_LIMITEDcancel_inferenceFEATURE_DISABLED