<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mohit Bisht</title>
    <description>The latest articles on DEV Community by Mohit Bisht (@mohitb_twt).</description>
    <link>https://dev.to/mohitb_twt</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1116431%2F1c779b8e-63c4-46c4-b715-7300cd5e958d.png</url>
      <title>DEV Community: Mohit Bisht</title>
      <link>https://dev.to/mohitb_twt</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mohitb_twt"/>
    <language>en</language>
    <item>
      <title>FoodFacts API - AI-Powered Nutrition &amp; Recipe REST API</title>
      <dc:creator>Mohit Bisht</dc:creator>
      <pubDate>Mon, 15 Dec 2025 06:36:41 +0000</pubDate>
      <link>https://dev.to/mohitb_twt/foodfacts-api-ai-powered-nutrition-recipe-rest-api-4o77</link>
      <guid>https://dev.to/mohitb_twt/foodfacts-api-ai-powered-nutrition-recipe-rest-api-4o77</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/xano-2025-11-20"&gt;Xano AI-Powered Backend Challenge&lt;/a&gt;: Production-Ready Public API&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;FoodFacts API is a &lt;strong&gt;production-ready public REST API&lt;/strong&gt; that provides nutrition, meal, and food data powered by AI. It returns structured results that apps can rely on.&lt;/p&gt;

&lt;p&gt;Developers can use the API to analyze food, estimate calories and macronutrients, generate diet plans, and create recipes from natural language input. The API is &lt;strong&gt;stateless&lt;/strong&gt; and built for real-world use in fitness apps, diet planners, recipe platforms, and health dashboards.&lt;/p&gt;

&lt;p&gt;FoodFacts API combines AI reasoning with &lt;strong&gt;strict JSON schemas&lt;/strong&gt; to ensure responses stay predictable and easy to parse.&lt;/p&gt;

&lt;h2&gt;
  
  
  Architecture Diagram
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2usxxw3ye2cd7fl8ahfw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2usxxw3ye2cd7fl8ahfw.png" alt=" " width="800" height="466"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What Data Services Does FoodFacts API Provide?
&lt;/h3&gt;

&lt;p&gt;FoodFacts API supports these services:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Food nutrition data such as calories, protein, carbs, and fats&lt;/li&gt;
&lt;li&gt;Meal-level macro estimates from free-text descriptions&lt;/li&gt;
&lt;li&gt;Ingredient-based nutrition analysis&lt;/li&gt;
&lt;li&gt;Goal-based diet plan generation&lt;/li&gt;
&lt;li&gt;Recipe generation from available ingredients&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All responses return &lt;strong&gt;clean, structured JSON&lt;/strong&gt; designed for direct use in web and mobile apps.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Features
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Food Nutrition Search&lt;/strong&gt;&lt;br&gt;
Developers can search nutrition data for common foods. This supports calorie tracking and food databases without extra setup.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Meal and Ingredient Analysis&lt;/strong&gt;&lt;br&gt;
The API estimates nutrition from:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A list of ingredients&lt;/li&gt;
&lt;li&gt;A natural language meal description&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This removes the need to maintain large food databases.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AI-Generated Diet Plans&lt;/strong&gt;&lt;br&gt;
Based on user goals such as weight loss or muscle gain, the API generates multi-day plans that include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Daily meals&lt;/li&gt;
&lt;li&gt;Estimated calories&lt;/li&gt;
&lt;li&gt;Grocery lists&lt;/li&gt;
&lt;li&gt;Health tips&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Recipe Generation&lt;/strong&gt;&lt;br&gt;
Given a list of ingredients, the API returns:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Recipe ideas&lt;/li&gt;
&lt;li&gt;Preparation steps&lt;/li&gt;
&lt;li&gt;Estimated nutrition&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Consistent JSON Responses&lt;/strong&gt;&lt;br&gt;
All endpoints enforce &lt;strong&gt;strict JSON schemas&lt;/strong&gt;. The API avoids unstructured AI output so responses stay safe and predictable.&lt;/p&gt;
&lt;h3&gt;
  
  
  Who Is This API For?
&lt;/h3&gt;

&lt;p&gt;FoodFacts API fits teams building:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fitness and calorie-tracking apps&lt;/li&gt;
&lt;li&gt;Diet and wellness platforms&lt;/li&gt;
&lt;li&gt;Recipe and meal-planning tools&lt;/li&gt;
&lt;li&gt;Health-focused SaaS products&lt;/li&gt;
&lt;li&gt;AI-powered food features&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  API Documentation
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Base URLs
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Authentication Group URL:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://x95f-42hw-risi.m2.xano.io/api:QC35j52Y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;FoodFacts API Group URL:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://x95f-42hw-risi.m2.xano.io/api:GZXOANAS
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Base URL:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://x95f-42hw-risi.m2.xano.io/api
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Authentication Strategy
&lt;/h3&gt;

&lt;p&gt;FoodFacts API uses a &lt;strong&gt;hybrid authentication model&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Public endpoints&lt;/strong&gt; allow anonymous access for testing and basic use. These include: &lt;code&gt;foods/search&lt;/code&gt;, &lt;code&gt;nutrition/estimate&lt;/code&gt; &amp;amp; &lt;code&gt;nutrition/ingredients&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Protected endpoints&lt;/strong&gt; require Bearer tokens. These include: &lt;code&gt;diet/plan&lt;/code&gt;, &lt;code&gt;recipes/from-ingredients&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This approach keeps onboarding simple while protecting AI-heavy operations.&lt;/p&gt;

&lt;h3&gt;
  
  
  Rate Limiting
&lt;/h3&gt;

&lt;p&gt;To protect reliability and cost, we apply rate limiting to prevent abuse and stay within Gemini API limits (15 RPM for Flash).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ratelimit&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;recipes_fromingr_limit:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;~&lt;/span&gt; &lt;span class="nx"&gt;$auth&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;
  &lt;span class="nx"&gt;max&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;15&lt;/span&gt;
  &lt;span class="nx"&gt;ttl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt;
  &lt;span class="nx"&gt;error&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Too many requests. Please try again in a minute.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  API Endpoints
&lt;/h3&gt;

&lt;h4&gt;
  
  
  &lt;code&gt;/nutrition/ingredients&lt;/code&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Purpose:&lt;/strong&gt; Analyze ingredients and return total calories &amp;amp; macros&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Method:&lt;/strong&gt; POST&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Input:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"ingredients"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"1 medium banana"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"2 tbsp peanut butter"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we send a simple list of ingredients with quantities, and the API returns total calories, protein, carbs, and fats.&lt;/p&gt;




