improvement(media-gen): retire vision block, add hosted key for fal ai for image/video gen, search visibility in cmd-k#4684
improvement(media-gen): retire vision block, add hosted key for fal ai for image/video gen, search visibility in cmd-k#4684icecrasher321 wants to merge 2 commits into
Conversation
…i for image/video gen
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Updates the hosted-key injector to skip injection when a tool’s hosting predicate is false or when the user already supplied an API key, and adds Fal.ai to BYOK provider IDs/UI. Improves Cmd-K search by introducing Retires Vision from surfaced UI/docs by removing the Reviewed by Cursor Bugbot for commit 3c7fd57. Configure here. |
Greptile SummaryThis PR retires the Vision block (hidden from toolbar), adds Fal.ai hosted-key support for image and video generators with markup-based billing, and enables provider dropdown options to appear as Cmd-K search entries via a new
Confidence Score: 5/5Safe to merge — the cost-tracking chain is robust end-to-end and no generated content can be lost due to pricing-lookup failures. The three-tier fallback in getFalAICostMetadata (billing events → historical estimate → floor) ensures the billing path never propagates an exception to callers. The hosted-key injection correctly checks the enabled predicate, respects user-provided and BYOK keys, and gates cost tracking via __usingHostedKey. Dual apiKey subblock IDs are an intentional, mutually-exclusive conditional pattern consistent with how other blocks handle provider-scoped fields. The fallback-floor cost heuristic in falai-pricing.ts and the defensive throws in image/generate.ts and video/falai.ts are worth a second look if Fal.ai adds new endpoint families in the future. Important Files Changed
Sequence DiagramsequenceDiagram
participant Block as Image/Video Block
participant Index as tools/index.ts
participant Route as API Route
participant FalAI as fal.ai
participant Pricing as falai-pricing.ts
participant Billing as Billing System
Block->>Index: "execute(params, provider=falai)"
Index->>Index: injectHostedKeyIfNeeded
Index->>Route: POST api/tools/image or video
Route->>FalAI: generate(model, prompt)
FalAI-->>Route: result + requestId
Route->>Pricing: getFalAICostMetadata
Pricing->>FalAI: GET billing-events (2 attempts)
alt billing event found
FalAI-->>Pricing: cost_estimate_nano_usd
Pricing-->>Route: "source=billing_events"
else no event
Pricing->>FalAI: POST pricing/estimate
alt estimate ok
FalAI-->>Pricing: total_cost
Pricing-->>Route: "source=historical_estimate"
else estimate fails
Pricing-->>Route: "source=fallback_floor"
end
end
Route-->>Index: response with costDollars
Index->>Billing: getCost with 1.5x markup
Billing-->>Index: billing recorded
Reviews (2): Last reviewed commit: "address comments" | Re-trigger Greptile |
|
@greptile |
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 3c7fd57. Configure here.
Summary
Type of Change
Testing
Tested manually
Checklist