AI Media Router
v0.1.0Image and video generation across 40+ providers with your own keys, plus a local asset library.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
add_to_collection
Add assets to a collection, creating it when missing.
| Parameter | Type | Description |
|---|---|---|
asset_ids * | array | |
collection * | string | Collection name; add_to_collection creates it when missing. |
description | string | null | add_to_collection only: replaces the collection's description. |
add_to_reference
Append assets to a reference, optionally with a role (e.g. "side").
| Parameter | Type | Description |
|---|---|---|
asset_ids * | array | |
reference * | string | Reference name or id. |
role | string | null | add_to_reference only: role of these assets, e.g. "front", "side", "palette". |
cancel_job
Cancel a waiting or running job: it becomes failed with `cancelled`, and jobs waiting on it fail too. The provider is not asked to stop, so a running generation may still bill there.
| Parameter | Type | Description |
|---|---|---|
job_id * | string |
check_spec
Check a spec without saving or calling the provider: validates it (pointers, template variables), replays recorded fixtures, and with model/input renders the exact HTTP requests it would send.
| Parameter | Type | Description |
|---|---|---|
input | object | null | Generation input for the rendered requests. |
model | string | null | With `model`, also render the exact HTTP requests a generation would send (nothing is sent). |
provider | string | null | Check the loaded spec of this provider. Omit when passing `spec`. |
spec | string | null | TOML text of a candidate spec (not saved). Format: docs/provider-spec.md. |
vars | object | null | Values for variables later steps capture from earlier responses (e.g. {"id": "task-123"}). |
concat
Join two or more video assets in order into one MP4 (first clip's size, 30 fps); returns the new asset.
| Parameter | Type | Description |
|---|---|---|
asset_ids * | array | Two or more video assets in playback order. Output takes the first clip's size (others are letterboxed) at 30 fps; clips without sound get silence when any clip has sound. |
save_to |
delete_asset
Delete an asset's file and library entry; it leaves every reference and collection. Jobs keep their record of it.
| Parameter | Type | Description |
|---|---|---|
asset_id * | string |
delete_budget
Delete a budget; its jobs stay in the history.
| Parameter | Type | Description |
|---|---|---|
name * | string |
delete_recipe
Delete a recipe; jobs made from it stay in the history.
| Parameter | Type | Description |
|---|---|---|
name * | string |
delete_reference
Delete a reference; its assets stay in the library.
| Parameter | Type | Description |
|---|---|---|
reference * | string | Reference name or id. |
delete_snippet
Delete a snippet; inputs that still use it fail with the list of known snippets.
| Parameter | Type | Description |
|---|---|---|
name * | string |
doctor
Check the installation: data directory, database, ffmpeg/ffprobe, which providers have keys, spec override errors, recorded fixtures of configured providers, jobs no worker is polling, and the last day's failure kinds. online=true also pings every configured provider. Run it first when something does not work.
| Parameter | Type | Description |
|---|---|---|
online | boolean | null | Also send one GET to every configured provider's base URL (any HTTP answer counts as reachable). |
estimate_cost
Estimate a generation's USD cost: an offer's price (offer_id from search_prices) times the duration or image count read from input, plus the median of past jobs on this provider and model. Says which formula and input fields it used. With recipe (and vars) instead: every step of that recipe and the sum.
| Parameter | Type | Description |
|---|---|---|
input | object | Generation input. Seconds are read from duration, duration_seconds, duration_secs, seconds, video_length or length; the output count from num_images, n, num_outputs, image_count, number_of_images, sam… |
model | string | null | The provider's model id, as passed to generate. Required unless `recipe` is given. |
offer_id | string | null | Offer from search_prices to price; without it only the history median is used. |
provider | string | null | Provider key, e.g. "kie". Required unless `recipe` is given. |
recipe | string | null | Price a run_recipe instead: each step from its own estimated_cost_usd or offer_id (edits cost 0), and the sum. |
reuse | boolean | null | As in generate: report (with cost 0) when the run would return an identical job's outputs. |
vars | object | null | The recipe's variables, as in run_recipe. |
export_collection
Export a collection as a ZIP in <home>/exports/: the files, their previews, and collection.json with each asset's metadata (review status, rating, notes), the job that made it (provider, model, input, cost) and its references. only_approved=true ships only assets approved with review_asset.
| Parameter | Type | Description |
|---|---|---|
collection * | string | |
only_approved | boolean | null | Only assets approved with review_asset. |
extract_frame
Save one frame of a video as a PNG asset: at "first", "last" or seconds. Use the last frame as the start image of the next clip.
| Parameter | Type | Description |
|---|---|---|
asset_id * | string | A video asset. |
at | "first", "last", or seconds from the start (e.g. 1.5). Default "first". | |
save_to | File the new asset into a collection and/or reference. |
generate
Start a generation. Returns the job immediately (status running); poll it with get_job. Results are downloaded into the library. Library files go into input as "{{asset:<id>}}" / "{{ref:<name>}}"; save_to files the outputs into a collection and/or reference. `recipe` names a saved single-generation preset (list_recipes shows the user's presets), so provider and model can be omitted.
| Parameter | Type | Description |
|---|---|---|
input * | object | Model input passed to the provider unchanged (prompt, image_urls, duration, ...). Library files go in as placeholders, uploaded through the provider before submit: "{{asset:<id>}}" or "{{ref:<name>}}"… |
budget | string | null | Count this job against a budget (set_budget); the job is refused if it would exceed it. |
estimated_cost_usd | number | null | Expected cost in USD. With `budget` and no value, it is computed like estimate_cost. |
model | string | The provider's own model id or endpoint, e.g. "kling-2.6/image-to-video" on kie. Required unless `recipe` is given. |
offer_id | string | null | Offer from search_prices this job buys; its price × the duration or image count in `input` becomes the job's estimate when `estimated_cost_usd` is not given. |
provider | string | Provider key, e.g. "kie". See get_provider for what `model` means there. Required unless `recipe` is given. |
recipe | string | null | A saved single-generation recipe used as a preset: its provider, model, input (variables filled, defaults applied), save_to, offer_id and budget are the defaults. Fields given here win; `input` merges… |
retry | Resubmit after a retryable failure (rate_limit, provider_error, network, timeout): {attempts: 1-5, delay_secs}. Off by default, since a provider may bill a failed attempt. | |
reuse | boolean | null | true: when a job with the same provider, model and input (library files compared by content) is done and its outputs are still in the library, or is still running, return those outputs as a new job at… |
save_to | File the outputs into a collection and/or an existing reference when the job finishes. | |
vars | object | null | The recipe's variables, as in run_recipe. |
generate_batch
Start up to 100 jobs at once: items (e.g. one prompt on several provider/model pairs) x matrix (top-level input fields to vary). Item input merges over defaults.input. With defaults.budget the sum of estimates is admitted first. Returns the batch; follow it with get_batch.
| Parameter | Type | Description |
|---|---|---|
defaults | Shared by every job; items override provider, model, save_to and estimated_cost_usd, and merge their input over this input. | |
items | array | null | One entry per variant, e.g. the same prompt on several provider/model pairs (a bench). |
label | string | null | Free text to recognise the batch by. |
matrix | object | null | Top-level input fields to vary: {"aspect_ratio": ["16:9", "9:16"], "seed": [1, 2]}. Every item runs with every combination. At most 100 jobs in total. |
recipe | string | null | Run a saved recipe: its provider, model, input and save_to are the defaults, and `matrix` keys, `defaults.vars` and item `vars` fill its "{{var:<name>}}" variables instead of input fields. |
get_asset
Metadata and local path of one asset.
| Parameter | Type | Description |
|---|---|---|
asset_id * | string |
get_batch
A batch's jobs per status, each job's outputs, and every output file. wait_secs blocks until all finish (max 50).
| Parameter | Type | Description |
|---|---|---|
batch_id * | string | |
wait_secs | integer | null | Block up to this many seconds (max 50) for every job to finish. Default 0. |
get_job
Job status, provider progress and stored result files. wait_secs blocks until done (max 50); debug=true adds the raw provider exchanges.
| Parameter | Type | Description |
|---|---|---|
job_id * | string | |
debug | boolean | null | Include `trace`: the exact request and raw provider response of each step. Use it when a job failed or stays running, to see which pointer or URL in the spec is wrong. |
wait_secs | integer | null | Block up to this many seconds (max 50) for the job to finish. Default 0. |
get_lineage
Generation graph of an asset: the assets and references it was made from (ancestors) and everything made from it (descendants), with the job of each step.
| Parameter | Type | Description |
|---|---|---|
asset_id * | string |
get_provider
How to call one provider: model id format, an example generate call, docs link, upload support, known quirks.
| Parameter | Type | Description |
|---|---|---|
provider * | string | Provider key from list_providers, e.g. "fal". |
get_recipe
One recipe by name.
| Parameter | Type | Description |
|---|---|---|
name * | string |
get_reference
One reference by name or id, with its assets in order and their local paths.
| Parameter | Type | Description |
|---|---|---|
reference * | string | Reference name or id. |
get_spec
Read a provider's active spec (TOML), whether it is built-in or a local override, and its fixture names. First step of fixing a provider.
| Parameter | Type | Description |
|---|---|---|
provider * | string | Provider key from list_providers, e.g. "fal". |
get_stats
Per provider and model: jobs, done/failed share, failure kinds, average rating, approved share, average USD cost and seconds to finish. Filter by provider, model or collection. Use it to pick a model that worked before.
| Parameter | Type | Description |
|---|---|---|
collection | string | null | Only jobs that read from or wrote into this collection. |
model | string | null | The provider's model id. |
provider | string | null | Provider key, e.g. "kie". |
import_asset
Copy a local file into the asset library, e.g. a reference image. Files made by ai-media-router carry their provider, model, input, job and parent assets: import restores prompt, tags and lineage, and returns that provenance.
| Parameter | Type | Description |
|---|---|---|
path * | string | Absolute path of a local file. |
prompt | string | null | Description used for search; defaults to the prompt stored in the file by ai-media-router. |
tags | string | null | Space-separated tags, e.g. "character hero". |
list_budgets
Budgets with their limit, spent and remaining USD.
list_collections
List collections (projects) with their asset counts. search_assets {collection} lists one's assets.
list_jobs
Generation history, newest first, with provider, model, input, cost, input assets and outputs. Filter by reference, collection, status or error_kind.
| Parameter | Type | Description |
|---|---|---|
batch | string | null | Only jobs of this batch (generate_batch). |
collection | string | null | Only jobs that read from or wrote into this collection. |
error_kind | Only failed jobs of this kind, e.g. "moderation" or "rate_limit". | |
limit | integer | null | Default 20. |
reference | string | null | Only jobs that used this reference (name or id) as input or filed outputs into it. |
status | string | null | `running`, `done` or `failed`. |
list_keys
Every provider key any loaded spec uses: whether it is set, where it comes from, and the command that sets it. Never returns key values (only the last 4 characters), so it is safe to show the user; keys are added by the user in a terminal.
list_providers
List providers, whether their API keys are set, and whether each runs the built-in spec or a local override.
list_recipes
List recipes with their provider, model, input or steps, and variables.
list_references
List references, most recently changed first; filter by kind or a substring of name, description or tags.
| Parameter | Type | Description |
|---|---|---|
kind | ||
limit | integer | null | Default 20. |
query | string | null | Substring of name, description or tags. |
list_snippets
List snippets with their text.
mux_audio
Put an audio track (audio asset or another video's sound) under a video, replacing its sound; returns the new asset.
| Parameter | Type | Description |
|---|---|---|
audio_asset_id * | string | An audio asset, or a video whose sound is taken. Replaces the video's sound; padded with silence or cut to the video's length. |
video_asset_id * | string | |
save_to |
overlay
Draw an image (packshot, logo) over an image or video at x, y pixels, optionally scaled to width; returns the new asset.
| Parameter | Type | Description |
|---|---|---|
base_asset_id * | string | Image or video to draw on (e.g. a generated plate). |
overlay_asset_id * | string | Image drawn on top (e.g. a real packshot or a logo; PNG transparency is kept). |
save_to | ||
width | integer | null | Scale the overlay to this width in pixels, keeping its aspect. Default: its own size. |
x | integer | null | Left edge in pixels of the base (get_asset shows its width and height). Default 0. |
y | integer | null | Top edge in pixels of the base. Default 0. |
preflight
Dry run of generate with the same arguments: checks the provider and keys, snippets and placeholders (assets, references, parent jobs), upload support, save_to, cost and budget, and renders the exact HTTP requests. Sends nothing, spends nothing; `ready` says whether generate would start. Use it before an expensive or unfamiliar generation. With recipe and vars instead: every step of run_recipe (checks named <step>/<check>), the summed estimate and the budget.
| Parameter | Type | Description |
|---|---|---|
budget | string | null | With a recipe of steps, the sum of every step's estimate is checked against it. |
estimated_cost_usd | number | null | |
input | object | As in generate. |
model | string | null | As in generate; required unless `recipe` is given. |
offer_id | string | null | |
provider | string | null | As in generate; required unless `recipe` is given. |
recipe | string | null | Check a run_recipe instead: every step of the recipe, their summed estimate and the budget for the sum. |
retry | ||
reuse | boolean | null | As in generate: report (with cost 0) when the run would return an identical job's outputs. |
save_to | ||
vars | object | null | The recipe's variables, as in run_recipe. |
reframe
Change an image's or video's aspect ratio (e.g. 16:9 to 9:16) by centered crop or black padding; returns the new asset.
| Parameter | Type | Description |
|---|---|---|
aspect * | string | Target aspect ratio "W:H", e.g. "9:16", "1:1", "16:9", or a number like "1.91". |
asset_id * | string | An image or video asset. |
mode | `crop` (default): cut the edges away, centered. `pad`: add black bars. | |
save_to |
remove_from_collection
Remove assets from a collection (not from the library); an emptied collection disappears.
| Parameter | Type | Description |
|---|---|---|
asset_ids * | array | |
collection * | string | Collection name; add_to_collection creates it when missing. |
description | string | null | add_to_collection only: replaces the collection's description. |
remove_from_reference
Remove assets from a reference; they stay in the library.
| Parameter | Type | Description |
|---|---|---|
asset_ids * | array | |
reference * | string | Reference name or id. |
role | string | null | add_to_reference only: role of these assets, e.g. "front", "side", "palette". |
reset_spec
Delete a provider's local override so the built-in spec is used again.
| Parameter | Type | Description |
|---|---|---|
provider * | string | Provider key from list_providers, e.g. "fal". |
review_asset
Review assets: status approved/rejected/draft, rating 1-5, notes. Rejected assets are skipped when a {{ref:…}} expands; export_collection {only_approved} ships only approved ones; get_stats averages ratings per model.
| Parameter | Type | Description |
|---|---|---|
asset_ids * | array | |
notes | string | null | What is right or wrong with it, e.g. "extra fingers, logo warped"; replaces earlier notes, searched by search_assets. |
rating | integer | null | 1-5. |
status | `approved` (ready to use), `rejected` (skipped by {{ref:…}} expansion) or `draft`. |
run_recipe
Start a generation from a recipe with values for its variables (defaults fill the rest). Returns the job like generate. A recipe with steps starts every step at once in one batch, admitting the sum of their estimates against `budget`; it returns the last step's job, and get_batch {batch_id} follows the whole run.
| Parameter | Type | Description |
|---|---|---|
name * | string | |
budget | string | null | With steps, the sum of every step's estimate is admitted before anything is submitted. |
estimated_cost_usd | number | null | With `budget` and no value, it is computed like estimate_cost. Not for a recipe with steps: set it per step. |
offer_id | string | null | Offer from search_prices; prices the run from the filled input. Not for a recipe with steps: set it per step. |
retry | Resubmit after a retryable failure (rate_limit, provider_error, network, timeout): {attempts: 1-5, delay_secs}. Off by default, since a provider may bill a failed attempt. | |
reuse | boolean | null | true: when a job with the same provider, model and input (library files compared by content) is done and its outputs are still in the library, or is still running, return those outputs as a new job at… |
save_to | Replaces the recipe's save_to for this run (with steps: for the final steps). | |
vars | object | null | Values for the recipe's variables, e.g. {"language": "de", "duration": 5}. |
save_recipe
Save a generation template: from_job copies a working job, or give provider, model and input. "{{var:<name>}}" in input marks what changes per run; every recipe also appears as the MCP prompt recipe:<name>. A chain: `steps` (generations and ffmpeg edits linked by "{{step:<name>}}"), or from_job / from_asset with chain: true to take the final job's whole lineage.
| Parameter | Type | Description |
|---|---|---|
name * | string | Unique name; saving again replaces the recipe. |
budget | string | null | Budget every run counts against unless the call names another. |
chain | boolean | null | With from_job / from_asset: also save the jobs that made its inputs ({{job:…}}, {{asset:…}} made by a job, asset ids of an edit), back to imported files and references, as earlier steps; their ids… |
description | string | null | |
from_asset | string | null | Like from_job, with the job that made this asset. |
from_job | string | null | Start from this job's provider, model, input and save_to; other fields given here override them. |
input | object | null | Generation input. "{{var:<name>}}" as a whole string becomes the variable's JSON value, inside a longer string its text. Text and media placeholders ({{snippet:…}}, {{ref:…}}, {{asset:…}}) stay… |
model | string | null | Required unless from_job is given. |
offer_id | string | null | Offer from search_prices that prices every run; single-generation recipes only. |
provider | string | null | Required unless from_job is given. |
save_to | With steps: where the final steps' outputs are filed. | |
steps | array | null | A chain instead of provider/model/input, run in order by one run_recipe: each step is a generation {name, provider, model, input} or an ffmpeg edit {name, op, input: <that tool's parameters>}. Later s… |
variables | object | null | Declared variables; ones used in input but not listed here are added as required. |
save_reference
Create or update a reference: a named, typed set of assets (character, style, product, environment, composition, brand) plus a description, reused in generate input as "{{ref:<name>}}". asset_ids, when given, replaces its assets.
| Parameter | Type | Description |
|---|---|---|
name * | string | Unique name, used as "{{ref:<name>}}" in generate input, e.g. "main-character". |
asset_ids | array | null | When given, the reference holds exactly these assets in this order (first = default image). |
description | string | null | What must stay consistent, e.g. "red-haired woman, cyberpunk jacket". |
kind | Required when creating: character, style, product, environment, composition or brand. | |
tags | string | null | Space-separated tags. |
save_snippet
Create or replace a snippet: a reusable prompt block (brand style, series paragraph, voice) used as "{{snippet:<name>}}" inside any string of generate input.
| Parameter | Type | Description |
|---|---|---|
name * | string | Used as "{{snippet:<name>}}" inside any string of generate input, e.g. "brand-style". |
text * | string | The prompt block, e.g. "soft window light, muted teal palette, 35mm". May contain "{{ref:<name>.description}}" but not other snippets. |
description | string | null |
save_spec
Save a spec as a local override in <home>/providers/ (or add a new provider). Active immediately in every AI Media Router process; returns the check result.
| Parameter | Type | Description |
|---|---|---|
spec * | string | Full TOML text of the spec. Saved as `<home>/providers/<key>.toml`, active immediately in every process. |
search_assets
Search the local asset library by prompt, tags, description and review notes, optionally within one collection, by review status or minimum rating.
| Parameter | Type | Description |
|---|---|---|
collection | string | null | Only assets in this collection. |
limit | integer | null | Default 20. |
min_rating | integer | null | Only assets rated at least this (1-5). |
query | string | null | Words matched against the generation prompt, tags, description and review notes; omit to list the newest assets. |
status | Only assets with this review status. |
search_prices
Find video (USD per second) and image (USD per image) generation offers across providers, cheapest first; kind filters one of them. Offers carry provider_key and offer_id for generate.
| Parameter | Type | Description |
|---|---|---|
configured_only | boolean | null | Only offers from providers whose keys are set. Default: true when any key is set. |
kind | string | null | `video` (USD per second) or `image` (USD per image); both when omitted, videos first. |
limit | integer | null | Default 20. |
mode | string | null | Video: `generate`, `video input`, `motion / avatar`; image: `generate`, `edit`, `generate + edit`. |
provider | string | null | Substring of the provider name, e.g. "kie". |
quality | string | null | Image quality tier, e.g. "high". |
query | string | null | Substring of the model family or name, e.g. "seedance" or "kling 2.6". |
res | string | null | Resolution, e.g. "720p" or "1080p". |
set_budget
Create a spending cap in USD, or change its limit. Jobs started with generate {budget, estimated_cost_usd} count against it and are refused when they would exceed it.
| Parameter | Type | Description |
|---|---|---|
limit_usd * | number | Spending cap in USD. |
name * | string | Budget name, e.g. a session or project; passed as `budget` to generate. |
similar_assets
Find assets similar in meaning to a text query or to another asset (embeddings of prompt, tags and description). Needs EMBEDDINGS_API_KEY or EMBEDDINGS_URL in config; search_assets is the keyword search.
| Parameter | Type | Description |
|---|---|---|
asset_id | string | null | Find assets similar to this one. |
collection | string | null | Only assets in this collection. |
limit | integer | null | Default 20. |
query | string | null | Text to find similar assets for, e.g. "red-haired woman in neon rain". Or use asset_id. |
test_key
Check one provider's key with the spec's free [auth_check] request (account, balance or model list): accepted, refused, not_configured, not_supported or inconclusive. Spends nothing and never returns the key.
| Parameter | Type | Description |
|---|---|---|
provider * | string | Provider key from list_providers, e.g. "fal". |
trim
Cut a video or audio asset to start..end seconds; returns the new asset.
| Parameter | Type | Description |
|---|---|---|
asset_id * | string | A video or audio asset. |
end | number | null | Seconds; default the end of the file. |
save_to | ||
start | number | null | Seconds; default 0. |
update_asset
Replace an asset's tags and/or description (both are searched by search_assets).
| Parameter | Type | Description |
|---|---|---|
asset_id * | string | |
description | string | null | Replaces the description; searched like prompt and tags. |
tags | string | null | Replaces the tags (space-separated). |
upload_asset
Upload a library asset to a provider; returns the reference (URL, file id or data URI) and where to put it in generate input. Usually not needed: "{{asset:<id>}}" in generate input does this automatically.
| Parameter | Type | Description |
|---|---|---|
asset_id * | string | |
provider * | string | Provider key, e.g. "kie". |