From Months to Days: A Case Study in Rapid AI Integration
Detailed breakdown of how we integrated AI capabilities into three production applications -- DocubotAI, My Family Recipes, and our internal admin platform -- in days instead of months. Including technical decisions, architecture patterns, and real costs.
Table of Contents
Why AI Integration Takes Months (and Why It Shouldn't)
A common scenario: a business wants to add AI capabilities to their product. They contact an agency. The agency proposes a 6-month project with a dedicated AI/ML team, data pipeline infrastructure, model training, and a six-figure budget. The business either pays up or shelves the idea entirely.
This happens because most agencies approach AI integration as if they need to build a machine learning platform from scratch. In 2025, that is almost never true. The foundational models from OpenAI, Google, and Anthropic are extraordinarily capable out of the box. The real engineering challenge is not building AI -- it is integrating it thoughtfully into a product that solves a specific user problem.
Where Traditional AI Projects Spend Time:
- Vendor evaluation (4-8 weeks): Comparing dozens of providers, running POCs, negotiating contracts
- Custom model training (8-16 weeks): Collecting data, labeling, training, evaluating -- often unnecessary with modern foundation models
- Infrastructure build-out (4-8 weeks): GPU clusters, MLOps pipelines, model serving -- irrelevant when using API-based models
- Committee approvals (2-6 weeks): Security reviews, architecture boards, stakeholder sign-offs at every stage
At Twin Current, we skip most of these steps -- not because we cut corners, but because the landscape has changed. Foundation model APIs have made custom training unnecessary for most business applications. The real work is prompt engineering, error handling, and user experience design around AI outputs.
Our Approach: AI as a Feature, Not a Product
The key insight behind our rapid AI integration is treating AI as a feature within a product, not as a product unto itself. This changes the engineering approach entirely.
Start With the User Problem
We never start with "let's add AI." We start with a concrete user problem: "Users need to extract data from receipts without manual entry." The AI is the implementation detail, not the goal. This focus eliminates scope creep and keeps the integration tightly scoped.
Choose the Right Model for the Task
Not every task needs GPT-4. For DocubotAI, we use OpenAI for its strong document comprehension. For receipt scanning in our admin platform, Google Gemini excels at structured data extraction from images. For recipe scanning, vision models handle handwritten text recognition. Matching model strengths to tasks saves both cost and latency.
Build Robust Fallbacks
AI outputs are probabilistic, not deterministic. Every AI feature we build includes a manual fallback path. If the receipt scanner cannot extract the amount with high confidence, it pre-fills what it can and highlights uncertain fields for human review. The user is never stuck.
Ship, Then Iterate
Prompt engineering in production beats prompt engineering in a lab. Real user data reveals edge cases that synthetic test data never will. We ship a working AI feature quickly, then refine prompts based on actual usage patterns. This approach consistently produces better results than months of pre-launch tuning.
Case 1: DocubotAI.app - Conversational Document Intelligence
DocubotAI is a SaaS platform that lets users upload documents (PDFs, Word files, text files) and then have a conversation with them. Users ask questions in natural language and receive answers with citations pointing back to the specific sections of the source document.
The Technical Challenge
The core problem was not just calling the OpenAI API -- it was building a reliable pipeline that handles documents of varying length, format, and quality. A 200-page PDF cannot be sent to the API in one call. The system needs to chunk documents intelligently, maintain context across chunks, and provide accurate citations.
Our Architecture
- Document ingestion: Parse uploaded files, extract text, split into overlapping chunks of approximately 1,500 tokens each with 200-token overlap for context continuity
- Embedding and retrieval: Each chunk is embedded using OpenAI embeddings and stored in a vector database. User queries are embedded and matched against the most relevant chunks using cosine similarity
- Conversational chain: The top 5-8 relevant chunks are injected into the system prompt alongside the user's question. GPT-4 generates an answer constrained to the provided context
- Citation tracking: Each chunk carries metadata (page number, section title). The system prompt instructs the model to cite sources, and we map citations back to specific document locations
- Streaming responses: Answers stream to the user in real-time using Server-Sent Events, so they see the response building word by word rather than waiting for the full completion
Timeline Breakdown
The key accelerator was not writing any ML code. The intelligence comes entirely from OpenAI's API. Our engineering effort went into the retrieval pipeline, user experience, and making the AI outputs reliable and useful. An agency building a "custom AI solution" would have spent months on infrastructure we simply did not need.
Case 2: My Family Recipes - AI-Powered Recipe Scanning
My Family Recipes is a mobile app (iOS and Android) built with React Native. The core feature is simple: photograph a handwritten recipe card or a page from a cookbook, and the AI extracts a structured recipe with title, ingredients (with quantities and units), step-by-step instructions, and cooking time.
The Technical Challenge
Handwritten text recognition is significantly harder than printed OCR. Grandmother's recipe cards come in every handwriting style, often with crossed-out words, margin notes, and ingredient shorthand ("1 tsk" for teaspoon, "dl" for deciliter in Danish recipes). The AI needs to handle all of this and produce clean, structured output.
Our Architecture
- Image capture: React Native camera integration with auto-crop detection to frame the recipe area. Images are compressed to reduce API latency while preserving text readability
- Vision API call: The image is sent to the vision model with a structured prompt requesting JSON output with specific fields: title, servings, prep_time, cook_time, ingredients (array of objects with name, quantity, unit), and steps (ordered array)
- Response validation: We validate the JSON response against a Zod schema. If fields are missing or malformed, we retry with a refined prompt before falling back to manual entry
- User review: The extracted recipe is shown in an editable form. Users can correct any misread ingredients or instructions before saving. This feedback loop indirectly improves our prompts over time
Prompt Engineering Details
The prompt for recipe extraction went through 14 iterations during development. Key improvements included:
- Adding explicit instructions for Danish measurement units (dl, tsk, spsk, stk) alongside metric and imperial
- Including few-shot examples of handwritten recipe cards with expected outputs
- Instructing the model to separate "pinch of" and "to taste" quantities from measured amounts
- Requesting confidence scores for each extracted field so the UI can highlight uncertain items
The entire AI feature -- from camera capture to structured recipe in the database -- took 5 days of the 18-day total build. The rest was standard mobile development: navigation, recipe storage, search, sharing, and App Store/Play Store submission.
Case 3: Internal Admin Platform - AI Receipt Processing
Our own internal admin platform handles expense management for Twin Current ApS. The AI feature: upload a photo of a receipt, and the system automatically extracts the merchant name, total amount, VAT (Danish moms at 25%), date, and suggests an expense category. The extracted data pre-fills the expense form.
Why Google Gemini
We chose Gemini for this task specifically because of its multimodal capabilities and strong performance on structured data extraction from images. For receipt processing, the key requirement is not creative text generation -- it is accurate extraction of specific fields (numbers, dates, names) from a visual document. Gemini's vision capabilities handle this reliably, and at lower cost per call than GPT-4 Vision for this specific use case.
Danish VAT Handling
A critical detail for Danish businesses: the AI extracts the total amount and then the system calculates the VAT component. Danish receipts typically show the total including 25% moms. The extraction prompt instructs Gemini to identify whether the amount shown is inclusive or exclusive of VAT, and to extract the VAT amount separately if it is printed on the receipt.
Expense Categorization
Beyond extraction, Gemini also suggests an expense category based on the merchant name and items purchased. The system maintains a mapping of previously categorized expenses, so repeated purchases from the same merchant are categorized instantly without an API call. The AI is only invoked for new or ambiguous merchants.
This feature saves approximately 2-3 hours per week of manual data entry for our team. At our billing rates, the AI API costs (roughly 150-200 DKK per month) pay for themselves within the first day of each month.
Reusable Patterns for Rapid AI Integration
Across all three projects, several patterns emerged that we now apply to every AI integration. These patterns are what make the difference between a 6-month project and a 2-week feature.
Pattern 1: Structured Output Prompting
Always request JSON output with a defined schema. This makes response parsing deterministic and validation straightforward. We use Zod schemas on both the prompt definition side (to generate the expected format description) and the response validation side.
// Define the expected shape
const ReceiptSchema = z.object({
merchant: z.string(),
amount: z.number(),
currency: z.string().default('DKK'),
vat: z.number().optional(),
date: z.string(),
category: z.string(),
confidence: z.number().min(0).max(1)
})
// Validate the AI response
const parsed = ReceiptSchema.safeParse(aiResponse)
if (!parsed.success) {
// Fall back to manual entry
}Pattern 2: Confidence-Based UI
Request a confidence score from the model for each extracted field. Use this to drive the UI: high-confidence fields are pre-filled and grayed out, medium-confidence fields are pre-filled but highlighted for review, and low-confidence fields are left blank for manual entry.
Pattern 3: Progressive Enhancement
Every AI feature works without AI. The receipt form works with manual entry. The recipe form works with typed input. The document Q&A works with full-text search. AI enhances the experience but is never a single point of failure.
Pattern 4: Cost-Capped API Usage
Implement per-user and per-project API cost caps. Track token usage per call, aggregate monthly spending, and alert before hitting budget thresholds. This prevents a single user or a prompt injection from running up a massive API bill.
Cost and Timeline Analysis
Here is a direct comparison of how a traditional agency approach and our approach differ on timeline and effort for a typical AI feature integration:
Monthly AI API Costs (Actual)
These costs are trivial compared to the development time saved. The admin platform's receipt processing alone saves 8-12 hours of manual data entry per month. At any reasonable billing rate, the 175 DKK monthly API cost pays for itself before lunch on the first day.
Conclusion: AI Integration Is a Solved Problem
The bottleneck in AI integration is no longer the AI itself. Foundation models from OpenAI, Google, and others are remarkably capable out of the box. The real engineering work is product design: understanding what the user needs, choosing the right model for the task, building robust error handling, and creating a user experience that handles the probabilistic nature of AI outputs gracefully.
Key Takeaways
- You do not need a custom ML model for most business AI features -- foundation model APIs handle 95% of use cases
- Match the model to the task: GPT-4 for document analysis, Gemini for structured extraction, vision models for image processing
- Always build manual fallbacks -- AI enhances the workflow but must never block it
- Ship early and iterate prompts based on real usage -- production data is your best training set
- Monthly API costs for most business features are negligible compared to the value created
If someone tells you that adding AI to your product is a 6-month, six-figure project, they are either building something genuinely novel (autonomous driving, drug discovery) or they are overengineering a solution that should take weeks. For the vast majority of business applications, rapid AI integration is not just possible -- it is the responsible approach.
Want AI in your product?
We can scope an AI integration for your product in a single conversation. Most features ship in under three weeks.