&lt;h4&gt;
  
  
  &lt;code&gt;/foods/search&lt;/code&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Purpose:&lt;/strong&gt; Search nutrition data for a food item&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Method:&lt;/strong&gt; GET&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Input:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/foods/search?query=apple
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This endpoint lets developers search for standardized nutrition data for a food item, normalized.&lt;/p&gt;




&lt;h4&gt;
  
  
  &lt;code&gt;/nutrition/estimate&lt;/code&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Purpose:&lt;/strong&gt; Estimate calories &amp;amp; macros from free-text&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Method:&lt;/strong&gt; POST&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Input:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"meal_description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2 slices of pizza and a glass of coke"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Even when exact ingredients aren't known, developers can send a natural language description and get an estimated nutritional breakdown.&lt;/p&gt;




&lt;h4&gt;
  
  
  &lt;code&gt;/diet/plan&lt;/code&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Purpose:&lt;/strong&gt; Generate a multi-day diet plan&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Method:&lt;/strong&gt; POST&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Authentication:&lt;/strong&gt; Required&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Input:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"goal"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"weight loss"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"days"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"diet_type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"vegetarian"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Based on the user's goal and preferences, the API generates a complete multi-day diet plan.&lt;/p&gt;




&lt;h4&gt;
  
  
  &lt;code&gt;/recipes/from-ingredients&lt;/code&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Purpose:&lt;/strong&gt; Generate recipes from available ingredients&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Method:&lt;/strong&gt; POST&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Authentication:&lt;/strong&gt; Required&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Input:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"ingredients"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"chicken"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"rice"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"onion"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Developers can send a simple list of ingredients, and the API returns complete recipes with steps and nutrition.&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;&lt;a href="//youtu.be/VYI_Y2RnmJU?si=VGvZNxxbwX4Yb0Z4"&gt;Video Link&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Using Public Endpoints
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;1. Food Search&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-X&lt;/span&gt; GET &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="s2"&gt;"https://x95f-42hw-risi.m2.xano.io/api:GZXOANAS/foods/search?query=banana"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Nutrition Estimate&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="s1"&gt;'https://x95f-42hw-risi.m2.xano.io/api:GZXOANAS/nutrition/estimate'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s1"&gt;'Content-Type: application/json'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--data&lt;/span&gt; &lt;span class="s1"&gt;'{"meal_description":"Grilled chicken breast with brown rice and steamed broccoli"}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Ingredient Analysis&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST &lt;span class="se"&gt;\&lt;/span&gt;
  https://x95f-42hw-risi.m2.xano.io/api:GZXOANAS/nutrition/ingredients &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{
    "ingredients": [
      "1 medium banana",
      "2 tbsp peanut butter"
    ]
  }'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Using Protected Endpoints
&lt;/h3&gt;

&lt;p&gt;To use protected endpoints, you first need to create an AUTH Token using &lt;code&gt;auth/signup&lt;/code&gt; &amp;amp; &lt;code&gt;auth/login&lt;/code&gt; endpoints.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Sign Up&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST https://x95f-42hw-risi.m2.xano.io/api:QC35j52Y/auth/signup &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{
    "email": "test1@gg.com",
    "name": "Test",
    "password": "testpassword"
  }'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2: Login&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST https://x95f-42hw-risi.m2.xano.io/api:QC35j52Y/auth/login &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{
    "email": "test1@gg.com",
    "password": "testpassword"
  }'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Copy the &lt;code&gt;"authToken"&lt;/code&gt; from the login response and use it in the following requests.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Diet Plan Generation&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST &lt;span class="se"&gt;\&lt;/span&gt;
  https://x95f-42hw-risi.m2.xano.io/api:GZXOANAS/diet/plan &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Authorization: Bearer YOUR_AUTH_TOKEN"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{
    "goal": "weight_loss",
    "days": 30
  }'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;4. Recipe Generation&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST &lt;span class="se"&gt;\&lt;/span&gt;
  https://x95f-42hw-risi.m2.xano.io/api:GZXOANAS/recipes/from-ingredients &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Authorization: Bearer YOUR_AUTH_TOKEN"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{
    "ingredients": [
      "tomato",
      "cheese",
      "bread"
    ]
  }'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The AI Prompt I Used
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Build a production-ready public REST API called "FoodFacts API".

This is a backend-only service (no UI) designed for third-party developers
building fitness, health, diet, and food applications.

The API must return structured JSON only and be ready for real-world usage.

Core features and endpoints:

1. POST /nutrition/ingredients  
Input: { ingredients: [string] }  
Behavior:
- Accept a list of ingredients such as "2 eggs", "1 cup milk"
- Use AI to estimate nutrition
- Return total calories, protein, carbs, fats
- Include a per-ingredient breakdown

2. GET /foods/search?query=  
Behavior:
- Search a food item by name
- Return nutrition facts per serving and per 100g
- Include category and portion information

3. POST /nutrition/estimate  
Input: { meal_description: string }  
Behavior:
- Accept a natural language meal description
- Estimate total calories, protein, carbs, and fats

4. POST /diet/plan  
Input: { goal: string, days: number }  
Behavior:
- Generate a day-wise AI-powered diet plan
- Include meals per day
- Include daily calorie targets
- Provide a grocery list and health tips

5. POST /recipes/from-ingredients  
Input: { ingredients: [string] }  
Behavior:
- Generate 3–5 recipes using the provided ingredients
- Include steps and estimated nutrition for each recipe

Technical requirements:
- Use API-first design
- Structured JSON responses only
- Clear request and response schemas
- Error handling for invalid input
- Ready for API key authentication and rate limiting
- No frontend or UI logic

This API should demonstrate best practices for a consumable public API
built with Xano and AI-powered external requests.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  AI-Generated Database Schema
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa4j1j8h4usqheoi1ups9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa4j1j8h4usqheoi1ups9.png" alt=" " width="800" height="370"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjm8v79aa9btb5t3np6h4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjm8v79aa9btb5t3np6h4.png" alt=" " width="800" height="224"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How I Refined the AI-Generated Code
&lt;/h2&gt;

&lt;h3&gt;
  
  
  ⚙️ Challenge 1: Auto-Generated CRUD Endpoints
&lt;/h3&gt;

