Skip to content

Instantly share code, notes, and snippets.

@nully0x
Created November 6, 2023 14:47
Show Gist options
  • Save nully0x/ffec882a153e42a7d8a35f40d76db762 to your computer and use it in GitHub Desktop.
Save nully0x/ffec882a153e42a7d8a35f40d76db762 to your computer and use it in GitHub Desktop.
chat-btc payment flow revisit

Current Model

  • User makes a prompt, after 5 prompt, L402 kicks and request for payment to avoid based on user preference.
  • On payment successful, prompts can go through.

Issue

  • L402 keeps prompting the user to make payment which disrupt user experience
  • L402 kicks every 10min time elapsed which trigger new payment processs

Rethinking the approach

  • An alby user can set budget and we can track the session such that after 10 min the user does not get prompt and interrupt his reading (similar to likes on bolt.fun)
  • What about non alby users?
  • Separate or remove L402 from invoice generation or have another approach to implement rate limiting.
  • Following Matts's tweet we can initiate payment silently on each query

    To make this work

    • When a user exceeds the 5 free prompt L402 prompt for payment.
    • User sets budget on alby (budget not possible when using other wallet but we can alert when a user is spending above a threshold when using other wallet)
    • When the budget exceeds the user can initiate another payment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment