Http request cycle costs

Is there any current cost breakdown on the new HTTP request feature?
I’m currently looking to pull xml data from sites and it’s costing more than i hoped.
My scenario is a GET request with no headers and getting a ~19kb file. Currently this is costing ~0.21T cycles per request which is very cost prohibitive for my scenario.
My alternative is to have something offchain updating onchain data like an oracle.
Any insight or advice would be great

1 Like

HTTP outcalls feature is charged for when being used. The current pricing is defined to charge a base fee of 400m cycles for an HTTP request in addition to 100K cycles per request byte and per max_response_bytes byte. Because of the per-request fixed cost and the overhead of HTTP requests, e.g., due to headers, it is advantageous from a cost perspective to make fewer requests with larger responses to retrieve the same information as with a larger number of smaller requests, if this is feasible from an application perspective. The cycles provided with the call must be sufficient for covering the cost of the request, excessive cycles are returned to the caller.

The current pricing is defined to be rather conservative (expensive) and prices may change in the future with the introduction of an update of the pricing model. However, note that an HTTP outcall with a small response, like the ones used for querying financial APIs, only costs fractions of a USD cent, which is substantially cheaper than fees charged for a call by oracles on most blockchains.

The cost breakdown is explained here: Internet Computer Content Validation Bootstrap

5 Likes

Unfortunately my requests are very text heavy and i can’t seem to rely on compression from the other end. So I’ll have to consider my options. I appreciate the help!

1 Like

Do you have an example of the “financial feed” Api you used to call to demonstrate?

Here’s a Motoko example: examples/motoko/defi at master · dfinity/examples · GitHub

And here’s a Rust example: examples/rust/defi at master · dfinity/examples · GitHub

Just chiming in: with the cost function that @Angelo gave, shouldn’t the price of a call for fetching 19kB be something like:
400 * 10^6 + 19000 * 10^5 so somewhere around 2.3 * 10^9 so two orders of magnitude lower? (0.21T seems more aligned with fetching 2MB of data)

I think comparing HTTP outcalls pricing to pricing of third party oracle services is regressive.

HTTP outcalls represent SO MUCH MORE. They are essentially a way for a “world computer” to interface with the external world with the language spoken by the entire internet, which is HTTP.

We are not looking to just build exchanges on the IC. We are looking to build any and every app that exists on the internet.

If we are going up against all forms of traditional hosting, we need to do better. Of course, we should be accounting for the replicated compute that occurs on 13 different nodes.

Just my 2 cents :slight_smile:

I think that might be due to the way the call works. The caller needs to explicitly set the max_response_bytes or pay the entire 2MB payload costs as described here, point 5:
https://internetcomputer.org/docs/current/developer-docs/integrations/http_requests/http_requests-how-it-works#how-an-https-outcall-is-processed-by-the-ic

1 Like

Nice find, I’ll have to try out setting the max