Generate
Paths: ${CLAUDE_SKILL_DIR} means the folder containing this SKILL.md, and ${CLAUDE_SKILL_DIR}/../.. the editor folder (this repo's .claude/) two levels above it.
Every question to the user goes in the question box: call the AskUserQuestion tool (2-4 options, the recommended one first). Only in an agent without that tool, ask numbered questions in text.
G="${CLAUDE_SKILL_DIR}/../../lib/ai_editor/gen/gen.py". Run it with python3 (py on Windows). Every
model, its inputs and limits are in gen.py models (from lib/ai_editor/gen/models.json); never guess a model
id or a parameter. API facts and what is unverified: references/higgsfield-api.md.
Rules
- Money is spent only after a yes to that price. Always
estimatefirst, ask with the dollar amount it printed (itsASK:line), and runsubmit --confirm <estimate id>only after the user picked yes. A new price (the estimate is over 30 minutes old, orsubmitsays the price changed) is a new question. - The user's footage leaves their computer only with consent. A clip or a frame of their video is uploaded
to Higgsfield at
submit. Say so in the same question as the price. - Never ask for the key in the chat. No key: tell them to run
python3 "$G" setkeyin their own terminal (it asks for the key id and secret from console.higgsfield.ai, joined asid:secret, and hides what they type). profile.jsongen_budget_usdcaps a month's spend;submitrefuses over it. Say what is left and stop.- Failed and
nsfwresults are not billed. Say so if one fails, and offer to change the prompt.
Steps
- What and where. From the user's words and the edit (
edits/<name>/): the kind (motion transfer, b-roll from words, a still brought to life, a still for a card), the moment it covers (seconds on the timeline, from the transcript inwords.json), and for motion transfer the stretch of their video (4 s or more; the model keeps at most 30 s). Pick the model withpython3 "$G" models --kind <kind>. - The prompt. Write it yourself from the line being said: the subject, the setting, the camera, the light,
in under 40 words. B-roll matches the video's format (a vertical edit gets a vertical-feeling shot).
Motion transfer takes 1-8 reference images (
--image, files or URLs): the look to put the moves on. - Price it.
It cuts the clip (silent, H.264) intopython3 "$G" estimate edits/<name> --model <id> --prompt "<prompt>" [--video raw.mp4 --from 12.0 --to 18.0] \ [--image ref.png] [--param duration=5] --at <timeline seconds>generated/inputs/, prices the request without uploading anything, and prints the estimate id,usd,credits,over_budgetand anASK:line. - Ask. One question box: the
ASK:line as the question (price, model, and what gets uploaded), options "Yes, generate it (Recommended)" / "Change the prompt" / "No". Over budget: say so instead and stop. - Submit on yes only:
python3 "$G" submit edits/<name> --confirm <estimate id>. It uploads the inputs, re-prices with them, submits and prints the job id. - Wait in the background (generations take minutes):
python3 "$G" wait edits/<name> <job>. It polls with backoff, downloads the result intoedits/<name>/generated/, probes it and adds it to the timeline's Generated track at--atas Claude's change (throughproject.py apply; without the project document yet, it writesgenerated/<job>.ops.jsonand prints it).status/listshow progress;cancelworks only while it is still queued. - Hand over. Say what was added, where, and what it cost. The user moves, trims or deletes it on the
timeline like any clip. A correction to how generations should look goes to
taste.
If a command stops
| message | do |
|---|---|
No Higgsfield key | ask them to run python3 "$G" setkey in their own terminal, then continue |
needs at least 4 s | widen --from/--to, or pick a text or image model |
over this month's generation budget | tell them what is left; they can raise gen_budget_usd |
the price is $X, not $Y | ask again with the new price, then submit --confirm the new id it printed |
Maximum number of concurrent requests | the client already retried; wait for a running job, then submit |
ended failed / ended nsfw | not billed; offer a changed prompt (a new estimate and question) |
Files
lib/ai_editor/gen/gen.py: the commands above,demoself-check (a fake Higgsfield, no network).lib/ai_editor/gen/higgsfield.py: the API client.base.py: the provider interface and catalog.lib/ai_editor/gen/jobs.py:edits/<name>/generated/jobs.jsonand the month's spend.references/higgsfield-api.md: the API as documented, with sources.