Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Links to the documentation for using the nutrition ai sdk
Included in your Nutrition Hub products is the mobile application SDK. Simply follow the setup guide for the target operating system, and use your Nutrition Hub api key as its configuration.
Food search, nutrient details, voice or image meal logging, etc.
The documentation for the API guide is linked below.
*Note that you can ignore the authorization section of the linked documentation. Your token from Nutrition Hub Authorization will work.
Nutrition Hub allows access to all nutrition-related services on a credit-usage basis
Nutrition Hub is a comprehensive platform providing access to a wide range of nutritional data and services. With our industry-leading food recognition and nutrition tracking SDK, your team can effortlessly integrate real-time, on-device food recognition and hands-free food tracking functionality into mobile applications.
Below is a quick overview of the key capabilities enabled by our Nutrition-AI technology.
With a single API key, you gain access to multiple powerful APIs, including:
Food Database API: Detailed nutritional information for thousands of food items.
Nutrition Advisor API: AI-driven personalized nutrition advice.
Vision AI API: Image recognition for analyzing food items and extracting nutritional data.
Text AI API: text-based ai suggestions, meal log assist tools, recipe builder, similar item suggestions etc, tailored to a users profile
Credit-Based Usage
Nutrition Hub uses a credit-based system, where each API call consumes a specific number of tokens. Your subscription includes a certain number of tokens, allowing you to use the services as needed.
Explore the documentation to learn more about how to integrate and make the most out of Nutrition Hub's features.
How to obtain your access token to authenticate your api calls
To use the Nutrition Hub APIs, you need to obtain a Bearer Token using your API key. Follow the steps below to authorize your API requests.
Obtain Bearer Token
Endpoint: POST
https://api.passiolife.com/v2/token-cache/unified/oauth/token/<YourKeyHere>
Path Parameters:
key
: Your API or license key provided in your product dashboard.
Response Schema:
access_token
(string): The Bearer Token you will use to authorize your API requests.
expires_in
(number): Token expiration time in seconds.
scope
(string): The scope of the token.
token_type
(string): The type of the token, typically "Bearer".
Example Request:
POST
https://api.passiolife.com/v2/token-cache/unified/oauth/token/<YourKeyHere>
Example Response:
jsonCopy code{
"access_token": "your_access_token_here",
"expires_in": 3600,
"scope": "read write",
"token_type": "Bearer"
}
Using the Bearer Token
Include the access_token
in the Authorization header for all your API requests. The only required header is the Authorization
header with the Bearer token.
Example Authorization Header:
Authorization: Bearer your_access_token_here
How tokens are used in API calls, and how to track their usage
The API operates on a credit usage basis. Your subscription includes X million tokens. Each API call consumes tokens.
API Request:
Vision AI Request:
Text AI Request:
Chat Message Request:
X-Budget-Cap
: 12,000,000 (total tokens available in the current period)
X-Period-Usage
: 494,188 (tokens used in the current period)
X-Request-Usage
: 634 (tokens used by the current request)
Monitor these headers to track your API usage and avoid exceeding your token limit.
You can also see your total usage in your accounts portal dashboard for this product. This will display usage, % used and free, etc.
The dashboard also contains a section to show your usage in a few different breakdowns. It allows you to see number (total)
and token usage (total)
for requests of certain types (ai chat, api call, vision ai tools, etc) or by the API path that made the request (grouped after a certain level of path-specificity).
The documentation for using the nutrition advisor ai, and other related tools
The documentation for the advisor API guide is linked below.
*Note that you can ignore the authorization section of the linked documentation. Your token from will work.
a page dedicated to information on using the Meal Plan Generation routes
Flexible input: Accepts free-form text, structured JSON (stringified), or both.
Macro flexibility: You may provide specific macro targets, or the API can calculate reasonable targets based on user profile data.
Intelligent memory: Optionally include a list of previous meal names to avoid or prioritize.
Two-step process: Use the fast preview endpoint to iterate quickly, then promote an approved preview into a fully calculated meal plan.
All requests must include a valid Bearer token in the Authorization
header.
Refer to the Authorization Token Guide for how to obtain and manage your tokens.
POST /v2/products/sdk/tools/generateMealPlan
Input
{
"content": "Generate a 3 day meal plan with high protein and optimized for muscle gain for a 33 year old average to athletic male"
}
content
may contain natural language, structured data, or both. Include as much detail as you can.
Optionally include previous meal log info (names, preferences, etc).
Optional Query Params
model
: the model used to generate meal ideas (default recommended model)
model2
: the model used to refine and finalize individual days
Note: Using
gemini-2-5-pro
for both will improve results but increase cost.
Example: Python
import requests
import json
url = "https://api.passiolife.com/v2/products/sdk/tools/generateMealPlan"
payload = json.dumps({
"content": "Generate a 3 day meal plan with high protein and optimized for muscle gain for a 33 year old average to athletic male"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_TOKEN_HERE'
}
response = requests.post(url, headers=headers, data=payload)
print(response.text)
As with all our API endpoints - if you have any further instructions or prompts you want to add as a system, you are free to add these in plain-language at the start, or and of your users input (preferably at the start). This can help guide us to tailore what we produce to your needs.
POST /v2/products/sdk/tools/generateMealPlanPreview
A faster endpoint (4–20 seconds typical) that returns only the daily meal names and a rejected: false
status. Useful for user-driven feedback loops.
Sample Output
[
{
"day": 1,
"meals": [
{"mealName": "Protein Pancakes", "rejected": false},
{"mealName": "Tuna Wrap", "rejected": false},
{"mealName": "Chicken Stir Fry", "rejected": false}
]
},
...
]
Users can reject individual meals (rejected: true
) and resend the updated JSON to the same endpoint to regenerate only those items.
Once the preview is approved, send the entire preview JSON to the full generation endpoint to receive a fully calculated version.
Example: Python
import requests
import json
url = "https://api.passiolife.com/v2/products/sdk/tools/generateMealPlanPreveiw"
payload = json.dumps({
"content": "Generate a 3 day meal plan with high protein and optimized for muscle gain for a 33 year old average to athletic male"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_TOKEN_HERE'
}
response = requests.post(url, headers=headers, data=payload)
print(response.text)
Average generation time (full): 1.5–6 minutes, depending on prompt complexity and model
Average preview time: 4–20 seconds
You can prepend instructions (e.g., internal app logic or strict constraints) to the user prompt if needed — these will be incorporated into processing
Be specific about goals, diet types, allergies, meal preferences, and number of days
Include known liked/disliked recipes
Use preview route to rapidly iterate with users
Upgrade to advanced models only when necessary