Skip to content

feat: add lago plugin #12196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open

Conversation

bzp2010
Copy link
Contributor

@bzp2010 bzp2010 commented May 7, 2025

Description

Add plugin for integration with Lago, this allows users to use APISIX as a monetization gateway to charge subscribers via API consumption. Empower your business.

The plugin sends API call logs to a Lago self-hosted or Lago cloud instance to charge a specified consumer via a specific billing metric and subscription.

Some typical use cases:

  • AI cloud platform: charging by consumed tokens, like OpenAI and DeepSeek
  • API calls: charging for calls to specified APIs, e.g., selling weather APIs

The plugin is flexible, you can configure multiple routes with different billing metric codes or properties to enhance pay-as-you-go scenarios, for example, setting different prices for different APIs. Check out the video here to understand it https://www.youtube.com/watch?v=ulLpAn8_P9o

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

@bzp2010 bzp2010 force-pushed the bzp/feat-lago-plugin branch from e17692e to 636eaf3 Compare May 12, 2025 09:30
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. enhancement New feature or request plugin labels May 14, 2025
moonming
moonming previously approved these changes May 15, 2025
nic-6443
nic-6443 previously approved these changes May 16, 2025
juzhiyuan
juzhiyuan previously approved these changes May 16, 2025
Copy link
Member

@juzhiyuan juzhiyuan left a comment

Choose a reason for hiding this comment

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

I have reviewed the testcases

SkyeYoung
SkyeYoung previously approved these changes May 16, 2025
@bzp2010 bzp2010 dismissed stale reviews from SkyeYoung, juzhiyuan, nic-6443, and moonming via 22e2fd7 May 16, 2025 07:46
@bzp2010 bzp2010 requested review from juzhiyuan and AlinsRan May 16, 2025 08:01
nic-6443
nic-6443 previously approved these changes May 16, 2025
AlinsRan
AlinsRan previously approved these changes May 16, 2025
membphis
membphis previously approved these changes May 16, 2025
Copy link
Member

@membphis membphis left a comment

Choose a reason for hiding this comment

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

LGTM, only one minor issue

@bzp2010 bzp2010 dismissed stale reviews from membphis, AlinsRan, and nic-6443 via 3258665 May 16, 2025 08:27
@bzp2010 bzp2010 requested a review from membphis May 16, 2025 08:28
@bzp2010
Copy link
Contributor Author

bzp2010 commented May 16, 2025

Could @kayx23 please help check the docs, after that we can merge.

Copy link
Member

@juzhiyuan juzhiyuan left a comment

Choose a reason for hiding this comment

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

I have reviewed the docs, it's great to add a diagram to explain the logics for both developers/users and Lago developers, but we can merge first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request plugin size:XXL This PR changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants