grants/AI_SETUP.md
gdegelas a05331128b Atlas Green Morocco — grant strategy platform
- Full grant strategy framework for renewable energy & green hydrogen
- AI-powered grant studio, partner outreach, financial modeling
- Umami analytics with data-performance tracking
- Live Degelas metrics connected to solar.degelas.be
- Trilingual (EN/FR/AR) with i18n support
- Dockerized with Nginx frontend + Express API proxy
2026-06-01 09:44:03 +00:00

2.2 KiB
Raw Permalink Blame History

AI Features — Quick Setup Guide

1. Get an OpenAI API Key

Visit https://platform.openai.com/api-keys → Create a new secret key.

2. Create your .env file

cp .env.example .env
# Then open .env and paste your key:
# OPENAI_API_KEY=sk-...

3. Run locally (two terminals)

Terminal 1 — Frontend (Vite dev server)

npm run dev
# → http://localhost:5173

Terminal 2 — AI Proxy (Express server)

npx tsx server/index.ts
# → http://localhost:3001
# ✅ Atlas Green API proxy running on port 3001

Vite proxies /api/*localhost:3001 automatically in dev mode.

4. Production (Docker — one command)

# Add your key to .env first, then:
docker compose up -d --build

# Both services start:
#  atlas-green-frontend  (nginx, port 80)
#  atlas-green-api       (node, internal port 3001)
# nginx routes /api/* → api-server container

5. Test without an API key (Demo Mode)

No key? No problem. Leave OPENAI_API_KEY unset. All AI tools return clearly labelled mock/demo data so you can test the full UI flow before adding a real key.

6. What the AI features do

Feature Where What it generates
Draft Application Grants section → "Draft Application with AI" button Eligibility check, project summary, innovation statement, budget narrative, consortium plan, next steps
🎯 Readiness Diagnostic AI Tools section Phase readiness score (0100), checkpoint assessment, priority actions, grant recommendations

7. Cost estimate

  • Grant Application Draft: ~3,0006,000 output tokens → ~$0.02$0.06 with gpt-4o
  • Readiness Diagnostic: ~1,5003,000 output tokens → ~$0.01$0.03 with gpt-4o
  • Switch to gpt-4o-mini in server/routes/generate.ts to reduce costs ~15×

8. Architecture reminder

Browser (React, static)
    │  POST /api/ai/generate
    ▼
nginx  ──/api/──▶  Express proxy (api-server container)
                        │  OPENAI_API_KEY (env var, never in browser)
                        │  Framework context injected (grounding)
                        ▼
                   OpenAI /v1/chat/completions
                   (Structured Outputs / JSON Schema)