Skip to content
Back to skills

74 Kie Live Adapter

ASecurity

Live KIE.ai adapter. One Python 3 standard-library tool that reads KIE's live model catalog and per-model schema, validates a payload against that schema, uploads input files, submits a job to the path the schema declares, polls to a result, saves the files before the links expire, and reads the credit balance. v1.1 adds the model registry (limits and price of every KIE model), the single price authority, the prompt-budget enforcer (95-100 percent of a model's character max, never below 80 pe...

  • 3 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 14, 2026
businesspythonrustdockerapibackend

Works with

  • claude code
  • cli
  • api

Security analysis

A100/100

Pro scans all 18 files and shows the line behind each finding

Scanned November 14, 2026

npx -y skills add trevorotts1/openclaw-onboarding --skill 74-kie-live-adapter --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 74 Kie Live Adapter?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 74 Kie Live Adapter
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/trevorotts1-74-kie-live-adapter/badge)](https://www.skillsdirectory.com/skills/trevorotts1-74-kie-live-adapter)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: kie-live-adapter
description: >
  Live KIE.ai adapter. One Python 3 standard-library tool that reads KIE's live
  model catalog and per-model schema, validates a payload against that schema,
  uploads input files, submits a job to the path the schema declares, polls to a
  result, saves the files before the links expire, and reads the credit balance.
  v1.1 adds the model registry (limits and price of every KIE model), the single
  price authority, the prompt-budget enforcer (95-100 percent of a model's
  character max, never below 80 percent) and `latest-family` (the newest GPT
  Image generation becomes the fleet default). Ships in shadow mode by default:
  it observes and records drift but never dispatches a paid job. Submit never
  chooses or changes a model. Infrastructure skill for skills 66, 67 and 68;
  not a client-facing feature.
version: v1.1.19
priority: MEDIUM
---

# KIE Live Adapter (Skill 74)

KIE changes its model list and request shapes without notice. Skills 66, 67 and 68 hold static tables. This skill gives them a live way to check those tables, and a tested way to run a job when an operator turns dispatch on.

## What it is

`scripts/kie_live_adapter.py`, one entrypoint, Python 3 standard library only. Backend name: `native-live`. It is our own code that follows the contract in KIE's official `kie-models` instructions. KIE's published agent skills are instruction text only (no scripts), so there is nothing to install from them, and they are never a runtime dependency.

Commands (all print the same JSON shape, add `--json`; every command accepts `--mode off|shadow|active` for that call only): `health`, `discover`, `schema`, `validate`, `upload`, `submit`, `wait`, `run`, `credits`, `save`, and the v1.1 additions:

| Command | What it answers |
|---|---|
| `price --model ID [--units N]` | The one price authority: credits from the live catalog `pricingDesc`, registry snapshot as fallback. `credits_estimate` is the highest listed tier; `preflight_required` is that x 1.30. Units: per-job, per-second (`credits/s`, `credits / sec`, `credits per video second`), per-1k-chars (TTS), per-image, per-1m-tokens; every unit except per-job scales by `--units` (seconds, thousand characters, images, million tokens). A duration price such as "A 5-second video costs 160 credits" is per-job for that clip. Some video prices bill input plus output duration: pass the total seconds. |
| `preflight --model ID [--units N]` | Credit balance against `preflight_required`: `validated` with `ok`, or `fail` with `shortfall` credits. |
| `prompt-budget --model ID [--check --prompt-file F]` | The prompt field, its character max, floor (80 percent) and target (95 to 100 percent). With `--check`: exit 0 in range (warns below 95 percent), exit 3 below the floor (prints the exact characters to ADD), exit 4 above the max (prints the exact characters to CUT). `--prompt-file -` reads stdin. |
| `latest-family --family gpt-image [--capability "Text to Image,Image to Image"] [--current-default ID] [--refresh]` | Newest generation in the live catalog that has every capability route with a readable schema (registry fallback offline). 6 hour cache. |
| `success-rate --model ID` | Live 24 hour success rate (average of the non-empty 10 minute buckets). |

`validate` falls back to the registry snapshot when the live schema is unreachable and still enforces required, enum, minimum, maximum and maxLength.

## Consumers (one KIE path)

Skills 25, 37, 58 and 59 call this CLI for every createTask, recordInfo, upload, download and balance check; they keep their own policy (model choice via 66, 67 and 68, fallback order, receipts, output paths) and carry no second KIE client. Options added for them in v1.1.1, all on `save` and `run`:

| Option | What it does |
|---|---|
| `--user-agent TEXT` | Replaces the User-Agent on the result download only. The default is a plain product agent (`Mozilla/5.0 (compatible; OpenClaw-KIE-Live-Adapter/1.1)`) because the result CDN returns 403 to urllib's default agent; Skill 59 passes a full browser agent. Never sent to the API host and never with the key. |
| `--allow-host HOST` | Repeatable. Only result URLs on that host or its subdomains are fetched; others are skipped with a warning, and none left is `host_not_allowed`. |

A synchronous endpoint (a model whose schema declares its own path, for example Runway or Veo) that answers with a result link in `data.resultUrls` or `data.response.resultUrls` is saved by `run` like any other result.

## Registry

`references/kie-model-registry.json` is generated by `scripts/build_model_registry.py` from KIE's live API (catalog once, one schema call per model, spaced 1.1 seconds, key through shared-utils `key_resolver`); with no key it reads KIE's public docs and records prices as `unavailable-without-key`. Per model: id, provider, taskType, family, numeric version, variant, schema paths (createTask or sync), every input field with type, required, minLength, maxLength, enum, minimum, maximum and default (`$ref` resolved, oneOf branches kept), the descriptive prompt field and its maxLength, verbatim-content fields (TTS text, lyrics), raw `pricingDesc` and parsed credits, `generated_at`, and `source`. It is a dated snapshot and the offline fallback only; the live schema wins whenever it can be read. Rebuild it after KIE adds models.

## Prompt budget (owner order 2026-10-05)

Descriptive prompt fields (image prompt, video prompt, music style) use 95 to 100 percent of the model max and never fall below 80 percent. Verbatim fields (spoken text, lyrics) have no floor and a ceiling only. Limit order: live schema `maxLength`, then the figure stated in the field description, then the policy owner (66, 67, 68 `models.json`), else `UNKNOWN` (warning, exit 0, no floor). When the schema lists several per-version limits the most common one is used and a warning names all of them.

## GPT Image auto-latest (owner order 2026-10-05)

`latest-family --family gpt-image` returns the newest generation by numeric version (2.5 is newer than 2, which is newer than 1.5) that has both text-to-image and image-to-image with a readable schema. Several variants of one generation: the variant with the same name as the current default first (sunburst today), then the highest live 24 hour success rate, then the lower price. When the answer changes it writes a promotion receipt (`<cache>/receipts/promotions/`) and warns. Skill 66 calls it; department pins and explicit requests still win. This is a resolver for the policy owner: `submit` and `run` still never pick a model.

## Default image model: GPT Image Sunburst at medium quality (owner order 2026-11-10, rule N43)

`Adapter.default_model("gpt-image", edit=False)` is the newest Sunburst generation in the live catalog that has a per-picture price (a per-picture catalog price, or a row in `references/kie-default-price-evidence.json`), never a Flare or other variant. The fallback pin is GPT Image 2.6 Sunburst: `gpt-image-2-6/sunburst-text-to-image`, and `gpt-image-2-6/sunburst-image-to-image` when an edit (a source image) is given; slash form, a hyphenated `gpt-image-2-6-sunburst-*` is HTTP 422. The KIE request field is `quality` (`low`, `medium`, `high`, `xhigh`, `max`, `auto`); the default is `medium` when the caller names none, and a caller-named model or quality is never replaced.

2.6 is billed by tokens. `Adapter.cmd_default_price(family, quality, edit, units)` returns KIE's published per-picture reference price (the "Credits per Image" table, image output only, 1:1) as a per-image price at that quality and size (medium: 1K 7.82, 2K 15.90, 4K 26.43 credits), marked "estimate; actual billed by tokens"; add about 0.1 credit per prompt and about 2.2 per reference image. Skill 83's image plan reads it when no model is named. A token-priced model with no reference row (and `auto`, which has no row) has no picture price and is refused; a model the caller names is priced from its own catalog text as before. `scripts/check_default_image_model.py` requires a gpt-image Sunburst default, medium default quality, and a reference price for 1K, 2K and 4K at that quality; it runs in `qc-74-kie-live-adapter.sh` and in CI.

## Modes

Set `KIE_LIVE_ADAPTER_MODE` to `off`, `shadow` or `active`. If the variable is unset the adapter reads the first word of `kie-live-adapter-mode.conf` (one-word store style, same as `decision-engine-mode.conf`) from the first of these locations that has the file: `$OC_CONFIG` (its parent when it names openclaw.json), `/data/.openclaw` (Docker/VPS OpenClaw home), `${CLAUDE_CONFIG_DIR:-~/.claude}` (Claude Code machines), then `~/.openclaw` (plain OpenClaw default). If no location has the file the mode is `shadow`.

| Mode | What happens |
|---|---|
| off | Diagnostics (health, discover, schema, validate) work. submit and run return `skipped` with "adapter off: use static path". |
| shadow (default) | Diagnostics run and write drift receipts. submit and run refuse paid dispatch: `skipped`, `fallback_used: true`, "shadow: dispatch via existing static path". No duplicate generation, no double charge. |
| active | Full mechanics: validate, createTask, poll, download. |

## Hard rules

1. `submit` and `run` never pick a different model and never override a pinned model. The caller decides the model and the fallback. The one exception is the owner order of 2026-10-05: the advisory `latest-family` resolver lets Skill 66 follow the newest GPT Image generation (AGENTS.md N43); explicit requests and department pins still win.
2. Never print or log the key. Receipts and errors are redacted. Presence checks print SET or NOT-SET only.
3. One attempt on a 401 or 403, no retry. The adapter stops and reports.
4. Check the `code` in the response body. HTTP 200 can carry 401, 402, 404, 422, 429, 433 or 455.
5. createTask is never retried after a network error (that could charge twice).
6. Never copy `scripts/kie_live_adapter.py` into a Presentations deck run directory. The deck render guard blocks scripts there that mention the KIE API. Run it from this skill folder only.
7. Nothing writes inside the skill folder at run time. Run data lives outside every replaceable
   skill tree, at ONE root resolved by `shared-utils/durable-data-root.sh` (Skill 46 executes the
   same file, so both modules of the callback route agree):
   - receipts are EVIDENCE: `<root>/data/kie-jobs/kie-live-adapter/receipts/YYYYMMDD.jsonl`;
   - the catalog/schema cache is re-fetchable: `<root>/cache/kie-live-adapter/`.
   Root precedence: `$OPENCLAW_DATA_ROOT`, else `$OPENCLAW_ROOT`/`$OC_ROOT`, else
   `/data/.openclaw`, else `$HOME/.openclaw`. A root that cannot be resolved is reported by
   `health` (`data_root_warning`) instead of being guessed; receipts that already exist at the
   old `~/.openclaw/cache/kie-live-adapter/receipts` path are NOT moved (that preserving
   migration is F24's) and `health` reports it as `data_migration_note`.

See INSTRUCTIONS.md for usage and references/ for the contract, trust policy, research receipt and decision log.

Files in this skill

  • CHANGELOG.md14.6 KB
  • CORE_UPDATES.md1.4 KB
  • INSTALL.md4.8 KB
  • INSTRUCTIONS.md4.8 KB
  • PREREQS.json1.4 KB
  • QC.md2.1 KB
  • SKILL.md10.8 KB
  • qc-74-kie-live-adapter.sh3.9 KB
  • references/adapter-contract.md7.1 KB
  • references/decision-log.md3.5 KB
  • references/integration-policy.md2.2 KB
  • references/kie-default-price-evidence.json3.4 KB
  • references/vendor-research.md5.1 KB
  • scripts/build_model_registry.py10.6 KB
  • scripts/check_default_image_model.py3.2 KB
  • scripts/live_smoke.sh3.1 KB
  • scripts/vendor_skill_probe.sh2.7 KB
  • setup-kie-live-adapter.sh11.2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in business →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.