livepeer / livepeer/clearinghouse
Phase-2 markup: apply pipeline/model markup to billable_usd_micros
- Dominant language
- Go
- Stars
- 1
- Forks
- 3
- Avg merge
- 1h 47m
- Merged PRs (30d)
- 3
Description
Salvaged from PR #33 before closing it. The Go bootstrap CLI there carried the only expression of markup rules anywhere in the repo, in `config/pricing.json`:
```json
"markupRules": [
{ "pipeline": "*", "model_id": "*", "markupPercent": 0 },
{ "pipeline": "live-video-to-video", "model_id": "*", "markupPercent": 15 }
]
```
Nothing consumed them — it was a design sketch, not a shipped feature, which is why it is being recorded as an issue rather than carried as code.
## Current state
Markup is unimplemented end to end:
- `openmeter-collector/collector.yaml` emits an interim passthrough — `billable_usd_micros` is set equal to the network fee, with a comment saying so.
- `openmeter-collector/provision/catalog.json` describes `billable_spend` as "Phase-2 post-markup billable amount. Not on Starter plans."
- Starter plans settle on `network_spend` / `network_fee_usd_micros`. The billable meter and feature exist but carry no markup.
So the meters and the feature are already provisioned and reserved for this; what is missing is the rule set and the mapping that applies it.
## What this needs
1. A single home for the rules. `openmeter-collector/provision/catalog.json` is the natural one — it is already the source of truth for meters, features and plans, and the argument for closing #33 was not defining the catalog twice.
2. Collector mapping that applies `markupPercent` by `(pipeline, model_id)` and writes the result to `billable_usd_micros`, replacing the passthrough.
3. Exact-fraction arithmetic consistent with #70. Fees are USD micros as integers; percentage markup must not reintroduce per-ticket rounding, which #70 deliberately removed.
4. Benthos test cases in `collector_benthos_test.yaml` covering the wildcard rule, a specific pipeline rule, and rule precedence.
5. Rate cards for `billable_spend` on whichever plans should bill post-markup, since Starter currently does not.
## Prior art
`markupPercent` keyed by `(pipeline, model_id)` with `*` wildcards is the shape PR #33 proposed and is a reasonable starting point.
Filed while closing #33 (see #82 for where the rest of that PR's intent landed).
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with openmeter-collector/provision/catalog.json and the interim billable_usd_micros mapping in openmeter-collector/collector.yaml, then review #70 and the proposed rules from PR #33. Use collector_benthos_test.yaml to define wildcard, pipeline-specific, and precedence cases. Done means catalog rules, exact-fraction markup mapping, and applicable billable_spend rate cards are implemented without changing Starter behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend, payments
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100