&lt;p&gt;The platform automatically created ~20 CRUD-style API endpoints based on the prompt. These endpoints followed a standard pattern:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;One or two function blocks per endpoint&lt;/li&gt;
&lt;li&gt;Basic create/read/update/delete logic&lt;/li&gt;
&lt;li&gt;No business rules, validations, or AI orchestration&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Instead of that, we manually designed and implemented the core APIs that actually power the product.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For example&lt;/strong&gt;, it created an endpoint called &lt;code&gt;diet_plan&lt;/code&gt;, which looked like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Query all diet_plan records&lt;/span&gt;
&lt;span class="nx"&gt;query&lt;/span&gt; &lt;span class="nx"&gt;diet_plan&lt;/span&gt; &lt;span class="nx"&gt;verb&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;GET&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;api_group&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;FoodFacts API Group&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;

  &lt;span class="nx"&gt;input&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;stack&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;query&lt;/span&gt; &lt;span class="nx"&gt;diet_plan&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;list&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;$diet_plan&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;$diet_plan&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Good part&lt;/strong&gt; 😄: Later we used the &lt;code&gt;Logic Assistant&lt;/code&gt; to create multiple endpoints by describing the intent of each API in natural language. The assistant generated accurate function blocks such as input validation, conditional logic, external API requests, and response handling.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The PROMPT we used with Logic Assistant looked like this:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;You are building logic for a public API endpoint: POST /nutrition/ingredients.

Goal:
Analyze a list of food ingredients and return estimated nutrition using AI.

Input:
- ingredients: array of strings (required)
Example: ["2 eggs", "1 cup milk", "1 banana"]

Logic requirements:
1. Validate input:
- ingredients must be an array
- array must not be empty
- return a clear JSON error if invalid

2. Build an AI prompt that asks the model to:
- Estimate calories, protein, carbs, and fats for each ingredient
- Calculate total calories, protein, carbs, and fats
- Return JSON only (no explanations, no markdown)

Expected AI response format:
{
  "total_calories": number,
  "total_protein": number,
  "total_carbs": number,
  "total_fats": number,
  "breakdown": [
    {
      "item": string,
      "calories": number,
      "protein": number,
      "carbs": number,
      "fats": number
    }
  ]
}

3. Use an external API request to call an AI model 
(Google Gemini 1.5 Flash or equivalent) to generate nutrition estimates.

4. Parse and validate the AI JSON response.
- If parsing fails, return a graceful error message.

5. Return a clean JSON response with:
- total calories
- total protein
- total carbs
- total fats
- per-ingredient breakdown

Additional constraints:
- No database writes required
- Stateless request
- JSON responses only
- Production-ready error handling
- Optimized for a public, API-key protected endpoint
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The output Logic Assistant generated was this:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Estimates nutrition facts for a list of ingredients using AI.&lt;/span&gt;
&lt;span class="nx"&gt;query&lt;/span&gt; &lt;span class="nx"&gt;estimate_nutrition&lt;/span&gt; &lt;span class="nx"&gt;verb&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;POST&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;api_group&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;FoodFacts API Group&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;

  &lt;span class="nx"&gt;input&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// List of ingredients to analyze (e.g., "1 cup rice", "100g chicken")&lt;/span&gt;
    &lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="nx"&gt;ingredients&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;stack&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Validate that the ingredients array is not empty&lt;/span&gt;
    &lt;span class="nf"&gt;precondition &lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;$input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ingredients&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;error_type&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;inputerror&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
      &lt;span class="nx"&gt;error&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Ingredients list cannot be empty.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// Construct the AI prompt&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;$prompt&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
        &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Estimate the nutrition facts for these ingredients: &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="o"&gt;~&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;$input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ingredients&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nx"&gt;join&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;, &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="o"&gt;~&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;. Return strictly a JSON object with keys: &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="o"&gt;~&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;total_calories (int), total_protein_g (decimal), &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="o"&gt;~&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;total_carbs_g (decimal), total_fats_g (decimal), &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="o"&gt;~&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;and ingredients (array of objects with name, calories, &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="o"&gt;~&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;protein_g, carbs_g, fats_g). &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="o"&gt;~&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Do not use markdown formatting.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// Call Google Gemini API&lt;/span&gt;
    &lt;span class="nx"&gt;api&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;request&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
        &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://generativelanguage.googleapis.com/v1beta/models/&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="o"&gt;~&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;gemini-2.5-flash:generateContent?key=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="o"&gt;~&lt;/span&gt; &lt;span class="nx"&gt;$env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;GEMINI_API_KEY&lt;/span&gt;
      &lt;span class="nx"&gt;method&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;POST&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
      &lt;span class="nx"&gt;params&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;contents&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
          &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="na"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
              &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;$prompt&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="p"&gt;]&lt;/span&gt;
          &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;]&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="nx"&gt;headers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nx"&gt;push&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Content-Type: application/json&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;$ai_response&lt;/span&gt;

    &lt;span class="c1"&gt;// Parse the response&lt;/span&gt;
    &lt;span class="nx"&gt;try_catch&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;$raw_content&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
            &lt;span class="nx"&gt;$ai_response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;candidates&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
              &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;content&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="c1"&gt;// Clean potential markdown formatting just in case&lt;/span&gt;
        &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;$clean_content&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
            &lt;span class="nx"&gt;$raw_content&lt;/span&gt;
              &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="na"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;```

json&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;
              &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="na"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;

```&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;
              &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nx"&gt;trim&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;$nutrition_data&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;$clean_content&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nx"&gt;json_decode&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;

      &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;inputerror&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Unable to process nutrition data from AI response.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;$nutrition_data&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  ⚙️ Challenge 2: Schema Inconsistencies
&lt;/h3&gt;

