---
name: layer-generate-assets
description: Generate and edit game and entertainment assets on Layer — images, video, 3D meshes, and audio — across FLUX, Imagen, Recraft, Kling, Minimax and other models, via the REST API or MCP. Use when asked to produce concept art, sprites, textures, icons, marketing video, 3D models, voice, or music, to edit an existing asset, or to price a generation before running it.
---

# Generate assets with Layer

One call runs a model; Layer is model-agnostic, so the same request shape drives every provider.
Work is priced in **Creative Units (CUs)** and billed to a workspace.

## The loop

1. **Pick a model.** `GET /v2/workspaces/{workspace_id}/base-models` lists the catalog;
   `GET /v2/workspaces/{workspace_id}/base-models/defaults` returns Layer's recommendations per
   modality and use case. Omit `base_model_id` entirely and Layer picks one — the estimate
   response tells you which, in `base_model_id`, with `auto_picked: true`.
2. **Learn the model's parameters.**
   `GET /v2/workspaces/{workspace_id}/base-models/{slug}/inference-schema` returns the input
   schema for that one model, so you send the fields it actually accepts rather than guessing.
3. **Estimate.** `POST /v2/workspaces/{workspace_id}/inferences/estimate` with the request you
   intend to run. It costs nothing and returns `estimated_price_creative_units`,
   `workspace_balance_creative_units`, and `has_sufficient_creative_units`. **Read that last
   field before executing** — there is no sandbox environment, and an estimate is the supported
   way to rehearse a call for free.
4. **Execute.** `POST /v2/workspaces/{workspace_id}/inferences` returns `inference_id`,
   `status`, and `poll_interval_seconds`.
5. **Poll.** `GET /v2/workspaces/{workspace_id}/inferences/{inference_id}` on the interval the
   response gives you — Layer delivers no webhooks, so polling is the supported pattern. `status`
   moves through `in_progress` to `complete`, `failed`, or `cancelled`. On `complete`, `outputs`
   carries the assets and `actual_price_creative_units` the real cost.
6. **Cancel** a run you no longer need with
   `POST /v2/workspaces/{workspace_id}/inferences/{inference_id}/cancel`, so it stops consuming
   CUs.

```bash
curl -X POST -H "Authorization: Bearer $LAYER_TOKEN" -H "Content-Type: application/json" \
  https://api.app.layer.ai/api/v2/workspaces/$WORKSPACE_ID/inferences/estimate \
  -d '{"prompt": "isometric stone tower, hand-painted, game asset", "modality": "IMAGE"}'
```

## Inputs beyond the prompt

- **Reference sets** — `reference_sets: [{ set_id, weight }]` applies a trained style or a set of
  reference images. List them with `GET /v2/workspaces/{workspace_id}/reference-sets`. To make
  one, see the `layer-train-custom-style` skill.
- **Guidance files and masks** — `guidance_files` and `mask` drive image-to-image, editing,
  and inpainting from files already in the workspace.
- **Modality-specific fields** — `duration_seconds`, `fps`, `generate_audio` for video;
  `include_textures`, `quad_mesh`, `pbr_materials`, `face_limit` for 3D; `lyrics`,
  `instrumental`, `speed` for audio. The per-model inference schema is the authority on which
  apply.

## Getting your own files in

1. `POST /v2/workspaces/{workspace_id}/files/upload-url` with `content_type` and
   `file_size_bytes`.
2. `POST` to the returned `upload_url` with `x-goog-resumable: start` to get a session URI.
3. `PUT` the bytes to that session URI.
4. Use the returned `file_id` as a generation input.

PNG, JPEG, WebP, MP4, WAV, MP3, TTF, OTF, and ZIP are accepted, up to 64 MB. The upload URL
expires in 15 minutes.

## Over MCP

The creative server (`https://mcp.app.layer.ai/mcp`) covers the same ground:
`list_base_models`, `get_base_model`, `estimate_forge_price`, `execute_forge`, `get_forge_run`,
`cancel_inference`, `request_file_upload_url`, `upload_file`, plus `score_files` and
`get_file_scores` for output review. Call `get_instructions` first, and `get_forge_instructions`
before the first generation.

## Limits

60 generations per minute per user, of which at most 30 may be video. Exceeding either returns
429 with `Retry-After`. Estimates, lists, and gets are not limited.

## Reference

- REST reference: <https://layer.ai/docs/v2/rest-api>
- Async jobs and polling: <https://layer.ai/docs/async-jobs>
- Creative Units and pricing: <https://layer.ai/pricing> (machine-readable at
  <https://layer.ai/pricing.json>)
