Skip to main content
BuildReviewed Aug 31, 2026

Media Proxy

v2.0.6New

Unsigned, install at your own risk

Unverified

This skill has no cryptographic signature attached. We can't verify the contents match what the publisher intended.

Install this skill

No account required. Pick your tool, then copy.

Run in your terminal. It detects your AI tool.

npx @skills-hub-ai/cli install goose-skills-media-proxy

What this does: Shared helper that routes ALL paid media generation (FAL image/video, ElevenLabs music) through the GooseWorks proxies so every call is charged to your GooseWorks credits — never a provider SDK's default host. Host-swaps the FAL queue URLs, loads the agent token from the sandbox env (GW_MEDIA_PROXY_TOKEN) or ~/.gooseworks/credentials.json, and returns the result CDN URL. Every video-ad media capability imports this; templates never call a provider directly.

Or get the file:
Browse all CLI commands →
Manual setup by platform

Claude Code

~/.claude/skills/goose-skills-media-proxy/SKILL.md

Setup guide →
0Save

Instructions

media-proxy

The foundation capability for paid media in the video-ad pipeline. It fixes the
auth-path conflict where engine scripts called FAL/ElevenLabs directly (billing
the wrong account): all paid calls now go through
<api_base>/api/internal/{fal-proxy,elevenlabs-proxy} with ?token=&agent_id=, which
is charged to your GooseWorks credits.

Crash-resume (never lose / double-bill a paid render)

A FAL submit BILLS immediately, but the local backend can blip during a multi-minute
render. Two built-in protections (automatic for every capability that imports this):

  • Poll-through-outage — _fal_run's poll loop re-attaches to the same status/result
    URL through connection refused / timeout blips instead of crashing.

  • Persist + resume — each submit's request_id + poll URLs are written to
    ~/.gooseworks/pending-fal-jobs/ (GW_FAL_PENDING_DIR overrides, for tests). A caller that
    keeps its own manifest passes on_submit= to fal_generate*: it is called with the
    request_id right after the submit is saved. If the poller still dies, re-attach instead of
    re-firing
    (re-firing double-bills): resume_fal(request_id) in Python, or the CLI:

    resume.py --list                              # resumable (submitted, unfinished) jobs
    resume.py --request-id <id> --out final.mp4   # poll to completion + download
    

    resume_fal NEVER re-submits, so it can't double-charge.

  • Poll timeout never resubmits — polling gives up after
    default_poll_timeout(model): 1800s for video / lipsync / audio-driven models,
    600s for images (GW_FAL_POLL_TIMEOUT_S overrides; timeout_s= per call). A timeout
    raises FalPollTimeout carrying .request_id + .model_path — the job is still
    running and already paid for. Re-attach with resume_fal(e.request_id); never call
    fal_generate* again for it
    (a veed/fabric lipsync once finished 26s after a 600s
    poller quit, and the retry paid for a second identical job).

  • Proxy dedupe back-stop — the fal proxy returns the already-running job for an
    identical submit (same agent + model + body) within 30 min, so an accidental
    resubmit re-attaches instead of paying twice (response header x-gw-deduped: 1).
    For a deliberate re-roll of the same input (want a new take), pass
    new_take=True (fal_generate(..., new_take=True) / fal_generate_video(...)),
    which sends x-gw-no-dedupe: 1 (raw HTTP callers: that header or ?dedupe=0).

  • Pass input_digest= for any piece you save as an ingredient, so a resumed run
    never pays twice.
    The body-match dedupe above breaks after a sandbox restart: the
    resumed run re-uploads its inputs (voiceover, stills) and gets NEW urls, so the body
    differs. fal_generate*(..., input_digest=d) sends x-gw-input-digest: d; the proxy
    then dedupes on (agent + model + digest) for 24 h and returns the job you already
    paid for. Use the same stable digest you save with media_upload (see below). If
    that job's result has since expired at fal, the poll fails: retry once with
    new_take=True.

Policy rejections are final: surface, do not retry