&lt;p&gt;The above XanoScript had some issues:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;The prompt explicitly referenced the endpoint name &lt;code&gt;nutrition/ingredients&lt;/code&gt;, but the logic assistant named it &lt;code&gt;estimate_nutrition&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The output schema AI generated was (this was the biggest difference):&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;total_calories (int)
total_protein_g (decimal)
total_carbs_g (decimal)
total_fats_g (decimal)
ingredients: [
  { name, calories, protein_g, carbs_g, fats_g }
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, it should have been the following, as stated in the prompt schema:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;total_calories (number)
total_protein (number)
total_carbs (number)
total_fats (number)
breakdown: [
  { item, calories, protein, carbs, fats }
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The refined XanoScript we used:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Estimates nutritional information for a list of ingredients using AI.&lt;/span&gt;
&lt;span class="nx"&gt;query&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;nutrition/ingredients&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;verb&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;POST&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;api_group&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;FoodFacts API Group&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;

  &lt;span class="nx"&gt;input&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// List of ingredients to analyze (e.g., ["1 cup rice", "100g chicken"])&lt;/span&gt;
    &lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="nx"&gt;ingredients&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;stack&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Validate that the input array is not empty&lt;/span&gt;
    &lt;span class="nf"&gt;precondition &lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;$input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ingredients&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;error_type&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;inputerror&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
      &lt;span class="nx"&gt;error&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;The ingredients list cannot be empty.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// Construct the prompt for the AI model&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;$prompt&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
        &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Analyze the following ingredients: &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="o"&gt;~&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;$input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ingredients&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nx"&gt;join&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;, &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="o"&gt;~&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;. Provide a nutritional estimation. &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="o"&gt;~&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Return ONLY a raw JSON object (no markdown formatting, no code blocks) &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="o"&gt;~&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;adhering strictly to this schema: &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="o"&gt;~&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;{ &lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;total_calories&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;: number, &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="o"&gt;~&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;total_protein&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;: number, &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="o"&gt;~&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;total_carbs&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;: number, &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="o"&gt;~&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;total_fats&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;: number, &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="o"&gt;~&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;breakdown&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;: [ &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="o"&gt;~&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;{ &lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;item&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;: string, &lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;calories&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;: number, &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="o"&gt;~&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;protein&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;: number, &lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;carbs&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;: number, &lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;fats&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;: number } &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="o"&gt;~&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;] }. &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="o"&gt;~&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Ensure all numeric values are returned as numbers, not strings.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// Call Google Gemini 2.5 Flash API&lt;/span&gt;
    &lt;span class="nx"&gt;api&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;request&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
        &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://generativelanguage.googleapis.com/v1beta/models/&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="o"&gt;~&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;gemini-2.5-flash:generateContent?key=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="o"&gt;~&lt;/span&gt; &lt;span class="nx"&gt;$env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;GEMINI_API_KEY&lt;/span&gt;
      &lt;span class="nx"&gt;method&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;POST&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
      &lt;span class="nx"&gt;params&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;contents&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
          &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="na"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
              &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;$prompt&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="p"&gt;]&lt;/span&gt;
          &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;]&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="nx"&gt;headers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nx"&gt;push&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Content-Type: application/json&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;$gemini_response&lt;/span&gt;

    &lt;span class="c1"&gt;// Extract the raw text from the response&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;$raw_content&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
        &lt;span class="nx"&gt;$gemini_response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;
          &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;candidates&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;content&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// Clean the response text by removing markdown artifacts if present&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;$cleaned_content&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
        &lt;span class="nx"&gt;$raw_content&lt;/span&gt;
          &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nx"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;```

json&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;
          &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nx"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;

