DEV Community

Cover image for CostGPT - A cost estimator for Linode resource cost based on GPT model
I love integers
I love integers

Posted on

CostGPT - A cost estimator for Linode resource cost based on GPT model

What I built

CostGPT is a natural language based cloud resource cost estimator.

Category Submission:

Wacky Wildcard

App Link

costgpt.cloud

Screenshots

CostGPT screenshot

Description

CostGPT is built based on Open AI's GPT API.

Users describe their application use case in natural language and CostGPT returns the estimated resources needed to run the application, and the estimated cost of each resource.

For example, one user might say,

"I want to run an ecommerce website based on WooCommerce. The website has 200 SKUs and anticipates to have 200 transactions daily. The product detail pages have many images to display. I do not estimate the daily PV to exceed 10000."

CostGPT will give an analysis on the resources needed to run the application, and why.
It also summarizes the cost for each Linode cloud resources mentioned in the analysis.

Link to Source Code

CostGPT

CostGPT is a natural language based cloud resource cost estimator. It is built based on Open AI's GPT API.

Users describe their cloud resource usage in natural language and CostGPT returns the estimated resources needed to run the application, and the estimated cost of each resource.

See a demo video here.

Try it out here.

Usage

Generate an API key from Open AI's GPT API. Copy the API key into a file at backend/.env.

echo << EOF > backend/.env
OPENAI_API_KEY=<your api key>
OPENAI_MODEL=text-davinci-003
EOF
Enter fullscreen mode Exit fullscreen mode

Start the service locally.

docker-compose -f docker-compose.dev.yaml up

# then visit http://localhost
Enter fullscreen mode Exit fullscreen mode

License

The project is licensed under the Apache License 2.0.




Permissive License

Apache 2.0

Background

(I asked ChatGPT why I want to build such a product, here are its thoughts)

  • Easy to use: Not everyone is familiar with the technical jargon used in cloud computing, and so it can be challenging to understand how much different resources cost. A natural language-based cost estimator like CostGPT can make it much easier for non-technical users to understand the costs of different resources.

  • Time-saving: With a natural language-based cost estimator, users don't have to spend time researching the cost of different resources or creating complex spreadsheets to estimate the cost. They can simply ask CostGPT for an estimate and get an accurate answer in a matter of seconds.

  • Cost-effective: By having a better understanding of the costs of different cloud resources, users can make more informed decisions about which resources to use and how to optimize their usage. This can lead to significant cost savings over time.

  • Accessibility: A natural language-based cost estimator can make cloud computing more accessible to a wider range of people, including those who may not have a technical background or who may have disabilities that make it difficult to use traditional cost estimation tools.

  • Scalability: As organizations scale their cloud infrastructure, it becomes more challenging to manage costs. A natural language-based cost estimator like CostGPT can help organizations estimate and manage costs as their cloud usage grows.

  • Accuracy: With a natural language-based cost estimator, there is less risk of human error in calculating costs. CostGPT can provide accurate and consistent estimates every time, reducing the risk of unexpected costs or budget overruns.

How I built it

I checked on the detailed pricing page of Linode, and scanned through its offerings. I find the pricing very easy to understand and straightforward (compared with my previous experience with AWS, GoogleCloud). There is almost no hidden cost.

The offerings are clear and lean, too. You have the very essential blocks to build a modern app.

I scraped those pricing and offering into tables, and later provided them as part of the prompt sent to the GPT API.

I designed the prompt to ask the GPT model to provide an architecture design using the resources provided by Linode.

After getting an application architecture, I designed the second prompt to ask the GPT model to give a summarization in the table form of the resources and their costs.

The UI is responsible to render this information to the user.

This is the first time I am building with Open AI's API, and doing some work with the so-called prompt engineering. I find it that to get the desired results, you need careful design of the prompt and choose what information to include in the prompt.

One prompt also may not be enough. It may also require a chain of different prompts to get what you require.

It also gives me the chance to learn Linode's offering, which I highly appreciate the clearness and straightforwardness.

The whole application is deployed on a Linode compute node.

Additional Resources/Info

Linode already has a cost calculator, which is pretty neat.

But sometimes for non-tech audience and inexperienced engineers, it might hard to decide the right "Tshirt size" to run their applications.

I hope it might be useful for people to get an initial understanding on the cloud cost by having a product like CostGPT

Top comments (0)