Google Gemini is the intelligence layer at the center of QuipuEco. Every time a user photographs a piece of waste, Gemini’s vision capabilities analyze the image and return a structured JSON payload describing the material type, recycling instructions, estimated CO₂ savings, and the nearest drop-off point. When the user speaks a follow-up question, that same API powers the conversational voice agent, maintaining context across the full dialogue. Both capabilities are served by the same model —Documentation Index
Fetch the complete documentation index at: https://mintlify.com/davidmpizarro/QuipuEco-Hackaton/llms.txt
Use this file to discover all available pages before exploring further.
gemini-3.1-flash-lite — running in QuipuEco’s FastAPI backend. Before either feature works, you need a Google AI Studio API key.
What Gemini provides to QuipuEco
Vision classification
Analyzes uploaded waste images using multimodal input. Returns a structured JSON object with material type, preparation instructions, CO₂ impact, and the recommended drop-off network.
Conversational chat agent
Powers the voice agent with recycling-specific knowledge. Accepts conversation history and waste context, and returns a structured response that can trigger map navigation or dashboard actions.
gemini-3.1-flash-lite model
A fast, cost-efficient multimodal model optimized for low latency. Suitable for mobile-first experiences where response time directly impacts perceived app quality.
Structured JSON output
Both endpoints request JSON-formatted responses from Gemini using structured prompts defined in
quipueco-backend/app/prompts.py, ensuring the frontend can parse results reliably.Obtaining a Google AI Studio API key
Go to Google AI Studio
Navigate to aistudio.google.com. Sign in with any Google account. Google AI Studio is the official developer console for Gemini API access.
Open the API key panel
Click Get API key in the left sidebar, or navigate directly to aistudio.google.com/apikey.
Create a new API key
Click Create API key. You can either create a key in a new Google Cloud project or associate it with an existing one. For local development, a new project is the easiest option.
Copy the key
The generated key is shown once in full. It always begins with
AIza. Copy it immediately and store it somewhere secure (e.g. a password manager) — you will not be able to view it again in full after closing the dialog.Backend configuration
The API key is loaded byquipueco-backend/app/config.py using python-dotenv and passed to the Gemini SDK client:
quipueco-backend/app/config.py
model object is then imported by app/main.py and used in both the /clasificar and /chat endpoint handlers.
API endpoints and Gemini integration
POST /clasificar — image classification
The classification endpoint accepts a multipart form upload, encodes the image, and sends it alongside a structured prompt to Gemini’s vision API. The prompt instructs the model to return a specific JSON schema:quipueco-backend/app/main.py
ClassificationResult.jsx) expects this exact JSON structure from /clasificar:
| Field | Type | Description |
|---|---|---|
nombre | string | Human-readable name of the identified item |
tipo | string | Material category: plastico, papel, vidrio, metal, organico, electronico, peligroso |
co2_evitado_kg | number | Estimated kg of CO₂ avoided by recycling this item |
peso_estimado_kg | number | Estimated weight of the item in kilograms |
instrucciones | string | Step-by-step preparation instructions before drop-off |
punto_acopio | string | Recommended drop-off network (e.g. “Tiendas Tambo” or “Centro Verde Municipal”) |
consejo | string | Educational tip about the material’s recyclability |
respuesta_voz | string | Pre-formatted text read aloud by the TTS voice agent as the initial greeting |
POST /chat — conversational voice agent
The chat endpoint receives the full conversation history, the current waste classification result for context, and the user’s new message. It returns a structured response that optionally triggers a UI action:quipueco-backend/app/main.py
| Field | Type | Description |
|---|---|---|
respuesta | string | The agent’s reply text, read aloud via the Web Speech API |
accion | string | null | Optional UI action to trigger: "mapa", "dashboard", or null |
accion_data | string | null | Filter string passed to the map when accion is "mapa" (e.g. "plastico", "vidrio") |
punto_cercano | string | null | Name of a specific recycling point for auto-route activation on the map |
accion values:
"mapa"
Opens the recycling map, optionally filtered to a specific material category via
accion_data."dashboard"
Navigates to the Impact Dashboard screen showing the user’s recycling history and points.
null
A text/voice-only response with no navigation action. The agent answers in place.
Request flow diagram
Free tier and rate limits
Google AI Studio provides a free tier suitable for development and hackathon use:- 15 requests per minute (RPM) on the free tier for Gemini Flash models
- 1 million tokens per minute (TPM) input throughput
- 1,500 requests per day free of charge
The free quota in Google AI Studio resets daily at midnight Pacific Time. For a hackathon demo, spacing out classification calls during a presentation ensures you don’t hit the per-minute rate limit during a live session.