Credits Redemption
Nevermined authorizes access to AI agents and, depending on each redemption criteria, charges the users a specific amount of credits for their successful access.
info
Users getting access to AI Agents associated with a time limited plan don’t redeem any credits. They expire automatically when the plan ends.
The credits redemption flow is as follows:
- A user holding a payment plan giving access to an AI Agent wants to access to send a query to it
- The user via Nevermined libraries get the JWT access token to the Agent via the Nevermined Node (this process only needs to be do once per agent, not per request)
- The user sends a HTTP request to the AI Agent through a Nevermined Proxy. The user sends in the HTTP Authorization header the JWT token.
- The Proxy validates the request and checks the user has enough credits to query the AI Agent.
- If that’s the case the user request is proxied to the upstream AI Agent. The proxy decrypts and replaces the JWT by the correct AI agent authorization.
- The upstream AI Agent gets the request and processes it. If the agent redemption criteria is dynamic credits, the AI Agent calculates the cost of the user request depending on complexity.
- The AI Agent returns the output and the response HTTP Header NVMCreditsConsumed with the number of credits to redeem.
- The Proxy returns the AI Agent to the end user
- Asynchronously the Proxy validates the number of costs in credits reported by the AI Agent and if it’s between the minimum and maximum, redeems (burn) these credits.
The AI Agent only can report credits to redeem between the thresholds specified in the AI Agent metadata. If the AI Agent reports a number of credits out of that range (for example overcharging the number of credits) the Nevermined Proxy will redeem the minimum amount of credits specified in the agent metadata.