Overview
This node, named "Florentin Node," provides functionality to generate a credit report based on specified metrics. It calculates the total credits consumed by multiplying token usage with a credits conversion rate for each metric group provided. This node is useful in scenarios where you need to monitor or report on resource consumption, such as API token usage and its corresponding cost or credit impact.
For example, if you want to track how many credits were used based on different usage metrics and their respective conversion rates, this node will aggregate those values and output both individual calculations and the total credits consumed.
Properties
Name | Meaning |
---|---|
Metrics | One or more groups of metrics, each containing: - Usage: Token usage (number). - Credits Conversion Rate: The rate at which usage converts to credits (number). |
Output
The node outputs an array of JSON objects:
For each metric group, it outputs an object with:
usage
: The token usage value.rate
: The credits conversion rate.credits
: The calculated credits for that metric (usage multiplied by rate).
After processing all metric groups, it outputs a final object with:
totalCredits
: The sum of all calculated credits from the metric groups.
Example output:
[
{
"json": {
"usage": 100,
"rate": 0.5,
"credits": 50
}
},
{
"json": {
"usage": 200,
"rate": 0.3,
"credits": 60
}
},
{
"json": {
"totalCredits": 110
}
}
]
Dependencies
- No external services or API keys are required.
- The node operates purely on input data provided via its properties.
Troubleshooting
- Missing or invalid metrics input: Ensure that the "Metrics" property is provided with valid numeric values for both usage and rate. Non-numeric or missing values may cause incorrect calculations or errors.
- Empty metrics array: If no metrics are provided, the node will output zero total credits but no detailed entries.
- Data type issues: Confirm that usage and rate are numbers; strings or other types may lead to unexpected results.
Links and References
- No external links or references are applicable for this custom node implementation.