livepeer / livepeer/livepeer-python-gateway
Enable on-chain payments for single-shot streaming (SSE) sessions
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
## What
Wire the session payment streamer (livepeer/livepeer-python-gateway#30 / livepeer/livepeer-python-gateway#31) onto the single-shot streaming path so a **held-open SSE** single-shot call keeps paying for the duration of the stream, not just an upfront 402.
The pieces exist but aren't connected for single-shot:
* `call_runner(stream=True)` → `LiveRunnerCallStream` gives an open, non-blocking stream + **one upfront** 402 payment (livepeer/livepeer-python-gateway#26 / livepeer/livepeer-python-gateway#25).
* `run_session_payments` / `start_payments()` (livepeer/livepeer-python-gateway#30 / livepeer/livepeer-python-gateway#31) is the interval payment loop, but it's scoped to the `reserve_session` **/** `LiveRunnerSession` flow.
Single-shot has no `reserve_session`, so the loop must be drivable off the call's challenge/stream.
## Scope
* Drive the payment streamer off `call_runner`'s 402 challenge / `LiveRunnerCallStream` (session id = `manifest_id`), **not** a reserved `LiveRunnerSession`.
* POST to the **session-scoped** endpoint `…/apps/{runner}/session/{id}/payment` (fix the current `{origin}/payment` target in `send_payment`).
* Run the loop as a **background** `asyncio` **task** started after `call_runner(stream=True)` opens the stream; drain the stream concurrently (the `async for` yields so the loop ticks).
* Drive cadence from the challenge's `payment_interval` (requires go-livepeer to surface it in the 402 challenge).
* End-to-end **paid-SSE test**: 402 → open stream → concurrent interval payments → stream completes past the upfront amount.
## Depends on / relates to
* livepeer/livepeer-python-gateway#26 (SSE streaming read) — livepeer/livepeer-python-gateway#25
* livepeer/livepeer-python-gateway#30 (session payment streamer) — livepeer/livepeer-python-gateway#31 (needs to be drivable off a challenge + session-scoped URL)
* go-livepeer [#3955]() single-shot on-chain billing (PR [#3975]()), with the `ModifyResponse` headers removed and `payment_interval` added to the 402 challenge
Part of the **Live Runner: Single-Shot Pipelines** project.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading call_runner(stream=True) and LiveRunnerCallStream, then compare run_session_payments/start_payments in the reserved-session flow. Trace the 402 challenge fields and send_payment endpoint, and run the existing SSE and payment tests before adding the end-to-end paid-SSE case. Done means a single-shot stream receives concurrent interval payments at the challenge cadence and completes beyond the upfront amount.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend, payments
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100