When fal refuses a request on policy grounds, _fal_run (and so fal_generate*) raises
FalPolicyRejection, a RuntimeError subclass, so old except RuntimeError handlers
still work. Policy grounds means a likeness of a real person ("likenesses of real people",
"real person", "public figure"), content_policy_violation, partner_validation_failed, or
NSFW / safety checker.

  • Every body shape is read. fal's detail as a list of {msg, type, loc, ctx}, a dict
    or a string; a top-level type/code/error; the GooseWorks MCP wrapper
    {"error": {"code": "provider_validation_failed", "status": 422, "detail": <fal body>}};
    and a failed job_get reply {"status": "failed", "error": "fal returned HTTP 422 for the result.", "result": {"detail": <fal body>}} (fal reports most failed generations as
    COMPLETED plus a 422 on the result). Before this, a body with both msg and type kept
    the message and lost the type, so the rejection looked like a generic error.

  • When it counts as policy. An explicit policy code (content_policy_violation,
    partner_validation_failed, content_blocked) at any status, or a policy phrase
    (likeness, public figure, usage guidelines, risk control, moderation, blocked for safety,
    NSFW, flagged by the safety checker) on an explicit 4xx that is not 408 or 429. Input
    errors such as "Could not detect a real person's face" or "enable_safety_checker cannot be
    disabled" are not policy. A rejection on a 5xx, 408 or 429 is surfaced but never
    recorded
    .

  • What it carries: reason (the provider's words), kind (likeness |
    partner_validation | content_policy | nsfw), error_type, request_id,
    http_status, stage, charged and charge_note. charged is False for an explicit
    provider 4xx: the GooseWorks proxy debits only a successful response and releases the
    hold on a 4xx (read from the proxy code, not yet confirmed on a real rejection). It is
    None (unknown) for a job that failed after it was accepted.

  • The exact request is recorded in ~/.gooseworks/rejected-fal-requests/<key>.json,
    next to pending-fal-jobs/ (GW_FAL_REJECTIONS_DIR overrides). The key is a digest of
    the model plus the canonical JSON payload (sorted keys), and also of input_digest when
    one is passed.

  • An identical request is refused before any network call, with the same exception
    and from_ledger=True: "surface, do not retry: this exact request was already rejected
    by the provider for ...; change the inputs (image, prompt, model) to try again".
    new_take=True does not bypass it: a re-roll of a rejected payload is still the same
    payload. Any change to the prompt, an image, the seed or the model is a new request and
    is sent.

  • Inputs re-uploaded each run get new URLs, so the payload digest never matches twice.
    Pass input_digest= over the inputs' content, as create-creator-takes-h3/run_takes.py
    and render-street-interview/single_gen.py do. The ledger then matches on that too.
    refuse_if_rejected(model, input_digest=d) checks before you upload anything.

  • A caller's input_digest is a permanent refusal key. It must cover EVERY input that is
    sent: the prompt, every setting (duration, resolution, aspect ratio, audio, seed) and the
    content of every input file. Simplest: input_digest(model, payload) over the real payload
    with each uploaded URL replaced by {"sha256": <file hash>}. Leave an input out and a run
    that changed only that input (a new, acceptable image) is refused.

  • Exit code: scripts exit with POLICY_EXIT (3). The MCP relay also exits 3; the relay
    prints [mcp-relay], a rejection prints "surface, do not retry".

  • Non-policy errors (an unreadable image URL, a bad duration) stay a plain RuntimeError
    with the provider's message and type, and are never recorded.

  • Every refusal names its record: the ledger file and whether it matched the exact
    payload or the caller's input_digest.

  • Clearing a record is a user-approved action. Only when the user explicitly approves,
    e.g. because the provider changed its policy:

    python3 media_proxy.py rejections        # list recorded rejections (key, model, reason, request id)
    python3 media_proxy.py forget <key>      # clear one record (all its keys); USER-APPROVED ONLY
    

    forget_rejection(key) does the same in Python. It only ever deletes ledger records: it
    takes the 32-hex key (or that record's filename or path inside the ledger directory) and
    refuses anything else, such as another .json file or a file without a keys field.
    Agents never clear a record on their own to get a retry through.

Use it

from media_proxy import fal_generate, fal_generate_video, eleven_music, download

# image (nano-banana / gpt-image / etc.) — inputs must be PUBLIC urls
img = fal_generate("fal-ai/nano-banana/edit",
                   {"prompt": p, "image_urls": [product_url], "aspect_ratio": "9:16"})
# video i2v (kling / seedance / veo)
vid = fal_generate_video("fal-ai/kling-video/v3/pro/image-to-video",
                         {"prompt": p, "image_url": keyframe_url, "duration": "10"})
# music bed
eleven_music(prompt, 10500, "music.mp3", force_instrumental=True)

Save-as-you-go digest

input_digest(model, args) = sha256 of the canonical JSON {"model", "args"} (sorted
keys, no whitespace), first 32 hex chars. Pass it with the MCP media_upload of the
result (plus an ingredient_key such as vo/scene-03); on a resume, media_list { ingredient_key } returns the saved file and its digest, and the file is reused only
when the digest of the args you would send now is the same.

from media_proxy import input_digest, eleven_tts, fal_generate_video
args = {"text": line, "voice_id": vid, "model_id": "eleven_v3"}
digest = input_digest("elevenlabs/tts", args)

# FAL job: hash the STABLE identities of its inputs, not their urls, and send the
# same digest with the submit so a resumed run re-attaches instead of re-paying.
lip_digest = input_digest("veed/fabric-1.0", {"image": "still/scene-03:" + still_digest,
                                              "audio": "vo/scene-03:" + digest})
clip = fal_generate_video("veed/fabric-1.0", {"image_url": still_url, "audio_url": vo_url},
                          input_digest=lip_digest)

Hash only what determines the output. Swap any expiring input URL (presigned / proxy)
for that input's own ingredient_key + digest first, or the digest never matches.

Contracts (load-bearing)

  • Charged to your GooseWorks credits — ?token=&agent_id= from ~/.gooseworks/credentials.json
    (written by the GooseWorks CLI). In a GooseWorks cloud sandbox
    (coworker chat) the env wins instead: GW_MEDIA_PROXY_TOKEN (a per-session token that
    already binds agent/org/user) + GW_API_BASE; GW_PROJECT_ID attributes spend.
  • Host-swap the FAL queue URLs — submit returns status_url/response_url on
    queue.fal.run; the helper rewrites them to the proxy base (keeps the path). Never
    poll queue.fal.run directly (401 + burns credits).
  • FAL inputs that are local files must be PUBLIC urls. The orchestrator hosts a
    local image/audio with the MCP media_upload (its returned url) and
    passes THAT url in, or use this module's fal_upload(path) function, which puts the file on the fal CDN
    through the fal-storage-proxy (free, verified 2026-09-28) and returns its public url.
  • Only the final *.fal.media url is a real public URL — everything else is behind
    the proxy.

No credentials at all? The MCP relay

A session that only has the GooseWorks MCP connector (a chat app, or a terminal where
the GooseWorks CLI is not signed in) has neither GW_MEDIA_PROXY_TOKEN (the cloud sandbox's)
nor ~/.gooseworks/credentials.json, so scripts cannot reach the proxies over HTTP. A
connected terminal session can also hold CLI credentials for a different environment; set
GW_MEDIA_VIA=mcp before running its media helpers so the selected connector stays
authoritative. Either way every paid call is relayed through the agent:

  1. The script writes the exact MCP tool call to working/mcp-requests/<kind>-<hash>.json
    and exits with code 3, printing what to do.
  2. The agent makes that call through the connector:
    • fal → data_post_provider { provider: "fal", path: <model>, body, project_id }, then
      job_get { job_id } until complete; save result.output (fal's JSON).
    • ElevenLabs → data_post_provider { provider: "elevenlabs", ... }; save the reply
      (it carries download_url).
    • A local file → media_upload { scope: "video_project", ... } with the bytes of
      local_file; save { "url": <its url> }.
  3. It saves that JSON to save_result_to and re-runs the same command. The script finds
    the result and continues; the next paid call relays the same way.
  4. If data_post_provider returns a provider_validation_failed error, or job_get
    returns status: failed, the agent saves that error JSON (the whole job_get reply) as
    the result instead. The script then reports it: a policy rejection raises
    FalPolicyRejection and is recorded, like the HTTP path. Any saved error is moved aside
    to <name>.error.json, so a re-run makes the call again instead of re-reading it (the
    ledger still refuses a recorded policy rejection).

Set GW_PROJECT_ID (required: every call is billed to that video project, the same
attribution the HTTP proxy records) and GW_BRAND_ID (for uploads). The MCP tools bill
through the same server proxy code, so price and project attribution are identical.
GW_MEDIA_VIA=mcp forces the relay (e.g. the CLI login points at another environment);
GW_MEDIA_VIA=proxy forces HTTP.

Large request bodies without prompt copying

The relay writes a .body.json file for request bodies over 8 KB and adds body_file plus
compact_call to its request record. When data_post_provider advertises body_asset_id, hand that
file over instead of its contents:

  1. media_upload with scope video_project, scope_id GW_PROJECT_ID, path
    working/mcp-requests/<filename>.body.json, kind reference and source
    {type: file, filename: <filename>, content_type: application/json}. It returns the
    media row and an upload block.
  2. PUT the file to upload.url with upload.method and upload.required_headers
    (curl -X PUT -T <file> "<upload.url>").
  3. Finish the upload: after the PUT, call media_confirm with brand_id and media_id
    (the media.id from step 1). The upload is not finished until then: media.status
    stays pending, and a pending media.id is refused as body_asset_id.
  4. Send the compact call with that media.id as body_asset_id and omit body.

A connector whose media_upload takes source bytes (base64 inline, up to about 8 MB)
finishes in step 1 with no PUT; use it when the body file fits. The backend loads that
exact file and applies the same secret, approval and billing checks. Do not paste its
prompt into chat.

Older connectors without body_asset_id use the original args record. Read the exact JSON
into the host's tool runner; never retype prompts or reconstruct them from memory.

For a connected terminal run, set GW_MEDIA_VIA=mcp, GW_PROJECT_ID and GW_BRAND_ID
before running any media scripts. Record the public API origin from account_whoami in
GW_EXPECTED_API_ORIGIN. Do not inspect CLI credential files to identify the connected
environment. Automatic diagnostics also skip HTTP credentials while relay mode is active.

Related

  • Used by create-image-fal, create-video-fal, create-music-elevenlabs.
  • The goose-video orchestrator hosts local inputs (MCP upload → presign) before calling these.
This skill doesn’t include stateful context yet, instructions only. Learn about stateful skills.

Security

Loading security scan...

Reviews (0)

Browse all →
get-brand-assetsGet company logos, brand colors, fonts, and style guides2 installsmeta-ads-analyzerDiagnose Meta Ads campaign performance and account gaps using Meta's actual system mechanics — including customer-journey coverage, Breakdown Effect, Learning Phase, Auction Overlap, Pacing, and Creative Fatigue. Use for performance diagnosis, account audits, full-funnel or TOF/MOF/BOF gap analysis, deciding what to test or create next, and producing novice-friendly recommendations without forcing every campaign or ad into a funnel stage.2 installssend-sms-textbeltSend SMS text messages to phone numbers. Use when the user asks to send a text, send an SMS, text someone, message a phone number, or send a notification via text message.2 installsmeta-ad-managerFront door and loop owner of a Meta (Facebook/Instagram) ad harness. Reads the brand's ads/ docs, works out which campaign the user means and which stage it is at, hands off to the stage skill that runs it (intake, strategy, creative, launch, checks, fixes, answers), and writes every stage change back to the docs. Use it when someone wants to run ads on Meta, comes back to ads they started earlier, a stage skill hands back, or a scheduled check fires.1 installslaunch-meta-ad-campaignTake someone from a business goal to a verified, paused-then-live Meta/Facebook/Instagram campaign without making them learn Meta's hierarchy. Use automatically for requests to launch, run, create, publish, set up, or plan Meta ads; use reporting skills for analysis-only requests.1 installsmeta-ad-scraperScrape competitor ads from Meta's Ad Library (Facebook, Instagram, Messenger, Threads, WhatsApp). Search by company name, Facebook Page URL, or keyword. Returns ad creatives, spend estimates, reach, impressions, and campaign details. Use for competitive ad research, messaging analysis, and creative inspiration.1 installs

More from goose-skills

View source →

More Build skills

Browse category →
senior-frontendBuild and review React, Next.js, TypeScript or Tailwind frontends: components, scaffolding, performance and bundle size. Use whenever the user wants a new component or app, a page feels slow, the bundle is too big, or asks for a frontend code review.653 installsui-design-systemUse when building a design system: tokens, component docs, responsive scales or developer handoff. Generates tokens with design_token_generator.py.553 installsfrontend-designGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.365 installssenior-backendBuild and fix backend services: REST or GraphQL APIs, auth, microservices, PostgreSQL queries, migrations and load tests. Use whenever the user's API is slow or broken, needs login or auth added, a schema change, or a new endpoint or service scaffolded.265 installsself-improving-agentCurate what the agent has learned into durable project knowledge. Reviews Claude Code auto-memory (MEMORY.md and its topic files) for learnings worth keeping, promotes proven ones into CLAUDE.md or .claude/rules/, records a correction as a lesson that persists across sessions, prunes stale or duplicate entries, and turns a recurring fix into a reusable skill. Use whenever the user asks what you have learned or saved about the project, which memories should become permanent rules, to remember a lesson or stop repeating a mistake, or to clean up, audit or check memory health.185 installsusing-superpowersUse when starting any conversation - establishes how to find and use skills, requiring skill invocation before ANY response including clarifying questions149 installs

Frequently asked questions about media-proxy

What does the media-proxy skill do?

Shared helper that routes ALL paid media generation (FAL image/video, ElevenLabs music) through the GooseWorks proxies so every call is charged to your GooseWorks credits — never a provider SDK's default host. Host-swaps the FAL queue URLs, loads the agent token from the sandbox env (GW_MEDIA_PROXY_TOKEN) or ~/.gooseworks/credentials.json, and returns the result CDN URL. Every video-ad media capability imports this; templates never call a provider directly. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.

How do I install the media-proxy skill?

Run `npx @skills-hub-ai/cli install goose-skills-media-proxy` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/goose-skills-media-proxy/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.

Which AI tools does media-proxy work with?

media-proxy runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.

Is the media-proxy skill free?

Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.

How do I use media-proxy after installing it?

In Claude Code, type `/goose-skills-media-proxy` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.

Can I share the media-proxy skill with my team?

Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.