Skip to content

feat(signer): bill BYOC live payments from CapabilitiesPrices#3976

Closed
eliteprox wants to merge 4 commits into
livepeer:feat/add-model-id-signer-kafkafrom
eliteprox:feat/byoc-per-cap-pricing-from-capabilities
Closed

feat(signer): bill BYOC live payments from CapabilitiesPrices#3976
eliteprox wants to merge 4 commits into
livepeer:feat/add-model-id-signer-kafkafrom
eliteprox:feat/byoc-per-cap-pricing-from-capabilities

Conversation

@eliteprox

@eliteprox eliteprox commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Remote signer charges BYOC live payments from OrchestratorInfo.CapabilitiesPrices when a matching Capability_BYOC model constraint is present, instead of the flat base price.
  • Keys price resolution on the existing request capabilities blob (ModelIDForCapability(Capability_BYOC)), matching how orch already advertises BYOC prices.
  • BYOC with a usable cap price → bill compute-seconds at that rate. Native lv2v (and BYOC with no matching price) → keep base price + pixel billing.
  • Does not add capability / model_id string fields to RemotePaymentRequest. Usage attribution already works when the gateway sends BYOC capabilities (see livepeer-python-gateway bd8e780).
  • No feature flag — this path is always on (-byocPerCapPricing removed).

This is the minimal pricing half of what #3972 bundled with a redundant request-format change for usage labels.

Test plan

  • TestResolveByocPrice — match / fallback / invalid-duplicate skip, keyed off BYOC caps
  • TestGenerateLivePayment_ByocCapabilityPricing — per-cap seconds fee, 2:1 tariff ratio, unknown-cap fallback to base + pixels, doubling-guard not tripped
  • Confirm live-runner payments with BYOC capabilities bill at the advertised per-cap rate on a signer build of this branch

Resolve per-capability BYOC fees from the orchestrator's advertised
CapabilitiesPrices, keyed on Capability_BYOC constraints already present
in the request capabilities blob. No RemotePaymentRequest format change.

Gated behind default-OFF -byocPerCapPricing. When OFF or no usable cap
price matches, behavior stays on the base-price / lv2v pixel path.
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c12b689f-b6a0-492e-ac2a-272bc889db7a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the go Pull requests that update Go code label Jul 9, 2026
eliteprox added 2 commits July 9, 2026 17:17
Select the pricing basis from the request capability type rather than
req.Type: a BYOC capability is charged per-capability over compute-seconds,
while lv2v (and everything else) keeps its existing pricing. Since BYOC
jobs always send type:"lv2v", the capability in the request is the real
signal; resolveByocPrice returns nil for non-BYOC caps so lv2v is unchanged.

Extract the per-capability price lookup into a shared findCapPriceInfo
helper reused by resolveByocPrice and remote_discovery capabilityPrice.
The requirePositiveRate flag preserves each caller's semantics (signer
skips non-positive rates and keeps scanning; discovery allows a zero/free
rate on first match).
Comment thread server/remote_signer.go Outdated
Comment on lines +579 to +585
if useByocPricing {
// BYOC prices are per compute-second; bill seconds instead of lv2v pixels.
if billableSecs <= 0 {
billableSecs = (60 * time.Second).Seconds()
}
pixels = int64(math.Ceil(billableSecs))
} else if req.Type == RemoteType_LiveVideoToVideo {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seanhanca I think this is what you're looking to get corrected on pricing?

Eliminate the ByocPerCapPricing configuration option from the LivepeerConfig structure and its associated logic throughout the codebase. Update related tests to reflect the change in naming and functionality, ensuring consistency in pricing behavior for live payments.
@eliteprox eliteprox changed the title feat(signer): BYOC per-capability pricing from existing capabilities feat(signer): bill BYOC live payments from CapabilitiesPrices Jul 10, 2026
@eliteprox eliteprox closed this Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go Pull requests that update Go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant