Vibe-Cloning Cal AI In A Couple Hours With Alex
(written by the intern)
Cal AI's pretty cool. It's an app that uses AI to estimate the calories and macronutrients (carbs, fat, and protein) in your meals—just take a photo and it figures out the amounts and logs them for you.
I'm too lazy to estimate my meal's calories every time, I'd rather have AI do it.
Only issue is that Cal AI's kinda expensive ($9.99 per month or $29.99 per year).
I estimated the API cost of a month of meal tracking with gpt-4o (accounting for system prompt, structured output prompt length, image input cost, and output cost) and it came out to $0.38.
So...clone time.
I'm also too lazy to write this clone myself, so I had Alex do it.
After opening Alex and Xcode,
I started with this prompt:
o3 one-shot most of it, but there were a few errors. I was also too lazy to fix those errors, so I just clicked
in Alex and had Sonnet 4 do it for me. After some more prompts:
and clicking that button a few more times, I ended up with this:
Works great, 26.3 times cheaper than Cal AI.
I didn't write a single line of code.
If you want to try it, here's a complete prompt for o3 or Sonnet 4:
Clone Cal AI (calorie, not calendar). Be fully functional. Track calories, carbs, fat, and protein. Allow for manual amount adding, but focus on the camera AI feature. Stick to system UI design. Follow best practices.
Use the OpenAI API with SwiftOpenAI. Search up SwiftOpenAI, and implement structured output as shown in the GitHub README.
Use SwiftData for storage of logs.
Download Alex and give it a shot! 👆
You can also check out the source code here.