‹ 首页

media-proxy

@gooseworks-ai · 收录于 1 周前 · 上游提交 今天

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

适合你,如果需要在广告系统中统一管理媒体生成API的调用和计费

/ 通过 npx 安装 校验哈希
npx oh-my-skill add gooseworks-ai/goose-skills/media-proxy
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- gooseworks-ai/goose-skills/media-proxy
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify gooseworks-ai/goose-skills/media-proxy
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
1019GitHub stars
~674最小装载
~674含声明引用
~3.4K文本包总量
索引托管

怎么用

技能原文 SKILL.md作者撰写 · MIT · 8cffdbb

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 bills the Ads agent.

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/. If the poller still dies, **re-attach instead of re-firing** (re-firing double-bills): resume_fal(request_id) in Python, or the CLI:

``bash 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.

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/v2.1/standard/image-to-video",
                         {"prompt": p, "image_url": keyframe_url, "duration": "10"})
# music bed
eleven_music(prompt, 10500, "music.mp3", force_instrumental=True)
Contracts (load-bearing)
  • Bills the Ads agent?token=&agent_id= from ~/.gooseworks/credentials.json (the CLI writes it; run gooseworks login if missing).
  • 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 via the MCP get_upload_urlget_download_url presigned URL and passes THAT url in. This module does not do MCP uploads (prefer the presigned url; fal-storage-proxy may 404).
  • Only the final *.fal.media url is a real public URL — everything else is behind the proxy.
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.
按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。