```&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;
          &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nx"&gt;trim&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// Attempt to parse the cleaned text into a JSON object&lt;/span&gt;
    &lt;span class="nx"&gt;try_catch&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;$nutrition_data&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;$cleaned_content&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nx"&gt;json_decode&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;

      &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;ParsingError&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Failed to parse AI response into valid JSON. Raw response: &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
            &lt;span class="o"&gt;~&lt;/span&gt; &lt;span class="nx"&gt;$cleaned_content&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;$nutrition_data&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Similarly, we made improvements to other endpoints as well.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  ⚙️ Challenge 3: API Rate Limiting
&lt;/h3&gt;

&lt;p&gt;One of the main challenges we faced was working within the API limits of Gemini 2.5 Flash. Since multiple endpoints depend on AI-generated responses, we had to be careful about how often requests were made and ensure that rate limiting was applied consistently. This required us to design our endpoints defensively, validate inputs early, and avoid unnecessary AI calls. Handling structured JSON responses reliably from the AI model also required iterative prompt refinement to keep outputs predictable for a production API.&lt;/p&gt;

&lt;h3&gt;
  
  
  ⚙️ Challenge 4: Exploring Xano Actions
&lt;/h3&gt;

&lt;p&gt;We also explored using &lt;code&gt;Xano Actions&lt;/code&gt; to abstract shared logic such as validation and response normalization. While the concept is powerful, we found that integrating Actions into existing endpoints required careful understanding of how data flows between Actions and API stacks. Although Xano provides resources and videos around Actions, we realized that for this project, keeping the logic directly inside endpoints allowed us to move faster and maintain clarity. This exploration was still valuable, as it helped us better understand when Actions are most appropriate in real-world backends.&lt;/p&gt;

&lt;h2&gt;
  
  
  My Experience with Xano
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What Helped Most When Using Xano
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Visual logic builder&lt;/strong&gt; for clear and debuggable flows&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Built-in debugger&lt;/strong&gt; for inspecting live requests and responses&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Simple external API integration&lt;/strong&gt; with secure key storage&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Built-in authentication and rate limiting&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Structured error handling&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fast iteration&lt;/strong&gt; from idea to stable API&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The Logic Assistant was particularly valuable for rapidly prototyping endpoint logic. While it didn't always produce perfect code on the first try, it significantly reduced development time by generating a solid foundation that we could refine.&lt;/p&gt;

&lt;p&gt;The visual nature of Xano's function stack builder made it easy to understand data flow and debug issues. Combined with the built-in request debugger, we could quickly identify and fix problems in our API logic.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Team Submission:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;dev.to/mohitb_twt - &lt;a href="mailto:mail.mohitbisht@gmail.com"&gt;mail.mohitbisht@gmail.com&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;dev.to/deebi9 - &lt;a href="mailto:deepanshudb1@gmail.com"&gt;deepanshudb1@gmail.com&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>devchallenge</category>
      <category>xanochallenge</category>
      <category>api</category>
      <category>backend</category>
    </item>
    <item>
      <title>Cloudflare Went Down - Here's What Really Happened Today</title>
      <dc:creator>Mohit Bisht</dc:creator>
      <pubDate>Tue, 18 Nov 2025 18:30:25 +0000</pubDate>
      <link>https://dev.to/mohitb_twt/cloudflare-went-down-heres-what-really-happened-today-54dg</link>
      <guid>https://dev.to/mohitb_twt/cloudflare-went-down-heres-what-really-happened-today-54dg</guid>
      <description>&lt;p&gt;Today wasn’t normal for the internet.&lt;/p&gt;

&lt;p&gt;One moment everything was fine.&lt;br&gt;
Next moment, half the apps we use daily stopped working.&lt;/p&gt;

&lt;p&gt;ChatGPT wasn’t loading.&lt;br&gt;
X (Twitter) threw errors.&lt;br&gt;
Udemy, Canva, all struggling.&lt;/p&gt;

&lt;p&gt;If your apps felt broken, the problem wasn’t with your WiFi.&lt;br&gt;
It was Cloudflare.&lt;/p&gt;

&lt;p&gt;And when Cloudflare goes down, the internet feels it everywhere.&lt;/p&gt;

&lt;p&gt;I checked updates from Reuters, major news outlets, and Cloudflare’s own status page.&lt;/p&gt;

&lt;p&gt;Here’s the simplest developer-friendly summary of what happened today.&lt;/p&gt;




&lt;h2&gt;
  
  
  Cloudflare sits between users and most websites
&lt;/h2&gt;

&lt;p&gt;When you open a website, your request usually goes to Cloudflare first.&lt;/p&gt;

&lt;p&gt;Companies use it for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CDN&lt;/li&gt;
&lt;li&gt;WAF&lt;/li&gt;
&lt;li&gt;DDoS protection&lt;/li&gt;
&lt;li&gt;Caching&lt;/li&gt;
&lt;li&gt;Routing&lt;/li&gt;
&lt;li&gt;API security&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So when Cloudflare slows down, every app behind it slows down too.&lt;/p&gt;




&lt;h2&gt;
  
  
  What actually went wrong today
&lt;/h2&gt;

&lt;p&gt;Cloudflare shared that one of their internal services received &lt;strong&gt;unexpected traffic&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Not from attackers.&lt;br&gt;
Not from unknown IPs.&lt;br&gt;
But from &lt;strong&gt;their own network&lt;/strong&gt;, just at a scale they didn’t expect.&lt;/p&gt;

&lt;p&gt;They didn’t name the service, but it was critical enough that once it got overloaded, other systems started failing.&lt;/p&gt;

&lt;p&gt;That’s why:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ChatGPT&lt;/li&gt;
&lt;li&gt;X&lt;/li&gt;
&lt;li&gt;Udemy&lt;/li&gt;
&lt;li&gt;Canva&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;all showed the same error:&lt;br&gt;
&lt;strong&gt;“We can’t reach the server right now.”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It wasn’t their fault.&lt;br&gt;
The layer beneath them was unhealthy.&lt;/p&gt;




&lt;h2&gt;
  
  
  This outage hit developers too
&lt;/h2&gt;

&lt;p&gt;A lot of CI/CD pipelines broke because dependency downloads failed.&lt;/p&gt;

&lt;p&gt;Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Java JAR downloads&lt;/li&gt;
&lt;li&gt;npm installs&lt;/li&gt;
&lt;li&gt;Docker image pulls&lt;/li&gt;
&lt;li&gt;API calls through Cloudflare&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Even if your app doesn’t use Cloudflare directly, some service &lt;em&gt;your tools depend on&lt;/em&gt; probably does.&lt;/p&gt;

&lt;p&gt;This is how interconnected the internet has become.&lt;/p&gt;




&lt;h2&gt;
  
  
  Cloudflare pushed a fix quickly
&lt;/h2&gt;

&lt;p&gt;Around &lt;strong&gt;14:42 UTC&lt;/strong&gt;, Cloudflare rolled out a fix.&lt;/p&gt;

&lt;p&gt;By &lt;strong&gt;14:57 UTC&lt;/strong&gt;, most services started coming back.&lt;/p&gt;

&lt;p&gt;Some people still saw small glitches afterward, but the worst was over quickly.&lt;/p&gt;

&lt;p&gt;Cloudflare will publish a full RCA soon, which will explain exactly what happened.&lt;/p&gt;

&lt;p&gt;I’ll write a follow-up post when that drops.&lt;/p&gt;




&lt;h2&gt;
  
  
  For developers, there’s a lesson in this
&lt;/h2&gt;

&lt;p&gt;Incidents like today remind us:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One dependency can break many systems&lt;/li&gt;
&lt;li&gt;Monitoring should cover &lt;em&gt;underlying infrastructure&lt;/em&gt;, not just your app&lt;/li&gt;
&lt;li&gt;Fallback paths matter&lt;/li&gt;
&lt;li&gt;External CI/CD dependencies can fail anytime&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The modern internet rests on a few critical layers and Cloudflare is one of the biggest.&lt;/p&gt;




&lt;h2&gt;
  
  
  What was your experience?
&lt;/h2&gt;

&lt;p&gt;Did your app break?&lt;br&gt;
Did your build pipeline fail?&lt;br&gt;
Did your users complain?&lt;/p&gt;

&lt;p&gt;Drop your experience below it’ll help others understand the impact.&lt;/p&gt;

&lt;p&gt;If you want calm, simple breakdowns of incidents like this, or stories about cloud, dev, and building real-world systems — you can follow me here.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>devops</category>
      <category>cloudflare</category>
    </item>
    <item>
      <title>🎮 Exploring Amazon Q CLI Building a Simple Tic-Tac-Toe Game</title>
      <dc:creator>Mohit Bisht</dc:creator>
      <pubDate>Tue, 10 Jun 2025 13:28:56 +0000</pubDate>
      <link>https://dev.to/mohitb_twt/exploring-amazon-q-cli-building-a-simple-tic-tac-toe-game-nid</link>
      <guid>https://dev.to/mohitb_twt/exploring-amazon-q-cli-building-a-simple-tic-tac-toe-game-nid</guid>
      <description>&lt;p&gt;Hello everyone!&lt;/p&gt;

&lt;p&gt;I recently participated in the &lt;strong&gt;#AmazonQCLIGameChallenge&lt;/strong&gt;, an exciting opportunity to build a game using the new &lt;strong&gt;Amazon Q CLI&lt;/strong&gt; – an AI-powered coding assistant from AWS. As someone who's always learning and exploring new tools, I decided to tackle a classic: a simple &lt;strong&gt;Tic-Tac-Toe&lt;/strong&gt; game using Q CLI and Python.&lt;/p&gt;

&lt;p&gt;In this blog post, I'll walk you through my experience using Amazon Q CLI to build the game, share my key learnings, and show you how you can try it out for yourself!&lt;/p&gt;

&lt;h2&gt;
  
  
  🧠 What is Amazon Q CLI? &lt;em&gt;Your AI-Powered Coding Partner&lt;/em&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Amazon Q CLI&lt;/strong&gt; is a groundbreaking AI-powered command-line tool from AWS. Imagine having a knowledgeable coding partner right in your terminal, available 24/7. That's exactly what Q CLI offers!&lt;/p&gt;

&lt;p&gt;It empowers you to write, debug, and explore code simply by chatting with it.&lt;/p&gt;

&lt;p&gt;You can ask Amazon Q CLI to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Generate code snippets&lt;/li&gt;
&lt;li&gt;Explain complex functions&lt;/li&gt;
&lt;li&gt;Identify and fix bugs&lt;/li&gt;
&lt;li&gt;Provide architectural insights&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It’s like having &lt;strong&gt;ChatGPT&lt;/strong&gt;, but seamlessly integrated into your terminal workflow.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://community.aws/amazonqcli" rel="noopener noreferrer"&gt;Learn more on the Official Amazon Q CLI Page&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  ⚙️ My Setup: Getting Started with Amazon Q CLI
&lt;/h2&gt;

&lt;p&gt;Here’s how I set up my environment to build the game:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Sign Up for an AWS Builder ID
&lt;/h3&gt;

&lt;p&gt;This is your gateway to accessing AWS services and tools.&lt;br&gt;
👉 &lt;a href="https://community.aws" rel="noopener noreferrer"&gt;Get Your AWS Builder ID Here&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  2. Install Amazon Q CLI
&lt;/h3&gt;
&lt;h4&gt;
  
  
  🔹 For Windows:
&lt;/h4&gt;

&lt;p&gt;👉 &lt;a href="https://community.aws/posts/installing-amazon-q-cli-on-windows" rel="noopener noreferrer"&gt;Amazon Q CLI Installation Guide for Windows&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  🔹 For Linux (Ubuntu):
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Update your machine and install libfuse2&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get update
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;libfuse2

&lt;span class="c"&gt;# Download and install Amazon Q CLI&lt;/span&gt;
curl &lt;span class="nt"&gt;--proto&lt;/span&gt; &lt;span class="s1"&gt;'=https'&lt;/span&gt; &lt;span class="nt"&gt;--tlsv1&lt;/span&gt;.2 &lt;span class="nt"&gt;-sSf&lt;/span&gt; https://desktop-release.q.us-east-1.amazonaws.com/latest/amazon-q.deb &lt;span class="nt"&gt;-o&lt;/span&gt; amazon-q.deb
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; ./amazon-q.deb

&lt;span class="c"&gt;# Login to Q CLI&lt;/span&gt;
q login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  3. Install Python
&lt;/h3&gt;

&lt;p&gt;Since I was building a &lt;strong&gt;terminal-based game&lt;/strong&gt;, Python was a great choice due to its simplicity and clean syntax.&lt;/p&gt;
&lt;h3&gt;
  
  
  4. Start Amazon Q CLI Chat
&lt;/h3&gt;

&lt;p&gt;Once everything was installed, I opened my terminal and ran:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;amazonq chat
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🎮 Building the Tic-Tac-Toe Game with Amazon Q CLI
&lt;/h2&gt;

&lt;p&gt;With the chat session open, I asked:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;"Create a Tic Tac Toe game in Python that allows two players to play turn by turn."&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdfld89frrwgsbbctwaed.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdfld89frrwgsbbctwaed.png" alt="amazonq chat" width="706" height="278"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To my surprise, &lt;strong&gt;Amazon Q CLI&lt;/strong&gt; instantly gave me the full Python code. It also explained each part of the logic when I asked, making it easy to understand and customize.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnjbygoqrzl9978fx2jva.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnjbygoqrzl9978fx2jva.png" alt="Code" width="800" height="426"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Within minutes, I had a working version of the game, ready to play in the terminal. This helped me understand:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How to manage &lt;strong&gt;turn-based logic&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;How to store and check &lt;strong&gt;game state&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Simple Python tricks for cleaner CLI output&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🖼️ Game Screenshots
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7n4ew9un7rnh9do1dtmk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7n4ew9un7rnh9do1dtmk.png" alt="Game" width="626" height="641"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  ▶️ Demo Video
&lt;/h2&gt;

&lt;p&gt;Want to see it in action?&lt;/p&gt;

&lt;p&gt;🎥 &lt;a href="https://www.youtube.com/watch?v=uFgzl_i4thA" rel="noopener noreferrer"&gt;Watch the YouTube Demo&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  💻 Get the Code
&lt;/h2&gt;

&lt;p&gt;Feel free to check out the code and try it yourself:&lt;/p&gt;

&lt;p&gt;🔗 &lt;a href="https://github.com/Mohiit70/Tic-Tac-Toe" rel="noopener noreferrer"&gt;GitHub – Tic Tac Toe Game Using Amazon Q CLI&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  My Experience with Amazon Q CLI
&lt;/h2&gt;

&lt;p&gt;Amazon Q CLI turned a simple game idea into an engaging learning experience. It wasn’t just about generating code — it was about &lt;strong&gt;understanding the logic&lt;/strong&gt; and building confidence as a developer.&lt;/p&gt;

&lt;p&gt;Whether you’re just getting started or you’re looking to speed up your development process, I highly recommend giving &lt;strong&gt;Amazon Q CLI&lt;/strong&gt; a try. It's like having an intelligent teammate sitting right inside your terminal.&lt;/p&gt;

&lt;p&gt;Thanks for reading! If you enjoyed this post, give it a like, drop a comment, or share it with a fellow dev! 🚀&lt;/p&gt;

</description>
      <category>python</category>
      <category>game</category>
      <category>ai</category>
      <category>aws</category>
    </item>
    <item>
      <title>What The Pursuit of Happyness Taught Me About Solving Problems as a Developer</title>
      <dc:creator>Mohit Bisht</dc:creator>
      <pubDate>Thu, 20 Mar 2025 06:13:51 +0000</pubDate>
      <link>https://dev.to/mohitb_twt/what-the-pursuit-of-happyness-taught-me-about-solving-problems-as-a-developer-43ag</link>
      <guid>https://dev.to/mohitb_twt/what-the-pursuit-of-happyness-taught-me-about-solving-problems-as-a-developer-43ag</guid>
      <description>&lt;p&gt;As a developer and student, I'm constantly learning, failing, and figuring things out one problem at a time. Recently, I watched The Pursuit of Happyness again, and it hit differently this time.&lt;/p&gt;

&lt;p&gt;The hustle. The late nights. The mindset of "I may not know everything, but I know how to find the solution." It reminded me so much of the developer journey—especially when you're just starting out or working on big goals with limited resources.&lt;/p&gt;

&lt;p&gt;So I wanted to share a quick reflection — my favorite dialogue, key takeaways, and how this movie relates to life in tech. Maybe it'll resonate with you too.&lt;/p&gt;




&lt;h2&gt;
  
  
  🎬 Favorite Dialogue &amp;amp; Why
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;“Don’t ever let somebody tell you, you can’t do something. Not even me. You got a dream, you gotta protect it.”&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
— Chris Gardner&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This line stood out because in tech — whether you're starting to code, building your first project, or applying for that dream job — there’s always someone who’ll doubt you, maybe even yourself. But protecting your dream and showing up daily matters more than anyone's opinion.&lt;/p&gt;

&lt;p&gt;Another favorite of mine:  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;“If someone asks me a question and I don’t know the answer, I’ll say I don’t know. But I know how to find the solution.”&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This line is the &lt;strong&gt;developer mindset&lt;/strong&gt; in a nutshell. You don't need to have all the answers — just the curiosity and drive to figure them out.&lt;/p&gt;




&lt;h2&gt;
  
  
  🧠 My Personal Review
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;The Pursuit of Happyness&lt;/em&gt; is more than just a feel-good film — it's a lesson in grit, patience, and believing in yourself when life keeps saying "no." Watching Chris Gardner go from struggling to success reminded me that &lt;strong&gt;consistent effort pays off&lt;/strong&gt;, even when the results aren’t immediate.&lt;/p&gt;




&lt;h2&gt;
  
  
  📚 What I Learned (and How It Helps in Tech)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Persistence beats talent&lt;/strong&gt; — Showing up and doing the work every day builds results.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Learning is a lifelong process&lt;/strong&gt; — Whether it’s a job interview or a new framework, not knowing is okay as long as you’re willing to learn.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mindset matters&lt;/strong&gt; — Staying positive even when you’re stuck helps you push through.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Solve problems, one at a time&lt;/strong&gt; — Like debugging, life’s challenges are easier when broken down.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  💻 How It Connects to What I Learn in Class
&lt;/h2&gt;

&lt;p&gt;In class, we often face tough assignments, unclear problems, or projects that seem too big. This movie reminded me of things like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Problem-solving frameworks&lt;/strong&gt; — Breaking problems into steps.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Resilience and adaptability&lt;/strong&gt; — Especially in coding, where things rarely work on the first try.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Effective communication&lt;/strong&gt; — Being honest about what you know and what you need to learn, like in teamwork or interviews.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Final Thoughts 💬
&lt;/h2&gt;

&lt;p&gt;We all face setbacks — in life, in code, in careers. But movies like this remind us that &lt;strong&gt;the process matters&lt;/strong&gt; and that every challenge is a step toward something greater.&lt;/p&gt;

&lt;p&gt;If you're on your own dev journey, just remember:  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;You may not know everything now, but you know how to find the solution.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  Would love to hear — what movie has inspired you as a developer? Drop it in the comments! 🎥💻
&lt;/h3&gt;

</description>
      <category>motivation</category>
      <category>productivity</category>
      <category>career</category>
      <category>developerlife</category>
    </item>
    <item>
      <title>From Photos to Pixels: Building a Retro Art Transformer with GitHub Copilot</title>
      <dc:creator>Mohit Bisht</dc:creator>
      <pubDate>Mon, 20 Jan 2025 08:00:00 +0000</pubDate>
      <link>https://dev.to/mohitb_twt/from-photos-to-pixels-building-a-retro-art-transformer-with-github-copilot-1hc5</link>
      <guid>https://dev.to/mohitb_twt/from-photos-to-pixels-building-a-retro-art-transformer-with-github-copilot-1hc5</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/github"&gt;GitHub Copilot Challenge &lt;/a&gt;: Transitions and Transformations&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;Hey fellow devs! 👋 I wanted to share something cool I built for the GitHub Copilot Challenge. I made this fun web app called Pixel Art Transformer that turns your regular photos into pixel art. You know, like those retro gaming graphics we all love!&lt;/p&gt;

&lt;p&gt;So basically, you can upload any image, and the app transforms it into pixel art. You can play around with different effects, get color palettes from your image, and save your creations. I wanted to make something that's both fun to use and lets people get creative without needing to be art experts.&lt;/p&gt;

&lt;p&gt;The Cool Stuff You Can Do&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Turn any photo into pixel art (super satisfying to watch!)&lt;/li&gt;
&lt;li&gt;Get a matching color palette from your image&lt;/li&gt;
&lt;li&gt;Add some funky effects like grayscale or sepia&lt;/li&gt;
&lt;li&gt;Save your masterpiece as PNG, JPG, or even GIF&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I built it using Next.js and Tailwind CSS, with some Canvas API magic thrown in for the image stuff.&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;Check out the live app here: &lt;a href="https://pixel-art-fawn.vercel.app/" rel="noopener noreferrer"&gt;https://pixel-art-fawn.vercel.app/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuytmglugplq7pfq80cdq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuytmglugplq7pfq80cdq.png" alt="Landing Page" width="800" height="372"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5zdqgj79b8bn9habpgup.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5zdqgj79b8bn9habpgup.png" alt="Pixel Art Transformer" width="800" height="369"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fner9zocliynzu2h6kqfm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fner9zocliynzu2h6kqfm.png" alt="Art Transformer" width="800" height="363"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5jc4v5jb7qrgnhe3jfz7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5jc4v5jb7qrgnhe3jfz7.png" alt="Image Transformer" width="800" height="373"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Repo
&lt;/h2&gt;

&lt;p&gt;Check out the project on GitHub: &lt;a href="https://github.com/Mohiit70/pixel-art" rel="noopener noreferrer"&gt;https://github.com/Mohiit70/pixel-art&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Copilot Experience
&lt;/h2&gt;

&lt;p&gt;Let me tell you - Copilot was like having a coding buddy who never gets tired! Here's how it helped:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It was amazing at suggesting code, especially for the tricky pixel calculation stuff&lt;/li&gt;
&lt;li&gt;Helped me create React components super quickly&lt;/li&gt;
&lt;li&gt;Made writing Tailwind CSS classes way less painful&lt;/li&gt;
&lt;li&gt;Caught some bugs I wouldn't have spotted right away&lt;/li&gt;
&lt;li&gt;Helped clean up my messy code (we all have those moments!)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  GitHub Models
&lt;/h2&gt;

&lt;p&gt;I didn't use GitHub Models specifically for LLM prototyping in this app. However, GitHub Copilot's code suggestions and intelligent autocomplete significantly boosted my productivity and allowed me to focus on the creative aspects of the project.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Building this was honestly so much fun! I learned a ton about breaking down big problems into smaller pieces, and Copilot made the whole process much smoother.&lt;/p&gt;

&lt;p&gt;If you're interested in checking it out or maybe even contributing, the project is up on GitHub. Would love to hear what you think or see what kind of pixel art you create!&lt;/p&gt;

&lt;p&gt;Thanks for reading, and huge thanks to the GitHub Copilot Challenge for giving me the push to build this! ✨&lt;/p&gt;

&lt;p&gt;&lt;em&gt;P.S. Drop a star on the repo if you like it! 😉&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia2.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExeHBwaG1xYXY0YzRtNWZ2aGtnZ3o4Z3Q4YzhleXNhYWxwdDhobWF6aCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2Fl1KtZjg2RoOvqNjoI%2Fgiphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia2.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExeHBwaG1xYXY0YzRtNWZ2aGtnZ3o4Z3Q4YzhleXNhYWxwdDhobWF6aCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2Fl1KtZjg2RoOvqNjoI%2Fgiphy.gif" width="480" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>githubchallenge</category>
      <category>webdev</category>
      <category>ai</category>
    </item>
    <item>
      <title>Using LLaMA Models with Groq: A Beginner's Guide</title>
      <dc:creator>Mohit Bisht</dc:creator>
      <pubDate>Sun, 29 Sep 2024 10:51:17 +0000</pubDate>
      <link>https://dev.to/mohitb_twt/using-llama-models-with-groq-a-beginners-guide-173f</link>
      <guid>https://dev.to/mohitb_twt/using-llama-models-with-groq-a-beginners-guide-173f</guid>
      <description>&lt;p&gt;Hey there, AI enthusiasts! Today, we're going to learn how to use LLaMA models with Groq. It's easier than you might think, and I'll guide you step-by-step on how to get started.&lt;/p&gt;

&lt;p&gt;In this blog, we will explore how to use free AI models, discuss running them locally, and leverage Groq for API-powered applications. Whether you're building a text-based game or an AI-powered app, this guide will cover everything you need.&lt;/p&gt;

&lt;h2&gt;
  
  
  What You'll Need
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Python installed on your computer&lt;/li&gt;
&lt;li&gt;A Groq API key (you can get one from their website)&lt;/li&gt;
&lt;li&gt;Basic knowledge of Python (but don't worry, we'll keep it simple!)&lt;/li&gt;
&lt;li&gt;A curiosity to explore AI in creative ways!&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 1: Set Up Your Environment
&lt;/h2&gt;

&lt;p&gt;First, let's install the Groq library. Open your terminal and run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;groq
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 2: Import the Library and Set Up Your API Key
&lt;/h2&gt;

&lt;p&gt;Now, let's write some Python code. Create a new file called &lt;code&gt;llama_groq_test.py&lt;/code&gt; and add these lines:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;groq&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Groq&lt;/span&gt;

&lt;span class="c1"&gt;# Set your API key
&lt;/span&gt;&lt;span class="n"&gt;api_key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;GROQ_API_KEY&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;api_key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Please enter your Groq API key: &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;GROQ_API_KEY&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;api_key&lt;/span&gt;

&lt;span class="c1"&gt;# Create a client
&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Groq&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This method is more secure as it doesn't hardcode the API key directly in your script.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Choose Your Model
&lt;/h2&gt;

&lt;p&gt;Groq supports different LLaMA models. For this example, we'll use "llama2-70b-4096". Let's add this to our code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;llama2-70b-4096&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 4: Send a Message and Get a Response
&lt;/h2&gt;

&lt;p&gt;Now for the fun part! Let's ask LLaMA a question. Add this to your code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Define your message
&lt;/span&gt;&lt;span class="n"&gt;messages&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;role&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;What&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;s the best way to learn programming?&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="c1"&gt;# Send the message and get the response
&lt;/span&gt;&lt;span class="n"&gt;chat_completion&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;chat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;completions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;temperature&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;max_tokens&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Print the response
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chat_completion&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;choices&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 5: Run Your Code
&lt;/h2&gt;

&lt;p&gt;Save your file and run it from the terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python llama_groq_test.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see LLaMA's response printed out!&lt;/p&gt;

&lt;h2&gt;
  
  
  Bonus: Having a Conversation
&lt;/h2&gt;

&lt;p&gt;Want to have a back-and-forth chat? Here's a simple way to do it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;user_input&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;You: &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;user_input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;quit&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;break&lt;/span&gt;

    &lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;role&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;user_input&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;

    &lt;span class="n"&gt;chat_completion&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;chat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;completions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;temperature&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;max_tokens&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;ai_response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;chat_completion&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;choices&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;AI:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ai_response&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;role&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;assistant&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;ai_response&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This code creates a loop where you can keep chatting with LLaMA until you type 'quit'.&lt;/p&gt;

&lt;h2&gt;
  
  
  Free AI Options: Running LLaMA Locally
&lt;/h2&gt;

&lt;p&gt;Many developers prefer free, open-source models like LLaMA by Meta because they can be run locally without costly API charges. While using APIs like OpenAI or Gemini can be convenient, the open-source nature of LLaMA offers more control and flexibility.&lt;/p&gt;

&lt;p&gt;It's important to note that running LLaMA models locally often requires significant computational resources, especially for larger models. However, for those with the right hardware, this can lead to substantial savings, especially when running your projects without worrying about API costs.&lt;/p&gt;

&lt;p&gt;You can test smaller LLaMA models on your local machine. For larger-scale projects or if you lack the necessary hardware, tools like Groq provide a simple way to integrate AI with just an API key.&lt;/p&gt;

&lt;h2&gt;
  
  
  Star Quest: My AI-Powered Sci-Fi Game
&lt;/h2&gt;

&lt;p&gt;Speaking of AI-powered projects, I recently built a sci-fi text-based game called Star Quest using LLaMA (via Groq's API) and Next.js. The game allows players to explore a narrative-driven world, making choices that affect the storyline.&lt;/p&gt;

&lt;p&gt;Here's a sneak peek into how it works:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The user inputs a choice to guide the story.&lt;/li&gt;
&lt;li&gt;LLaMA processes the user's input, generating a dynamic response that shapes the next part of the plot.&lt;/li&gt;
&lt;li&gt;The game's logic and API integration allow for endless combinations, making it a truly interactive experience.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you'd like to see the full project and try it out yourself, check out my GitHub repo here: &lt;a href="https://github.com/Mohiit70/Star-Quest" rel="noopener noreferrer"&gt;https://github.com/Mohiit70/Star-Quest&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can clone the repository and start exploring sci-fi narratives powered by AI!&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;That's it! You now know how to use LLaMA with Groq to create AI-powered apps or even build your own games. Here's a quick summary:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Install the Groq library.&lt;/li&gt;
&lt;li&gt;Set up your API key securely.&lt;/li&gt;
&lt;li&gt;Choose the LLaMA model.&lt;/li&gt;
&lt;li&gt;Send and receive messages from the AI.&lt;/li&gt;
&lt;li&gt;Experiment with creating your own AI-based applications, like my Star Quest text-based game.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I hope this guide has inspired you to explore the world of AI. Feel free to ask any questions or check out my Star Quest project on GitHub!&lt;/p&gt;

&lt;p&gt;Happy Coding!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>python</category>
      <category>opensource</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
