CU Price and Rate limit cose

Hi. A lot of questions already ont he forum.
So want to make clear about prices an rate limit cost

I’m confused what are Base price and rate limit cost

Very blurry description of those 2 variables

I have pro plan and on it was 60. Now 150 units per second
I’ve made counter of CU in my application.
Each second I calculate up to 60 CU units for example.

Still, I made system that restricts using more then 60, BUT sdk, still throwing errors 429. Unclear for me. Or I setuped uncorrectly limits. But even I fetch costs from sdk EvmApi utils

Question are:

  1. Ho to calculate correctly CU per requests? Calculate by price? Price is CU per requests if I got correctly. But what is then Rate Limit cost? Is it also CU? But then by what to calculate, by Price or by Rate Limit cost? Or combined. Documantation is very blurry to understand this

  2. What is the term second on Moralis SDK? Second can be by UNIX like 1st second of minute or 2nd second of minute, 3rd, 4,5,6,7 and etc
    Or are limits recorded by when API request was sent?
    I mean by UNIX you can start request in 1st second 200 milliseconds, then should I calculate limits in window between:
    a) 1st to 2nd second
    b) 1st + 200 millisecoinds to 2nd + 200 milliseconds?

Hi @Nine8ty

Thanks for the questions.

Base price CU is something that gets added in your API usage, Rate limit cost will only be counted for the rate limit.

For example: The rate limit CU of getBlock endpoint is 5CU. On pro plan you can call this endpoint 12 times in a second since pro plan has 60CU/sec rate limit. The total CU usage for these 12 requests will be 120CU since price of getBlock endpoint is 10

I did not understand what you mean by this. Mostly the rate limit calculation will be stored in cache. So I believe it will be counted at the millisecond level.

Let us know if this answers your questions or if you have any other questions.:raised_hands:

Am I got it correctly.
Price in CU is for the global counter of API plan

And

Rate limit cost CU is for limits per second.

Is it correct?

Yes, that is correct.