Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
iMessage calorie tracking assistant powered by AI, using GPT-4.1 vision and USDA nutrition data.
Caltext is an open-source AI assistant template for building an iMessage calorie-tracking bot that accepts plain text and photos, logs nutrition via USDA data, and sends automated reminders and summaries through Sendblue.
Caltext is a production-ready starter for an AI-powered nutrition tracking assistant accessed entirely through iMessage. It takes a user's incoming text messages and photos as input, processes them with GPT-4.1 vision and the AI SDK v6, and returns structured calorie and macro logging, daily summaries, and weekly recaps through Sendblue. The codebase is a Bun + Turborepo monorepo with a Hono API on Nitro deployed to Vercel across three regions (US East, London, Tokyo), using Upstash Redis for global state.
apps/api (routes, webhook handler, bot singleton, router) from packages/ai, packages/db, and packages/shared for clean reusability.Caltext is for developers who want to ship a conversational health assistant without building the iMessage integration, nutrition data pipeline, and reminder infrastructure from scratch. It suits developers comfortable with Bun, TypeScript, Hono, and Vercel, and teams that need a reference implementation for AI-powered food logging with real USDA nutrition data. Product builders can fork it to create custom dietitian, wellness, or habit-tracking bots with the same message-driven flow.
A user texts the Caltext iMessage number; Sendblue forwards the incoming message to the webhook endpoint in the Hono API. The router decides whether the user is new (starting conversational onboarding) or returning (forwarding to the AI assistant). For photo messages, GPT-4.1 vision extracts food items and the assistant looks up nutrition from USDA FoodData Central; for text, it queries the same USDA data directly. Logged entries are stored in Upstash Redis, and the reminder loop triggers daily summaries and weekly recaps via Sendblue.
