## Business Pain Points
Business Pain Points
Personalized training plans for fitness apps are a classic case of "human labor is expensive, AI is great."
Independent developer Lao Chen's fitness app had been live for six months, and by the time it reached 30,000 users, it hit a bottleneck: after users filled in their body data, training goals, and equipment conditions, the system could only return a dozen or so template plans, roughly filtered by tags. Users complained that the plans were "one-size-fits-all," and the paid conversion rate stayed below 4%.
There are only two paths to doing personalization well:
- Human coach review: Hire certified coaches. At 30 minutes per plan, with 500 daily active users submitting requests, you'd need 4-5 full-time coaches, costing at least 40,000 yuan per month, with response delays stretching to 48 hours during peak times;
- Pure rule engine: Condition branches growing into the hundreds become unmaintainable, and they can't understand natural-language requests like "I have an old knee injury but want to train legs."
For a small team of three to five people, this dilemma was nearly unsolvable—until they brought in a large language model.
Architecture Design
The overall architecture has four layers, with one core principle: AI only handles "generation and explanation"; safety and deterministic logic stay in the code layer.
User input (form + natural language)
│
▼
┌─────────────────────┐
│ Input Structuring Layer │ ← Form data is structured directly;
│ (intent parsing + validation) │ natural language goes to a small model for extraction
└─────────┬───────────┘
▼
┌─────────────────────┐
│ Constraint Validation Layer │ ← Injury contraindications, age limits,
│ (rule engine, hard constraints) │ training volume caps, and other hard rules
└─────────┬───────────┘
▼
┌─────────────────────┐
│ Plan Generation Layer │ ← LLM generates an 8-week plan based
│ (LLM + JSON output) │ on structured input, with enforced JSON Schema
└─────────┬───────────┘
▼
┌─────────────────────┐
│ Safety Validation & Persistence │ ← Secondary validation against the exercise
│ (whitelist filtering) │ whitelist, dedup, difficulty normalization
└─────────────────────┘Two key design decisions:
- Exercise whitelist: Every exercise output by the LLM must match the local exercise library (about 600 exercises with videos). Hallucinated moves like "underwater squat jumps" are filtered and replaced directly—users never see them.
- Model division of labor: Intent extraction uses a cheap small model (about 0.8 yuan per thousand calls), while plan generation uses a powerful model. With hybrid scheduling, the total cost per generation is driven down to about 0.11 yuan, compared to roughly 8-10 yuan per plan when done by humans.
Key Implementation Steps
Step 1: Turn requirements into machine-readable constraints (Week 1)
Define the input schema: height and weight, training experience, training days per week, equipment conditions, injury tags, goals (muscle gain / fat loss / conditioning). Injury tags are the top priority—they go directly into hard constraint rules, with no reliance on model judgment.
Step 2: Build the prompt and output schema (Weeks 1-2)
The core structure of the plan generation prompt:
System role: You are a strength and conditioning coach. Based on the
structured input below, generate an 8-week progressive training plan.
Input constraints:
{structured_input}
Hard rules:
1. All exercises must be selected from the exercise library below: {exercise whitelist summary}
2. For body parts with injury tags, related exercises are forbidden
3. Weekly training volume increases by no more than 10%
Output requirements: Strictly follow the JSON Schema, including
week/days/exercises/sets/reps/rest/notes fieldsStep 3: Post-generation validation pipeline (Weeks 2-3)
Process checklist:
- [ ] JSON parsing fails → automatic retry once (retry rate about 2%)
- [ ] Fuzzy-match exercise names against the exercise library (edit distance + vector similarity)
- [ ] Validate injury contraindication conflicts; replace conflicting exercises with safe alternatives
- [ ] Validate that training volume is within reasonable ranges (sets, RPE)
- [ ] Pass → persist to database and attach a natural-language "plan explanation"
- [ ] Fail → log the sample, and trace back to fix the prompt or rules
Step 4: Feedback loop (ongoing)
Users can request "swap this one" for any individual exercise, and each replacement is accumulated as fine-tuning data. Three months after launch, the direct replacement rate dropped from 18% initially to 7%.
Efficiency Comparison Ledger
| Metric | Before (templates + manual) | After (AI pipeline) |
|---|---|---|
| Time to generate one plan | 24-48 hours | ~90 seconds |
| Cost per plan | 8-10 yuan | 0.11 yuan |
| Coach headcount | 4-5 people | 1 person for spot checks |
| Paid conversion rate | <4% | Increased to ~11% |
One-time development investment: 3 people × 4 weeks, about 120,000 yuan. At the then-current rate of 500 plans per day, the investment paid for itself in a little over two months. More importantly, the 48-hour manual response delay used to directly turn away impulse-paying users; after compressing it to 90 seconds, "fill out the questionnaire and see your plan instantly" became the most effective step in the conversion funnel.
Why a Unified AI API Gateway Reduces Maintenance Costs
Once this architecture was up and running, Lao Chen's team quickly ran into new maintenance problems: the small model used Vendor A's SDK, the large model used Vendor B's SDK, and authentication, retries, and billing formats were all different. At one point, they wanted to switch to a cheaper extraction model, and just modifying the adapter code took two days—while also introducing a retry logic bug along the way.
Later, they consolidated everything onto an AI API gateway, and the changes in maintenance costs showed up in three places:
- One SDK for all models: Switching models went from "two days of code changes" to "changing one model name parameter," verified in ten minutes. They've since switched extraction models twice to cut costs, with zero code changes.
- Unified retries, rate limiting, and fallback: No need to write these separately at every call site. If the generation layer times out, it automatically falls back to a backup model—completely invisible to users.
- Unified billing and monitoring: With 30,000 daily active users making tens of thousands of calls per day, usage by model and by endpoint is clear at a glance. Cost accounting went from "checking several backends at month's end and stitching together spreadsheets" to viewing a single report, saving about a day of reconciliation time each month.
For a small team, the essence of this kind of gateway is turning "model integration"—a repetitive and error-prone task—into a configuration problem rather than an engineering problem. When you're short-staffed, you should spend your engineering effort on the things that truly differentiate you, like the validation pipeline and prompts.
Conclusion
The essence of personalized training plans is translating "a coach's expert judgment" into "constraints + generation capability." Fitness, nutrition, rehabilitation, travel planning... any scenario with "structured input + expert-style output" can reuse this four-layer pipeline. If you're planning to start integrating models, try a unified AI API gateway—register and get started, and you can have your first request running in just a few minutes: https://api.thistoken.ai/register
---
Ready to try it yourself? Sign up at https://api.thistoken.ai/register to get your API key and start building.
Хотите попробовать Token.AI?
Создайте API Key уровня проекта, включите каналы в консоли и настройте маршрутизацию, бюджеты и журналы аудита.
注册 ThisToken.AI 并获取 API Key