Developer: Alia
Module: REST API Server — connects all 4 CircuitMind modules
This FastAPI server connects all 4 modules (Generate, Explain, Diagnose, Export) into a single running service. Any frontend, tool, or script can send requests to this API and get circuit results back.
| Method | Endpoint | Description |
|---|---|---|
| GET | / |
Health check — confirms API is running |
| POST | /generate |
Convert natural language prompt to circuit JSON |
| POST | /explain |
Explain a circuit in plain English |
| POST | /diagnose |
Check circuit for electrical issues |
| POST | /export |
Export circuit to SPICE netlist or SVG |
| POST | /generate-and-explain |
Generate + explain + diagnose in one request |
pip install -r requirements.txtcp .env.example .envOpen .env and add your Groq API key. Get a free key at console.groq.com.
GROQ_API_KEY=your_key_here
uvicorn api.app:app --reloadhttp://localhost:8000/docs
POST /generate
{
"prompt": "make me a LED circuit"
}Response:
{
"circuit_name": "LED Circuit",
"components": ["battery", "resistor", "led"],
"connections": ["battery -> resistor -> led"],
"confidence": "high",
"source": "llm"
}POST /explain
{
"circuit_json": {
"circuit_name": "LED Circuit",
"components": ["battery", "resistor", "led"],
"connections": ["battery -> resistor -> led"]
}
}POST /diagnose
{
"circuit_json": {
"circuit_name": "Bad Circuit",
"components": ["battery", "led"],
"connections": ["battery -> led"]
}
}POST /export
{
"circuit_json": {
"circuit_name": "LED Circuit",
"components": ["battery", "resistor", "led"],
"connections": ["battery -> resistor -> led"]
},
"export_format": "spice"
}POST /generate-and-explain
{
"prompt": "555 timer circuit"
}| File | Purpose |
|---|---|
app.py |
Main FastAPI server code |
README.md |
This file |