Re: [PR] feat: add lago plugin [apisix]

2025-05-21 Thread via GitHub


moonming merged PR #12196:
URL: https://github.com/apache/apisix/pull/12196


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] feat: add lago plugin [apisix]

2025-05-20 Thread via GitHub


kayx23 commented on code in PR #12196:
URL: https://github.com/apache/apisix/pull/12196#discussion_r2098711499


##
docs/en/latest/plugins/lago.md:
##
@@ -0,0 +1,259 @@
+---
+title: lago
+keywords:
+  - Apache APISIX
+  - API Gateway
+  - Plugin
+  - lago
+  - monetization
+  - github.com/getlago/lago
+description: The lago plugin reports usage to a Lago instance, which allows 
users to integrate Lago with APISIX for API monetization.
+---
+
+
+
+
+  https://docs.api7.ai/hub/lago"; />
+
+
+## Description
+
+The `lago` plugin pushes requests and responses to [Lago 
Self-hosted](https://github.com/getlago/lago) and [Lago 
Cloud](https://getlago.com) via the Lago REST API. the plugin allows you to use 
it with a variety of APISIX built-in features, such as the APISIX consumer and 
the request-id plugin.
+
+This allows for API monetization or let APISIX to be an AI gateway for AI 
tokens billing scenarios.
+
+:::disclaimer
+
+Lago owns its trademarks and controls its commercial products and open source 
projects.
+
+The [https://github.com/getlago/lago](https://github.com/getlago/lago) project 
uses the `AGPL-3.0` license instead of the `Apache-2.0` license that is the 
same as Apache APISIX. As a user, you will need to evaluate for yourself 
whether it is applicable to your business to use the project in a compliant way 
or to obtain another type of license from Lago. Apache APISIX community does 
not endorse it.
+
+The plugin does not contain any proprietary code or SDKs from Lago, it is 
contributed by contributors to Apache APISIX and licensed under the 
`Apache-2.0` license, which is in line with any other part of APISIX and you 
don't need to worry about its compliance.
+
+:::
+
+When enabled, the plugin will collect information from the request context 
(e.g. event code, transaction ID, associated subscription ID) as configured and 
serialize them into [Event JSON 
objects](https://getlago.com/docs/api-reference/events/event-object) as 
required by Lago. They will be added to the buffer and sent to Lago in batches 
of up to 100. This batch size is a 
[requirement](https://getlago.com/docs/api-reference/events/batch) from Lago. 
If you want to modify it, see [batch processor](../batch-processor.md) for more 
details.
+
+## Attributes
+
+| Name | Type | Required | Default | Valid values | Description |
+|---|---|---|---|---|---|
+| endpoint_addrs | array[string] | True |  | | Lago API address, like 
`http://127.0.0.1:3000`, it supports both self-hosted and cloud. If multiple 
endpoints are configured, the log will be pushed to a randomly determined 
endpoint from the list. |
+| endpoint_uri | string | False | /api/v1/events/batch | | Lago API endpoint, 
it needs to be set to the batch send endpoint. |
+| token | string | True |  | | Lago API key, create one for your organization 
on Lago dashboard. |
+| event_transaction_id | string | True |  | | Event's transaction ID, it is 
used to identify and de-duplicate the event, it supports string templates 
containing APISIX and NGINX variables, like `req_${request_id}`, which allows 
you to use values returned by upstream services or request-id plugin 
integration |
+| event_subscription_id | string | True |  | | Event's subscription ID, which 
is automatically generated or specified by you when you assign the plan to the 
customer on Lago, used to associate API consumption to a customer subscription, 
it supports string templates containing APISIX and NGINX variables, like 
`cus_${consumer_name}`, which allows you to use values returned by upstream 
services or APISIX consumer |
+| event_code | string | True |  | | Lago billable metric's code for 
associating an event to a specified billable item |
+| event_properties | object | False |  | | Event's properties, used to attach 
information to an event, this allows you to send certain information on a event 
to Lago, such as sending HTTP status to take a failed request off the bill, or 
sending the AI token consumption in the response body for accurate billing, its 
keys are fixed strings and its values can be string templates containing APISIX 
and NGINX variables, like `${status}` |
+| ssl_verify| boolean   | False| true | | If true, verify 
Lago's SSL certificates. |
+| timeout   | integer   | False| 3000 | [1, 6] | Timeout 
for the Lago service HTTP call in milliseconds.  |
+| keepalive | boolean   | False| true |  | If true, keep the 
connection alive for multiple requests. |
+| keepalive_timeout | integer   | False| 6 | >=1000 | Keepalive 
timeout in milliseconds.  |
+| keepalive_pool| integer   | False| 5   | >=1 | Maximum 
number of connections in the connection pool.  |
+
+This Plugin supports using batch processors to aggregate and process events in 
a batch. This avoids the need for frequently submitting the data. The batch 
processor submits data every `5` seconds or when the data in the queue reaches 
`

Re: [PR] feat: add lago plugin [apisix]

2025-05-20 Thread via GitHub


kayx23 commented on code in PR #12196:
URL: https://github.com/apache/apisix/pull/12196#discussion_r2098711499


##
docs/en/latest/plugins/lago.md:
##
@@ -0,0 +1,259 @@
+---
+title: lago
+keywords:
+  - Apache APISIX
+  - API Gateway
+  - Plugin
+  - lago
+  - monetization
+  - github.com/getlago/lago
+description: The lago plugin reports usage to a Lago instance, which allows 
users to integrate Lago with APISIX for API monetization.
+---
+
+
+
+
+  https://docs.api7.ai/hub/lago"; />
+
+
+## Description
+
+The `lago` plugin pushes requests and responses to [Lago 
Self-hosted](https://github.com/getlago/lago) and [Lago 
Cloud](https://getlago.com) via the Lago REST API. the plugin allows you to use 
it with a variety of APISIX built-in features, such as the APISIX consumer and 
the request-id plugin.
+
+This allows for API monetization or let APISIX to be an AI gateway for AI 
tokens billing scenarios.
+
+:::disclaimer
+
+Lago owns its trademarks and controls its commercial products and open source 
projects.
+
+The [https://github.com/getlago/lago](https://github.com/getlago/lago) project 
uses the `AGPL-3.0` license instead of the `Apache-2.0` license that is the 
same as Apache APISIX. As a user, you will need to evaluate for yourself 
whether it is applicable to your business to use the project in a compliant way 
or to obtain another type of license from Lago. Apache APISIX community does 
not endorse it.
+
+The plugin does not contain any proprietary code or SDKs from Lago, it is 
contributed by contributors to Apache APISIX and licensed under the 
`Apache-2.0` license, which is in line with any other part of APISIX and you 
don't need to worry about its compliance.
+
+:::
+
+When enabled, the plugin will collect information from the request context 
(e.g. event code, transaction ID, associated subscription ID) as configured and 
serialize them into [Event JSON 
objects](https://getlago.com/docs/api-reference/events/event-object) as 
required by Lago. They will be added to the buffer and sent to Lago in batches 
of up to 100. This batch size is a 
[requirement](https://getlago.com/docs/api-reference/events/batch) from Lago. 
If you want to modify it, see [batch processor](../batch-processor.md) for more 
details.
+
+## Attributes
+
+| Name | Type | Required | Default | Valid values | Description |
+|---|---|---|---|---|---|
+| endpoint_addrs | array[string] | True |  | | Lago API address, like 
`http://127.0.0.1:3000`, it supports both self-hosted and cloud. If multiple 
endpoints are configured, the log will be pushed to a randomly determined 
endpoint from the list. |
+| endpoint_uri | string | False | /api/v1/events/batch | | Lago API endpoint, 
it needs to be set to the batch send endpoint. |
+| token | string | True |  | | Lago API key, create one for your organization 
on Lago dashboard. |
+| event_transaction_id | string | True |  | | Event's transaction ID, it is 
used to identify and de-duplicate the event, it supports string templates 
containing APISIX and NGINX variables, like `req_${request_id}`, which allows 
you to use values returned by upstream services or request-id plugin 
integration |
+| event_subscription_id | string | True |  | | Event's subscription ID, which 
is automatically generated or specified by you when you assign the plan to the 
customer on Lago, used to associate API consumption to a customer subscription, 
it supports string templates containing APISIX and NGINX variables, like 
`cus_${consumer_name}`, which allows you to use values returned by upstream 
services or APISIX consumer |
+| event_code | string | True |  | | Lago billable metric's code for 
associating an event to a specified billable item |
+| event_properties | object | False |  | | Event's properties, used to attach 
information to an event, this allows you to send certain information on a event 
to Lago, such as sending HTTP status to take a failed request off the bill, or 
sending the AI token consumption in the response body for accurate billing, its 
keys are fixed strings and its values can be string templates containing APISIX 
and NGINX variables, like `${status}` |
+| ssl_verify| boolean   | False| true | | If true, verify 
Lago's SSL certificates. |
+| timeout   | integer   | False| 3000 | [1, 6] | Timeout 
for the Lago service HTTP call in milliseconds.  |
+| keepalive | boolean   | False| true |  | If true, keep the 
connection alive for multiple requests. |
+| keepalive_timeout | integer   | False| 6 | >=1000 | Keepalive 
timeout in milliseconds.  |
+| keepalive_pool| integer   | False| 5   | >=1 | Maximum 
number of connections in the connection pool.  |
+
+This Plugin supports using batch processors to aggregate and process events in 
a batch. This avoids the need for frequently submitting the data. The batch 
processor submits data every `5` seconds or when the data in the queue reaches 
`

Re: [PR] feat: add lago plugin [apisix]

2025-05-20 Thread via GitHub


kayx23 commented on code in PR #12196:
URL: https://github.com/apache/apisix/pull/12196#discussion_r2098711499


##
docs/en/latest/plugins/lago.md:
##
@@ -0,0 +1,259 @@
+---
+title: lago
+keywords:
+  - Apache APISIX
+  - API Gateway
+  - Plugin
+  - lago
+  - monetization
+  - github.com/getlago/lago
+description: The lago plugin reports usage to a Lago instance, which allows 
users to integrate Lago with APISIX for API monetization.
+---
+
+
+
+
+  https://docs.api7.ai/hub/lago"; />
+
+
+## Description
+
+The `lago` plugin pushes requests and responses to [Lago 
Self-hosted](https://github.com/getlago/lago) and [Lago 
Cloud](https://getlago.com) via the Lago REST API. the plugin allows you to use 
it with a variety of APISIX built-in features, such as the APISIX consumer and 
the request-id plugin.
+
+This allows for API monetization or let APISIX to be an AI gateway for AI 
tokens billing scenarios.
+
+:::disclaimer
+
+Lago owns its trademarks and controls its commercial products and open source 
projects.
+
+The [https://github.com/getlago/lago](https://github.com/getlago/lago) project 
uses the `AGPL-3.0` license instead of the `Apache-2.0` license that is the 
same as Apache APISIX. As a user, you will need to evaluate for yourself 
whether it is applicable to your business to use the project in a compliant way 
or to obtain another type of license from Lago. Apache APISIX community does 
not endorse it.
+
+The plugin does not contain any proprietary code or SDKs from Lago, it is 
contributed by contributors to Apache APISIX and licensed under the 
`Apache-2.0` license, which is in line with any other part of APISIX and you 
don't need to worry about its compliance.
+
+:::
+
+When enabled, the plugin will collect information from the request context 
(e.g. event code, transaction ID, associated subscription ID) as configured and 
serialize them into [Event JSON 
objects](https://getlago.com/docs/api-reference/events/event-object) as 
required by Lago. They will be added to the buffer and sent to Lago in batches 
of up to 100. This batch size is a 
[requirement](https://getlago.com/docs/api-reference/events/batch) from Lago. 
If you want to modify it, see [batch processor](../batch-processor.md) for more 
details.
+
+## Attributes
+
+| Name | Type | Required | Default | Valid values | Description |
+|---|---|---|---|---|---|
+| endpoint_addrs | array[string] | True |  | | Lago API address, like 
`http://127.0.0.1:3000`, it supports both self-hosted and cloud. If multiple 
endpoints are configured, the log will be pushed to a randomly determined 
endpoint from the list. |
+| endpoint_uri | string | False | /api/v1/events/batch | | Lago API endpoint, 
it needs to be set to the batch send endpoint. |
+| token | string | True |  | | Lago API key, create one for your organization 
on Lago dashboard. |
+| event_transaction_id | string | True |  | | Event's transaction ID, it is 
used to identify and de-duplicate the event, it supports string templates 
containing APISIX and NGINX variables, like `req_${request_id}`, which allows 
you to use values returned by upstream services or request-id plugin 
integration |
+| event_subscription_id | string | True |  | | Event's subscription ID, which 
is automatically generated or specified by you when you assign the plan to the 
customer on Lago, used to associate API consumption to a customer subscription, 
it supports string templates containing APISIX and NGINX variables, like 
`cus_${consumer_name}`, which allows you to use values returned by upstream 
services or APISIX consumer |
+| event_code | string | True |  | | Lago billable metric's code for 
associating an event to a specified billable item |
+| event_properties | object | False |  | | Event's properties, used to attach 
information to an event, this allows you to send certain information on a event 
to Lago, such as sending HTTP status to take a failed request off the bill, or 
sending the AI token consumption in the response body for accurate billing, its 
keys are fixed strings and its values can be string templates containing APISIX 
and NGINX variables, like `${status}` |
+| ssl_verify| boolean   | False| true | | If true, verify 
Lago's SSL certificates. |
+| timeout   | integer   | False| 3000 | [1, 6] | Timeout 
for the Lago service HTTP call in milliseconds.  |
+| keepalive | boolean   | False| true |  | If true, keep the 
connection alive for multiple requests. |
+| keepalive_timeout | integer   | False| 6 | >=1000 | Keepalive 
timeout in milliseconds.  |
+| keepalive_pool| integer   | False| 5   | >=1 | Maximum 
number of connections in the connection pool.  |
+
+This Plugin supports using batch processors to aggregate and process events in 
a batch. This avoids the need for frequently submitting the data. The batch 
processor submits data every `5` seconds or when the data in the queue reaches 
`

Re: [PR] feat: add lago plugin [apisix]

2025-05-20 Thread via GitHub


bzp2010 commented on code in PR #12196:
URL: https://github.com/apache/apisix/pull/12196#discussion_r2097199594


##
docs/en/latest/plugins/lago.md:
##
@@ -0,0 +1,259 @@
+---
+title: lago
+keywords:
+  - Apache APISIX
+  - API Gateway
+  - Plugin
+  - lago
+  - monetization
+  - github.com/getlago/lago
+description: The lago plugin reports usage to a Lago instance, which allows 
users to integrate Lago with APISIX for API monetization.
+---
+
+
+
+
+  https://docs.api7.ai/hub/lago"; />
+
+
+## Description
+
+The `lago` plugin pushes requests and responses to [Lago 
Self-hosted](https://github.com/getlago/lago) and [Lago 
Cloud](https://getlago.com) via the Lago REST API. the plugin allows you to use 
it with a variety of APISIX built-in features, such as the APISIX consumer and 
the request-id plugin.
+
+This allows for API monetization or let APISIX to be an AI gateway for AI 
tokens billing scenarios.
+
+:::disclaimer
+
+Lago owns its trademarks and controls its commercial products and open source 
projects.
+
+The [https://github.com/getlago/lago](https://github.com/getlago/lago) project 
uses the `AGPL-3.0` license instead of the `Apache-2.0` license that is the 
same as Apache APISIX. As a user, you will need to evaluate for yourself 
whether it is applicable to your business to use the project in a compliant way 
or to obtain another type of license from Lago. Apache APISIX community does 
not endorse it.
+
+The plugin does not contain any proprietary code or SDKs from Lago, it is 
contributed by contributors to Apache APISIX and licensed under the 
`Apache-2.0` license, which is in line with any other part of APISIX and you 
don't need to worry about its compliance.
+
+:::
+
+When enabled, the plugin will collect information from the request context 
(e.g. event code, transaction ID, associated subscription ID) as configured and 
serialize them into [Event JSON 
objects](https://getlago.com/docs/api-reference/events/event-object) as 
required by Lago. They will be added to the buffer and sent to Lago in batches 
of up to 100. This batch size is a 
[requirement](https://getlago.com/docs/api-reference/events/batch) from Lago. 
If you want to modify it, see [batch processor](../batch-processor.md) for more 
details.
+
+## Attributes
+
+| Name | Type | Required | Default | Valid values | Description |
+|---|---|---|---|---|---|
+| endpoint_addrs | array[string] | True |  | | Lago API address, like 
`http://127.0.0.1:3000`, it supports both self-hosted and cloud. If multiple 
endpoints are configured, the log will be pushed to a randomly determined 
endpoint from the list. |
+| endpoint_uri | string | False | /api/v1/events/batch | | Lago API endpoint, 
it needs to be set to the batch send endpoint. |
+| token | string | True |  | | Lago API key, create one for your organization 
on Lago dashboard. |
+| event_transaction_id | string | True |  | | Event's transaction ID, it is 
used to identify and de-duplicate the event, it supports string templates 
containing APISIX and NGINX variables, like `req_${request_id}`, which allows 
you to use values returned by upstream services or request-id plugin 
integration |
+| event_subscription_id | string | True |  | | Event's subscription ID, which 
is automatically generated or specified by you when you assign the plan to the 
customer on Lago, used to associate API consumption to a customer subscription, 
it supports string templates containing APISIX and NGINX variables, like 
`cus_${consumer_name}`, which allows you to use values returned by upstream 
services or APISIX consumer |
+| event_code | string | True |  | | Lago billable metric's code for 
associating an event to a specified billable item |
+| event_properties | object | False |  | | Event's properties, used to attach 
information to an event, this allows you to send certain information on a event 
to Lago, such as sending HTTP status to take a failed request off the bill, or 
sending the AI token consumption in the response body for accurate billing, its 
keys are fixed strings and its values can be string templates containing APISIX 
and NGINX variables, like `${status}` |
+| ssl_verify| boolean   | False| true | | If true, verify 
Lago's SSL certificates. |
+| timeout   | integer   | False| 3000 | [1, 6] | Timeout 
for the Lago service HTTP call in milliseconds.  |
+| keepalive | boolean   | False| true |  | If true, keep the 
connection alive for multiple requests. |
+| keepalive_timeout | integer   | False| 6 | >=1000 | Keepalive 
timeout in milliseconds.  |
+| keepalive_pool| integer   | False| 5   | >=1 | Maximum 
number of connections in the connection pool.  |
+
+This Plugin supports using batch processors to aggregate and process events in 
a batch. This avoids the need for frequently submitting the data. The batch 
processor submits data every `5` seconds or when the data in the queue reaches 

Re: [PR] feat: add lago plugin [apisix]

2025-05-20 Thread via GitHub


bzp2010 commented on code in PR #12196:
URL: https://github.com/apache/apisix/pull/12196#discussion_r2097555305


##
docs/en/latest/plugins/lago.md:
##
@@ -0,0 +1,259 @@
+---
+title: lago
+keywords:
+  - Apache APISIX
+  - API Gateway
+  - Plugin
+  - lago
+  - monetization
+  - github.com/getlago/lago
+description: The lago plugin reports usage to a Lago instance, which allows 
users to integrate Lago with APISIX for API monetization.
+---
+
+
+
+
+  https://docs.api7.ai/hub/lago"; />
+
+
+## Description
+
+The `lago` plugin pushes requests and responses to [Lago 
Self-hosted](https://github.com/getlago/lago) and [Lago 
Cloud](https://getlago.com) via the Lago REST API. the plugin allows you to use 
it with a variety of APISIX built-in features, such as the APISIX consumer and 
the request-id plugin.
+
+This allows for API monetization or let APISIX to be an AI gateway for AI 
tokens billing scenarios.
+
+:::disclaimer

Review Comment:
   fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] feat: add lago plugin [apisix]

2025-05-20 Thread via GitHub


bzp2010 commented on code in PR #12196:
URL: https://github.com/apache/apisix/pull/12196#discussion_r2097199594


##
docs/en/latest/plugins/lago.md:
##
@@ -0,0 +1,259 @@
+---
+title: lago
+keywords:
+  - Apache APISIX
+  - API Gateway
+  - Plugin
+  - lago
+  - monetization
+  - github.com/getlago/lago
+description: The lago plugin reports usage to a Lago instance, which allows 
users to integrate Lago with APISIX for API monetization.
+---
+
+
+
+
+  https://docs.api7.ai/hub/lago"; />
+
+
+## Description
+
+The `lago` plugin pushes requests and responses to [Lago 
Self-hosted](https://github.com/getlago/lago) and [Lago 
Cloud](https://getlago.com) via the Lago REST API. the plugin allows you to use 
it with a variety of APISIX built-in features, such as the APISIX consumer and 
the request-id plugin.
+
+This allows for API monetization or let APISIX to be an AI gateway for AI 
tokens billing scenarios.
+
+:::disclaimer
+
+Lago owns its trademarks and controls its commercial products and open source 
projects.
+
+The [https://github.com/getlago/lago](https://github.com/getlago/lago) project 
uses the `AGPL-3.0` license instead of the `Apache-2.0` license that is the 
same as Apache APISIX. As a user, you will need to evaluate for yourself 
whether it is applicable to your business to use the project in a compliant way 
or to obtain another type of license from Lago. Apache APISIX community does 
not endorse it.
+
+The plugin does not contain any proprietary code or SDKs from Lago, it is 
contributed by contributors to Apache APISIX and licensed under the 
`Apache-2.0` license, which is in line with any other part of APISIX and you 
don't need to worry about its compliance.
+
+:::
+
+When enabled, the plugin will collect information from the request context 
(e.g. event code, transaction ID, associated subscription ID) as configured and 
serialize them into [Event JSON 
objects](https://getlago.com/docs/api-reference/events/event-object) as 
required by Lago. They will be added to the buffer and sent to Lago in batches 
of up to 100. This batch size is a 
[requirement](https://getlago.com/docs/api-reference/events/batch) from Lago. 
If you want to modify it, see [batch processor](../batch-processor.md) for more 
details.
+
+## Attributes
+
+| Name | Type | Required | Default | Valid values | Description |
+|---|---|---|---|---|---|
+| endpoint_addrs | array[string] | True |  | | Lago API address, like 
`http://127.0.0.1:3000`, it supports both self-hosted and cloud. If multiple 
endpoints are configured, the log will be pushed to a randomly determined 
endpoint from the list. |
+| endpoint_uri | string | False | /api/v1/events/batch | | Lago API endpoint, 
it needs to be set to the batch send endpoint. |
+| token | string | True |  | | Lago API key, create one for your organization 
on Lago dashboard. |
+| event_transaction_id | string | True |  | | Event's transaction ID, it is 
used to identify and de-duplicate the event, it supports string templates 
containing APISIX and NGINX variables, like `req_${request_id}`, which allows 
you to use values returned by upstream services or request-id plugin 
integration |
+| event_subscription_id | string | True |  | | Event's subscription ID, which 
is automatically generated or specified by you when you assign the plan to the 
customer on Lago, used to associate API consumption to a customer subscription, 
it supports string templates containing APISIX and NGINX variables, like 
`cus_${consumer_name}`, which allows you to use values returned by upstream 
services or APISIX consumer |
+| event_code | string | True |  | | Lago billable metric's code for 
associating an event to a specified billable item |
+| event_properties | object | False |  | | Event's properties, used to attach 
information to an event, this allows you to send certain information on a event 
to Lago, such as sending HTTP status to take a failed request off the bill, or 
sending the AI token consumption in the response body for accurate billing, its 
keys are fixed strings and its values can be string templates containing APISIX 
and NGINX variables, like `${status}` |
+| ssl_verify| boolean   | False| true | | If true, verify 
Lago's SSL certificates. |
+| timeout   | integer   | False| 3000 | [1, 6] | Timeout 
for the Lago service HTTP call in milliseconds.  |
+| keepalive | boolean   | False| true |  | If true, keep the 
connection alive for multiple requests. |
+| keepalive_timeout | integer   | False| 6 | >=1000 | Keepalive 
timeout in milliseconds.  |
+| keepalive_pool| integer   | False| 5   | >=1 | Maximum 
number of connections in the connection pool.  |
+
+This Plugin supports using batch processors to aggregate and process events in 
a batch. This avoids the need for frequently submitting the data. The batch 
processor submits data every `5` seconds or when the data in the queue reaches 

Re: [PR] feat: add lago plugin [apisix]

2025-05-20 Thread via GitHub


bzp2010 commented on code in PR #12196:
URL: https://github.com/apache/apisix/pull/12196#discussion_r2097215332


##
docs/en/latest/plugins/lago.md:
##
@@ -0,0 +1,259 @@
+---
+title: lago
+keywords:
+  - Apache APISIX
+  - API Gateway
+  - Plugin
+  - lago
+  - monetization
+  - github.com/getlago/lago
+description: The lago plugin reports usage to a Lago instance, which allows 
users to integrate Lago with APISIX for API monetization.
+---
+
+
+
+
+  https://docs.api7.ai/hub/lago"; />
+
+
+## Description
+
+The `lago` plugin pushes requests and responses to [Lago 
Self-hosted](https://github.com/getlago/lago) and [Lago 
Cloud](https://getlago.com) via the Lago REST API. the plugin allows you to use 
it with a variety of APISIX built-in features, such as the APISIX consumer and 
the request-id plugin.
+
+This allows for API monetization or let APISIX to be an AI gateway for AI 
tokens billing scenarios.
+
+:::disclaimer
+
+Lago owns its trademarks and controls its commercial products and open source 
projects.
+
+The [https://github.com/getlago/lago](https://github.com/getlago/lago) project 
uses the `AGPL-3.0` license instead of the `Apache-2.0` license that is the 
same as Apache APISIX. As a user, you will need to evaluate for yourself 
whether it is applicable to your business to use the project in a compliant way 
or to obtain another type of license from Lago. Apache APISIX community does 
not endorse it.
+
+The plugin does not contain any proprietary code or SDKs from Lago, it is 
contributed by contributors to Apache APISIX and licensed under the 
`Apache-2.0` license, which is in line with any other part of APISIX and you 
don't need to worry about its compliance.
+
+:::
+
+When enabled, the plugin will collect information from the request context 
(e.g. event code, transaction ID, associated subscription ID) as configured and 
serialize them into [Event JSON 
objects](https://getlago.com/docs/api-reference/events/event-object) as 
required by Lago. They will be added to the buffer and sent to Lago in batches 
of up to 100. This batch size is a 
[requirement](https://getlago.com/docs/api-reference/events/batch) from Lago. 
If you want to modify it, see [batch processor](../batch-processor.md) for more 
details.
+
+## Attributes
+
+| Name | Type | Required | Default | Valid values | Description |
+|---|---|---|---|---|---|
+| endpoint_addrs | array[string] | True |  | | Lago API address, like 
`http://127.0.0.1:3000`, it supports both self-hosted and cloud. If multiple 
endpoints are configured, the log will be pushed to a randomly determined 
endpoint from the list. |
+| endpoint_uri | string | False | /api/v1/events/batch | | Lago API endpoint, 
it needs to be set to the batch send endpoint. |
+| token | string | True |  | | Lago API key, create one for your organization 
on Lago dashboard. |
+| event_transaction_id | string | True |  | | Event's transaction ID, it is 
used to identify and de-duplicate the event, it supports string templates 
containing APISIX and NGINX variables, like `req_${request_id}`, which allows 
you to use values returned by upstream services or request-id plugin 
integration |
+| event_subscription_id | string | True |  | | Event's subscription ID, which 
is automatically generated or specified by you when you assign the plan to the 
customer on Lago, used to associate API consumption to a customer subscription, 
it supports string templates containing APISIX and NGINX variables, like 
`cus_${consumer_name}`, which allows you to use values returned by upstream 
services or APISIX consumer |
+| event_code | string | True |  | | Lago billable metric's code for 
associating an event to a specified billable item |
+| event_properties | object | False |  | | Event's properties, used to attach 
information to an event, this allows you to send certain information on a event 
to Lago, such as sending HTTP status to take a failed request off the bill, or 
sending the AI token consumption in the response body for accurate billing, its 
keys are fixed strings and its values can be string templates containing APISIX 
and NGINX variables, like `${status}` |
+| ssl_verify| boolean   | False| true | | If true, verify 
Lago's SSL certificates. |
+| timeout   | integer   | False| 3000 | [1, 6] | Timeout 
for the Lago service HTTP call in milliseconds.  |
+| keepalive | boolean   | False| true |  | If true, keep the 
connection alive for multiple requests. |
+| keepalive_timeout | integer   | False| 6 | >=1000 | Keepalive 
timeout in milliseconds.  |
+| keepalive_pool| integer   | False| 5   | >=1 | Maximum 
number of connections in the connection pool.  |
+
+This Plugin supports using batch processors to aggregate and process events in 
a batch. This avoids the need for frequently submitting the data. The batch 
processor submits data every `5` seconds or when the data in the queue reaches 

Re: [PR] feat: add lago plugin [apisix]

2025-05-20 Thread via GitHub


bzp2010 commented on code in PR #12196:
URL: https://github.com/apache/apisix/pull/12196#discussion_r2097203123


##
docs/en/latest/plugins/lago.md:
##
@@ -0,0 +1,259 @@
+---
+title: lago
+keywords:
+  - Apache APISIX
+  - API Gateway
+  - Plugin
+  - lago
+  - monetization
+  - github.com/getlago/lago
+description: The lago plugin reports usage to a Lago instance, which allows 
users to integrate Lago with APISIX for API monetization.
+---
+
+
+
+
+  https://docs.api7.ai/hub/lago"; />

Review Comment:
   removed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] feat: add lago plugin [apisix]

2025-05-20 Thread via GitHub


bzp2010 commented on code in PR #12196:
URL: https://github.com/apache/apisix/pull/12196#discussion_r2097199594


##
docs/en/latest/plugins/lago.md:
##
@@ -0,0 +1,259 @@
+---
+title: lago
+keywords:
+  - Apache APISIX
+  - API Gateway
+  - Plugin
+  - lago
+  - monetization
+  - github.com/getlago/lago
+description: The lago plugin reports usage to a Lago instance, which allows 
users to integrate Lago with APISIX for API monetization.
+---
+
+
+
+
+  https://docs.api7.ai/hub/lago"; />
+
+
+## Description
+
+The `lago` plugin pushes requests and responses to [Lago 
Self-hosted](https://github.com/getlago/lago) and [Lago 
Cloud](https://getlago.com) via the Lago REST API. the plugin allows you to use 
it with a variety of APISIX built-in features, such as the APISIX consumer and 
the request-id plugin.
+
+This allows for API monetization or let APISIX to be an AI gateway for AI 
tokens billing scenarios.
+
+:::disclaimer
+
+Lago owns its trademarks and controls its commercial products and open source 
projects.
+
+The [https://github.com/getlago/lago](https://github.com/getlago/lago) project 
uses the `AGPL-3.0` license instead of the `Apache-2.0` license that is the 
same as Apache APISIX. As a user, you will need to evaluate for yourself 
whether it is applicable to your business to use the project in a compliant way 
or to obtain another type of license from Lago. Apache APISIX community does 
not endorse it.
+
+The plugin does not contain any proprietary code or SDKs from Lago, it is 
contributed by contributors to Apache APISIX and licensed under the 
`Apache-2.0` license, which is in line with any other part of APISIX and you 
don't need to worry about its compliance.
+
+:::
+
+When enabled, the plugin will collect information from the request context 
(e.g. event code, transaction ID, associated subscription ID) as configured and 
serialize them into [Event JSON 
objects](https://getlago.com/docs/api-reference/events/event-object) as 
required by Lago. They will be added to the buffer and sent to Lago in batches 
of up to 100. This batch size is a 
[requirement](https://getlago.com/docs/api-reference/events/batch) from Lago. 
If you want to modify it, see [batch processor](../batch-processor.md) for more 
details.
+
+## Attributes
+
+| Name | Type | Required | Default | Valid values | Description |
+|---|---|---|---|---|---|
+| endpoint_addrs | array[string] | True |  | | Lago API address, like 
`http://127.0.0.1:3000`, it supports both self-hosted and cloud. If multiple 
endpoints are configured, the log will be pushed to a randomly determined 
endpoint from the list. |
+| endpoint_uri | string | False | /api/v1/events/batch | | Lago API endpoint, 
it needs to be set to the batch send endpoint. |
+| token | string | True |  | | Lago API key, create one for your organization 
on Lago dashboard. |
+| event_transaction_id | string | True |  | | Event's transaction ID, it is 
used to identify and de-duplicate the event, it supports string templates 
containing APISIX and NGINX variables, like `req_${request_id}`, which allows 
you to use values returned by upstream services or request-id plugin 
integration |
+| event_subscription_id | string | True |  | | Event's subscription ID, which 
is automatically generated or specified by you when you assign the plan to the 
customer on Lago, used to associate API consumption to a customer subscription, 
it supports string templates containing APISIX and NGINX variables, like 
`cus_${consumer_name}`, which allows you to use values returned by upstream 
services or APISIX consumer |
+| event_code | string | True |  | | Lago billable metric's code for 
associating an event to a specified billable item |
+| event_properties | object | False |  | | Event's properties, used to attach 
information to an event, this allows you to send certain information on a event 
to Lago, such as sending HTTP status to take a failed request off the bill, or 
sending the AI token consumption in the response body for accurate billing, its 
keys are fixed strings and its values can be string templates containing APISIX 
and NGINX variables, like `${status}` |
+| ssl_verify| boolean   | False| true | | If true, verify 
Lago's SSL certificates. |
+| timeout   | integer   | False| 3000 | [1, 6] | Timeout 
for the Lago service HTTP call in milliseconds.  |
+| keepalive | boolean   | False| true |  | If true, keep the 
connection alive for multiple requests. |
+| keepalive_timeout | integer   | False| 6 | >=1000 | Keepalive 
timeout in milliseconds.  |
+| keepalive_pool| integer   | False| 5   | >=1 | Maximum 
number of connections in the connection pool.  |
+
+This Plugin supports using batch processors to aggregate and process events in 
a batch. This avoids the need for frequently submitting the data. The batch 
processor submits data every `5` seconds or when the data in the queue reaches 

Re: [PR] feat: add lago plugin [apisix]

2025-05-19 Thread via GitHub


kayx23 commented on code in PR #12196:
URL: https://github.com/apache/apisix/pull/12196#discussion_r2096343183


##
docs/en/latest/plugins/lago.md:
##
@@ -0,0 +1,259 @@
+---
+title: lago
+keywords:
+  - Apache APISIX
+  - API Gateway
+  - Plugin
+  - lago
+  - monetization
+  - github.com/getlago/lago
+description: The lago plugin reports usage to a Lago instance, which allows 
users to integrate Lago with APISIX for API monetization.
+---
+
+
+
+
+  https://docs.api7.ai/hub/lago"; />
+
+
+## Description
+
+The `lago` plugin pushes requests and responses to [Lago 
Self-hosted](https://github.com/getlago/lago) and [Lago 
Cloud](https://getlago.com) via the Lago REST API. the plugin allows you to use 
it with a variety of APISIX built-in features, such as the APISIX consumer and 
the request-id plugin.
+
+This allows for API monetization or let APISIX to be an AI gateway for AI 
tokens billing scenarios.
+
+:::disclaimer
+
+Lago owns its trademarks and controls its commercial products and open source 
projects.
+
+The [https://github.com/getlago/lago](https://github.com/getlago/lago) project 
uses the `AGPL-3.0` license instead of the `Apache-2.0` license that is the 
same as Apache APISIX. As a user, you will need to evaluate for yourself 
whether it is applicable to your business to use the project in a compliant way 
or to obtain another type of license from Lago. Apache APISIX community does 
not endorse it.
+
+The plugin does not contain any proprietary code or SDKs from Lago, it is 
contributed by contributors to Apache APISIX and licensed under the 
`Apache-2.0` license, which is in line with any other part of APISIX and you 
don't need to worry about its compliance.
+
+:::
+
+When enabled, the plugin will collect information from the request context 
(e.g. event code, transaction ID, associated subscription ID) as configured and 
serialize them into [Event JSON 
objects](https://getlago.com/docs/api-reference/events/event-object) as 
required by Lago. They will be added to the buffer and sent to Lago in batches 
of up to 100. This batch size is a 
[requirement](https://getlago.com/docs/api-reference/events/batch) from Lago. 
If you want to modify it, see [batch processor](../batch-processor.md) for more 
details.
+
+## Attributes
+
+| Name | Type | Required | Default | Valid values | Description |
+|---|---|---|---|---|---|
+| endpoint_addrs | array[string] | True |  | | Lago API address, like 
`http://127.0.0.1:3000`, it supports both self-hosted and cloud. If multiple 
endpoints are configured, the log will be pushed to a randomly determined 
endpoint from the list. |
+| endpoint_uri | string | False | /api/v1/events/batch | | Lago API endpoint, 
it needs to be set to the batch send endpoint. |
+| token | string | True |  | | Lago API key, create one for your organization 
on Lago dashboard. |
+| event_transaction_id | string | True |  | | Event's transaction ID, it is 
used to identify and de-duplicate the event, it supports string templates 
containing APISIX and NGINX variables, like `req_${request_id}`, which allows 
you to use values returned by upstream services or request-id plugin 
integration |

Review Comment:
   ```suggestion
   | event_transaction_id | string | True |  | | Event's transaction ID, used 
to identify and de-duplicate the event. It supports string templates containing 
APISIX and NGINX variables, such as `req_${request_id}`, which allows you to 
use values returned by upstream services or the `request-id` plugin. |
   ```



##
docs/en/latest/plugins/lago.md:
##
@@ -0,0 +1,259 @@
+---
+title: lago
+keywords:
+  - Apache APISIX
+  - API Gateway
+  - Plugin
+  - lago
+  - monetization
+  - github.com/getlago/lago
+description: The lago plugin reports usage to a Lago instance, which allows 
users to integrate Lago with APISIX for API monetization.
+---
+
+
+
+
+  https://docs.api7.ai/hub/lago"; />
+
+
+## Description
+
+The `lago` plugin pushes requests and responses to [Lago 
Self-hosted](https://github.com/getlago/lago) and [Lago 
Cloud](https://getlago.com) via the Lago REST API. the plugin allows you to use 
it with a variety of APISIX built-in features, such as the APISIX consumer and 
the request-id plugin.
+
+This allows for API monetization or let APISIX to be an AI gateway for AI 
tokens billing scenarios.
+
+:::disclaimer
+
+Lago owns its trademarks and controls its commercial products and open source 
projects.
+
+The [https://github.com/getlago/lago](https://github.com/getlago/lago) project 
uses the `AGPL-3.0` license instead of the `Apache-2.0` license that is the 
same as Apache APISIX. As a user, you will need to evaluate for yourself 
whether it is applicable to your business to use the project in a compliant way 
or to obtain another type of license from Lago. Apache APISIX community does 
not endorse it.
+
+The plugin does not contain any proprietary code or SDKs from Lago, it is 
contributed by contributors to Apache APISIX

Re: [PR] feat: add lago plugin [apisix]

2025-05-18 Thread via GitHub


bzp2010 commented on code in PR #12196:
URL: https://github.com/apache/apisix/pull/12196#discussion_r2094751097


##
docs/en/latest/plugins/lago.md:
##
@@ -0,0 +1,259 @@
+---
+title: lago
+keywords:
+  - Apache APISIX
+  - API Gateway
+  - Plugin
+  - lago
+  - monetization
+  - github.com/getlago/lago
+description: The lago plugin reports usage to a Lago instance, which allows 
users to integrate Lago with APISIX for API monetization.
+---
+
+
+
+
+  https://docs.api7.ai/hub/lago"; />
+
+
+## Description
+
+The `lago` plugin pushes requests and responses to [Lago 
Self-hosted](https://github.com/getlago/lago) and [Lago 
Cloud](https://getlago.com) via the Lago REST API. the plugin allows you to use 
it with a variety of APISIX built-in features, such as the APISIX consumer and 
the request-id plugin.
+
+This allows for API monetization or let APISIX to be an AI gateway for AI 
tokens billing scenarios.
+
+:::disclaimer
+
+Lago owns its trademarks and controls its commercial products and open source 
projects.
+
+The [https://github.com/getlago/lago](https://github.com/getlago/lago) project 
uses the `AGPL-3.0` license instead of the `Apache-2.0` license that is the 
same as Apache APISIX. As a user, you will need to evaluate for yourself 
whether it is applicable to your business to use the project in a compliant way 
or to obtain another type of license from Lago. Apache APISIX community does 
not endorse it.
+
+The plugin does not contain any proprietary code or SDKs from Lago, it is 
contributed by contributors to Apache APISIX and licensed under the 
`Apache-2.0` license, which is in line with any other part of APISIX and you 
don't need to worry about its compliance.
+
+:::
+
+When enabled, the plugin will collect information from the request context 
(e.g. event code, transaction ID, associated subscription ID) as configured and 
serialize them into [Event JSON 
objects](https://getlago.com/docs/api-reference/events/event-object) as 
required by Lago. They will be added to the buffer and sent to Lago in batches 
of up to 100. This batch size is a 
[requirement](https://getlago.com/docs/api-reference/events/batch) from Lago. 
If you want to modify it, see [batch processor](../batch-processor.md) for more 
details.
+
+## Attributes
+
+| Name | Type | Required | Default | Valid values | Description |
+|---|---|---|---|---|---|
+| endpoint_addrs | array[string] | True |  | | Lago API address, like 
`http://127.0.0.1:3000`, it supports both self-hosted and cloud. If multiple 
endpoints are configured, the log will be pushed to a randomly determined 
endpoint from the list. |
+| endpoint_uri | string | False | /api/v1/events/batch | | Lago API endpoint, 
it needs to be set to the batch send endpoint. |
+| token | string | True |  | | Lago API key, create one for your organization 
on Lago dashboard. |
+| event_transaction_id | string | True |  | | Event's transaction ID, it is 
used to identify and de-duplicate the event, it supports string templates 
containing APISIX and NGINX variables, like `req_${request_id}`, which allows 
you to use values returned by upstream services or request-id plugin 
integration |
+| event_subscription_id | string | True |  | | Event's subscription ID, which 
is automatically generated or specified by you when you assign the plan to the 
customer on Lago, used to associate API consumption to a customer subscription, 
it supports string templates containing APISIX and NGINX variables, like 
`cus_${consumer_name}`, which allows you to use values returned by upstream 
services or APISIX consumer |
+| event_code | string | True |  | | Lago billable metric's code for 
associating an event to a specified billable item |
+| event_properties | object | False |  | | Event's properties, used to attach 
information to an event, this allows you to send certain information on a event 
to Lago, such as sending HTTP status to take a failed request off the bill, or 
sending the AI token consumption in the response body for accurate billing, its 
keys are fixed strings and its values can be string templates containing APISIX 
and NGINX variables, like `${status}` |
+| ssl_verify| boolean   | False| true | | If true, verify 
Lago's SSL certificates. |
+| timeout   | integer   | False| 3000 | [1, 6] | Timeout 
for the Lago service HTTP call in milliseconds.  |
+| keepalive | boolean   | False| true |  | If true, keep the 
connection alive for multiple requests. |
+| keepalive_timeout | integer   | False| 6 | >=1000 | Keepalive 
timeout in milliseconds.  |
+| keepalive_pool| integer   | False| 5   | >=1 | Maximum 
number of connections in the connection pool.  |
+
+This Plugin supports using batch processors to aggregate and process events in 
a batch. This avoids the need for frequently submitting the data. The batch 
processor submits data every `5` seconds or when the data in the queue reaches 

Re: [PR] feat: add lago plugin [apisix]

2025-05-18 Thread via GitHub


bzp2010 commented on code in PR #12196:
URL: https://github.com/apache/apisix/pull/12196#discussion_r2094749696


##
docs/en/latest/plugins/lago.md:
##
@@ -0,0 +1,259 @@
+---
+title: lago
+keywords:
+  - Apache APISIX
+  - API Gateway
+  - Plugin
+  - lago
+  - monetization
+  - github.com/getlago/lago
+description: The lago plugin reports usage to a Lago instance, which allows 
users to integrate Lago with APISIX for API monetization.
+---
+
+
+
+
+  https://docs.api7.ai/hub/lago"; />
+
+
+## Description
+
+The `lago` plugin pushes requests and responses to [Lago 
Self-hosted](https://github.com/getlago/lago) and [Lago 
Cloud](https://getlago.com) via the Lago REST API. the plugin allows you to use 
it with a variety of APISIX built-in features, such as the APISIX consumer and 
the request-id plugin.
+
+This allows for API monetization or let APISIX to be an AI gateway for AI 
tokens billing scenarios.
+
+:::disclaimer
+
+Lago owns its trademarks and controls its commercial products and open source 
projects.
+
+The [https://github.com/getlago/lago](https://github.com/getlago/lago) project 
uses the `AGPL-3.0` license instead of the `Apache-2.0` license that is the 
same as Apache APISIX. As a user, you will need to evaluate for yourself 
whether it is applicable to your business to use the project in a compliant way 
or to obtain another type of license from Lago. Apache APISIX community does 
not endorse it.
+
+The plugin does not contain any proprietary code or SDKs from Lago, it is 
contributed by contributors to Apache APISIX and licensed under the 
`Apache-2.0` license, which is in line with any other part of APISIX and you 
don't need to worry about its compliance.
+
+:::
+
+When enabled, the plugin will collect information from the request context 
(e.g. event code, transaction ID, associated subscription ID) as configured and 
serialize them into [Event JSON 
objects](https://getlago.com/docs/api-reference/events/event-object) as 
required by Lago. They will be added to the buffer and sent to Lago in batches 
of up to 100. This batch size is a 
[requirement](https://getlago.com/docs/api-reference/events/batch) from Lago. 
If you want to modify it, see [batch processor](../batch-processor.md) for more 
details.
+
+## Attributes
+
+| Name | Type | Required | Default | Valid values | Description |
+|---|---|---|---|---|---|
+| endpoint_addrs | array[string] | True |  | | Lago API address, like 
`http://127.0.0.1:3000`, it supports both self-hosted and cloud. If multiple 
endpoints are configured, the log will be pushed to a randomly determined 
endpoint from the list. |
+| endpoint_uri | string | False | /api/v1/events/batch | | Lago API endpoint, 
it needs to be set to the batch send endpoint. |
+| token | string | True |  | | Lago API key, create one for your organization 
on Lago dashboard. |
+| event_transaction_id | string | True |  | | Event's transaction ID, it is 
used to identify and de-duplicate the event, it supports string templates 
containing APISIX and NGINX variables, like `req_${request_id}`, which allows 
you to use values returned by upstream services or request-id plugin 
integration |
+| event_subscription_id | string | True |  | | Event's subscription ID, which 
is automatically generated or specified by you when you assign the plan to the 
customer on Lago, used to associate API consumption to a customer subscription, 
it supports string templates containing APISIX and NGINX variables, like 
`cus_${consumer_name}`, which allows you to use values returned by upstream 
services or APISIX consumer |
+| event_code | string | True |  | | Lago billable metric's code for 
associating an event to a specified billable item |
+| event_properties | object | False |  | | Event's properties, used to attach 
information to an event, this allows you to send certain information on a event 
to Lago, such as sending HTTP status to take a failed request off the bill, or 
sending the AI token consumption in the response body for accurate billing, its 
keys are fixed strings and its values can be string templates containing APISIX 
and NGINX variables, like `${status}` |
+| ssl_verify| boolean   | False| true | | If true, verify 
Lago's SSL certificates. |
+| timeout   | integer   | False| 3000 | [1, 6] | Timeout 
for the Lago service HTTP call in milliseconds.  |
+| keepalive | boolean   | False| true |  | If true, keep the 
connection alive for multiple requests. |
+| keepalive_timeout | integer   | False| 6 | >=1000 | Keepalive 
timeout in milliseconds.  |
+| keepalive_pool| integer   | False| 5   | >=1 | Maximum 
number of connections in the connection pool.  |
+
+This Plugin supports using batch processors to aggregate and process events in 
a batch. This avoids the need for frequently submitting the data. The batch 
processor submits data every `5` seconds or when the data in the queue reaches 

Re: [PR] feat: add lago plugin [apisix]

2025-05-18 Thread via GitHub


bzp2010 commented on code in PR #12196:
URL: https://github.com/apache/apisix/pull/12196#discussion_r2094747064


##
docs/en/latest/plugins/lago.md:
##
@@ -0,0 +1,259 @@
+---
+title: lago
+keywords:
+  - Apache APISIX
+  - API Gateway
+  - Plugin
+  - lago
+  - monetization
+  - github.com/getlago/lago
+description: The lago plugin reports usage to a Lago instance, which allows 
users to integrate Lago with APISIX for API monetization.
+---
+
+
+
+
+  https://docs.api7.ai/hub/lago"; />
+
+
+## Description
+
+The `lago` plugin pushes requests and responses to [Lago 
Self-hosted](https://github.com/getlago/lago) and [Lago 
Cloud](https://getlago.com) via the Lago REST API. the plugin allows you to use 
it with a variety of APISIX built-in features, such as the APISIX consumer and 
the request-id plugin.
+
+This allows for API monetization or let APISIX to be an AI gateway for AI 
tokens billing scenarios.
+
+:::disclaimer

Review Comment:
   I think so, https://docusaurus.io/docs/2.x/markdown-features/admonitions



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] feat: add lago plugin [apisix]

2025-05-17 Thread via GitHub


kayx23 commented on code in PR #12196:
URL: https://github.com/apache/apisix/pull/12196#discussion_r2094206115


##
docs/en/latest/plugins/lago.md:
##
@@ -0,0 +1,259 @@
+---
+title: lago
+keywords:
+  - Apache APISIX
+  - API Gateway
+  - Plugin
+  - lago
+  - monetization
+  - github.com/getlago/lago
+description: The lago plugin reports usage to a Lago instance, which allows 
users to integrate Lago with APISIX for API monetization.
+---
+
+
+
+
+  https://docs.api7.ai/hub/lago"; />
+
+
+## Description
+
+The `lago` plugin pushes requests and responses to [Lago 
Self-hosted](https://github.com/getlago/lago) and [Lago 
Cloud](https://getlago.com) via the Lago REST API. the plugin allows you to use 
it with a variety of APISIX built-in features, such as the APISIX consumer and 
the request-id plugin.
+
+This allows for API monetization or let APISIX to be an AI gateway for AI 
tokens billing scenarios.
+
+:::disclaimer

Review Comment:
   I've not seen a `:::disclaimer` used anywhere - please confirm that the 
admonition will be rendered properly.



##
docs/en/latest/plugins/lago.md:
##
@@ -0,0 +1,259 @@
+---
+title: lago
+keywords:
+  - Apache APISIX
+  - API Gateway
+  - Plugin
+  - lago
+  - monetization
+  - github.com/getlago/lago
+description: The lago plugin reports usage to a Lago instance, which allows 
users to integrate Lago with APISIX for API monetization.
+---
+
+
+
+
+  https://docs.api7.ai/hub/lago"; />
+
+
+## Description
+
+The `lago` plugin pushes requests and responses to [Lago 
Self-hosted](https://github.com/getlago/lago) and [Lago 
Cloud](https://getlago.com) via the Lago REST API. the plugin allows you to use 
it with a variety of APISIX built-in features, such as the APISIX consumer and 
the request-id plugin.
+
+This allows for API monetization or let APISIX to be an AI gateway for AI 
tokens billing scenarios.
+
+:::disclaimer
+
+Lago owns its trademarks and controls its commercial products and open source 
projects.
+
+The [https://github.com/getlago/lago](https://github.com/getlago/lago) project 
uses the `AGPL-3.0` license instead of the `Apache-2.0` license that is the 
same as Apache APISIX. As a user, you will need to evaluate for yourself 
whether it is applicable to your business to use the project in a compliant way 
or to obtain another type of license from Lago. Apache APISIX community does 
not endorse it.
+
+The plugin does not contain any proprietary code or SDKs from Lago, it is 
contributed by contributors to Apache APISIX and licensed under the 
`Apache-2.0` license, which is in line with any other part of APISIX and you 
don't need to worry about its compliance.
+
+:::
+
+When enabled, the plugin will collect information from the request context 
(e.g. event code, transaction ID, associated subscription ID) as configured and 
serialize them into [Event JSON 
objects](https://getlago.com/docs/api-reference/events/event-object) as 
required by Lago. They will be added to the buffer and sent to Lago in batches 
of up to 100. This batch size is a 
[requirement](https://getlago.com/docs/api-reference/events/batch) from Lago. 
If you want to modify it, see [batch processor](../batch-processor.md) for more 
details.
+
+## Attributes
+
+| Name | Type | Required | Default | Valid values | Description |
+|---|---|---|---|---|---|
+| endpoint_addrs | array[string] | True |  | | Lago API address, like 
`http://127.0.0.1:3000`, it supports both self-hosted and cloud. If multiple 
endpoints are configured, the log will be pushed to a randomly determined 
endpoint from the list. |
+| endpoint_uri | string | False | /api/v1/events/batch | | Lago API endpoint, 
it needs to be set to the batch send endpoint. |
+| token | string | True |  | | Lago API key, create one for your organization 
on Lago dashboard. |
+| event_transaction_id | string | True |  | | Event's transaction ID, it is 
used to identify and de-duplicate the event, it supports string templates 
containing APISIX and NGINX variables, like `req_${request_id}`, which allows 
you to use values returned by upstream services or request-id plugin 
integration |
+| event_subscription_id | string | True |  | | Event's subscription ID, which 
is automatically generated or specified by you when you assign the plan to the 
customer on Lago, used to associate API consumption to a customer subscription, 
it supports string templates containing APISIX and NGINX variables, like 
`cus_${consumer_name}`, which allows you to use values returned by upstream 
services or APISIX consumer |
+| event_code | string | True |  | | Lago billable metric's code for 
associating an event to a specified billable item |
+| event_properties | object | False |  | | Event's properties, used to attach 
information to an event, this allows you to send certain information on a event 
to Lago, such as sending HTTP status to take a failed request off the bill, or 
sending the AI token consumption in the response body for

Re: [PR] feat: add lago plugin [apisix]

2025-05-16 Thread via GitHub


bzp2010 commented on PR #12196:
URL: https://github.com/apache/apisix/pull/12196#issuecomment-2886021868

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


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] feat: add lago plugin [apisix]

2025-05-16 Thread via GitHub


membphis commented on code in PR #12196:
URL: https://github.com/apache/apisix/pull/12196#discussion_r2092581815


##
apisix/plugins/lago.lua:
##
@@ -0,0 +1,225 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+local type = type
+local pairs= pairs
+local math_random  = math.random
+local ngx  = ngx
+
+local http= require("resty.http")
+local bp_manager_mod  = require("apisix.utils.batch-processor-manager")
+local core= require("apisix.core")
+local str_format  = core.string.format
+
+local plugin_name = "lago"
+local batch_processor_manager = bp_manager_mod.new("lago logger")
+
+local schema = {
+type = "object",
+properties = {
+-- core configurations
+endpoint_addrs = {
+type = "array",
+minItems = 1,
+items = core.schema.uri_def,
+description = "Lago API address, like http://127.0.0.1:3000, "
+.. "it supports both self-hosted and cloud. If 
multiple endpoints are"
+.. " configured, the log will be pushed to a randomly 
determined"
+.. " endpoint from the list.",
+},
+endpoint_uri = {
+type = "string",
+minLength = 1,
+default = "/api/v1/events/batch",
+description = "Lago API endpoint, it needs to be set to the batch 
send endpoint.",
+},
+token = {
+type = "string",
+description = "Lago API key, create one for your organization on 
dashboard."
+},
+event_transaction_id = {
+type = "string",
+description = "Event's transaction ID, it is used to identify and 
de-duplicate"
+.. " the event, it supports string templates 
containing APISIX and"
+.. " NGINX variables, like \"req_${request_id}\", 
which allows you"
+.. " to use values returned by upstream services or 
request-id"
+.. " plugin integration",
+},
+event_subscription_id = {
+type = "string",
+description = "Event's subscription ID, which is automatically 
generated or"
+.. " specified by you when you assign the plan to the 
customer on"
+.. " Lago, used to associate API consumption to a 
customer subscription,"
+.. " it supports string templates containing APISIX 
and NGINX variables,"
+.. " like \"cus_${consumer_name}\", which allows you 
to use values"
+.. " returned by upstream services or APISIX consumer",
+},
+event_code = {
+type = "string",
+description = "Lago billable metric's code for associating an 
event to a specified"
+.. "billable item",
+},
+event_properties = {
+type = "object",
+patternProperties = {
+[".*"] = {
+type = "string",
+minLength = 1,
+},
+},
+description = "Event's properties, used to attach information to 
an event, this"
+.. " allows you to send certain information on a event 
to Lago, such"
+.. " as sending HTTP status to take a failed request 
off the bill, or"
+.. " sending the AI token consumption in the response 
body for accurate"
+.. " billing, its keys are fixed strings and its 
values can be string"
+.. " templates containing APISIX and NGINX variables, 
like \"${status}\""
+},
+
+-- connection layer configurations
+ssl_verify = {type = "boolean", default = true},
+timeout = {
+type = "integer",
+minimum = 1,
+maximum = 6,
+default = 3000,
+description = "timeout in milliseconds",
+},
+keepalive = {type = "boolean", default = true},
+keepalive_timeout = {
+type = "integer",
+minimum = 1000,
+

Re: [PR] feat: add lago plugin [apisix]

2025-05-16 Thread via GitHub


bzp2010 commented on code in PR #12196:
URL: https://github.com/apache/apisix/pull/12196#discussion_r2092587177


##
apisix/plugins/lago.lua:
##
@@ -0,0 +1,225 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+local type = type
+local pairs= pairs
+local math_random  = math.random
+local ngx  = ngx
+
+local http= require("resty.http")
+local bp_manager_mod  = require("apisix.utils.batch-processor-manager")
+local core= require("apisix.core")
+local str_format  = core.string.format
+
+local plugin_name = "lago"
+local batch_processor_manager = bp_manager_mod.new("lago logger")
+
+local schema = {
+type = "object",
+properties = {
+-- core configurations
+endpoint_addrs = {
+type = "array",
+minItems = 1,
+items = core.schema.uri_def,
+description = "Lago API address, like http://127.0.0.1:3000, "
+.. "it supports both self-hosted and cloud. If 
multiple endpoints are"
+.. " configured, the log will be pushed to a randomly 
determined"
+.. " endpoint from the list.",
+},
+endpoint_uri = {
+type = "string",
+minLength = 1,
+default = "/api/v1/events/batch",
+description = "Lago API endpoint, it needs to be set to the batch 
send endpoint.",
+},
+token = {
+type = "string",
+description = "Lago API key, create one for your organization on 
dashboard."
+},
+event_transaction_id = {
+type = "string",
+description = "Event's transaction ID, it is used to identify and 
de-duplicate"
+.. " the event, it supports string templates 
containing APISIX and"
+.. " NGINX variables, like \"req_${request_id}\", 
which allows you"
+.. " to use values returned by upstream services or 
request-id"
+.. " plugin integration",
+},
+event_subscription_id = {
+type = "string",
+description = "Event's subscription ID, which is automatically 
generated or"
+.. " specified by you when you assign the plan to the 
customer on"
+.. " Lago, used to associate API consumption to a 
customer subscription,"
+.. " it supports string templates containing APISIX 
and NGINX variables,"
+.. " like \"cus_${consumer_name}\", which allows you 
to use values"
+.. " returned by upstream services or APISIX consumer",
+},
+event_code = {
+type = "string",
+description = "Lago billable metric's code for associating an 
event to a specified"
+.. "billable item",
+},
+event_properties = {
+type = "object",
+patternProperties = {
+[".*"] = {
+type = "string",
+minLength = 1,
+},
+},
+description = "Event's properties, used to attach information to 
an event, this"
+.. " allows you to send certain information on a event 
to Lago, such"
+.. " as sending HTTP status to take a failed request 
off the bill, or"
+.. " sending the AI token consumption in the response 
body for accurate"
+.. " billing, its keys are fixed strings and its 
values can be string"
+.. " templates containing APISIX and NGINX variables, 
like \"${status}\""
+},
+
+-- connection layer configurations
+ssl_verify = {type = "boolean", default = true},
+timeout = {
+type = "integer",
+minimum = 1,
+maximum = 6,
+default = 3000,
+description = "timeout in milliseconds",
+},
+keepalive = {type = "boolean", default = true},
+keepalive_timeout = {
+type = "integer",
+minimum = 1000,
+