GitHub · Documentation · PyPI
I built CircuitGen to make it easier to turn a circuit idea or JSON netlist into a readable schematic, from Python or a terminal.
For description-based generation, an AI provider drafts the netlist. CircuitGen's Python engine then validates connections, places components, routes wires, and renders the schematic. Rendering and validation can also run directly on a netlist, without an AI key.
Generate
Install CircuitGen with Python 3.10 or newer:
python -m pip install circuitgen If you encounter an installation error, see Troubleshooting.
Interactive CLI
Run the CLI:
circuit If you encounter an error launching it, see Troubleshooting. Then choose Generate from Home.
- Describe the circuit and how its parts connect. A good first prompt is: "A 9 V battery connected to a red LED through a 360-ohm resistor."
- Check the provider and model shown below the description. Choose Change provider / model to browse models, enter a model ID, manage the API key, or test the connection. You can also set the key in CLI Settings or through the provider's environment variable.
- Choose an output folder and filename. Use Browse output folders if needed; the selected format controls the file extension.
- Select Generate schematic. The screen shows progress as CircuitGen requests a netlist, validates it, renders the schematic, and saves the file. If a required detail is unclear, it may ask a question before continuing.
If the output folder is missing, CircuitGen asks whether to create it. If the file already exists, it asks before replacing it when overwrite confirmation is on. After saving, you can open the schematic, view the netlist, generate another, or return Home. If rendering fails after the provider returns a netlist, you can inspect and copy that JSON. See the CLI guide for more details.
Direct command
For a one-line terminal command, pass a description, provider, and model. The CLI can use a key from Settings or the provider's environment variable:
circuit generate "YOUR_CIRCUIT_DESCRIPTION" --provider YOUR_PROVIDER --model YOUR_MODEL_ID -o schematic.svg Python library
In a Python script, generate() takes the description plus a provider and model available to your key. Pass the key with api_key or load it from your provider's environment variable. Python calls do not use keys saved in CLI Settings.
import os from circuitgen import generate result = generate( "A 9 V NE555 astable timer with 10 kΩ and 100 kΩ resistors, a 10 µF timing capacitor, and a red LED indicator through a 1 kΩ resistor.", provider="YOUR_PROVIDER", model="YOUR_MODEL_ID", api_key=os.environ["YOUR_PROVIDER_API_KEY"], output="timer.svg", ) Replace the environment variable name with the one used by your provider. See the provider guide for options.
Render
Render an existing netlist without an AI request. In the interactive CLI, run circuit and choose Render. Open a JSON file or paste JSON, set the output folder and filename, then choose Render schematic. The saved Output settings control the format and overwrite confirmation. Afterward, you can open the file, view the netlist, or render another circuit.
To render a saved file directly:
circuit render filter.json -o filter.png From Python, from_netlist() accepts a netlist like this. The output is taken across the capacitor at OUTPUT and RETURN:
from circuitgen import from_netlist netlist = { "components": [ {"id": "V1", "type": "dc_source", "value": "5 V"}, {"id": "R1", "type": "resistor", "value": "1 kΩ"}, {"id": "C1", "type": "capacitor", "value": "100 nF"}, ], "nets": [ {"name": "INPUT", "pins": ["V1.p", "R1.a"]}, {"name": "OUTPUT", "pins": ["R1.b", "C1.a"]}, {"name": "RETURN", "pins": ["C1.b", "V1.n"]}, ], } result = from_netlist(netlist, output="filter.png") For example, output formats include SVG, PNG, and PDF. Appearance options include colors and whether component IDs and values are shown.
Validate
In the interactive CLI, choose Validate to open a JSON file or paste one and review its errors and warnings. View details shows the full report; Edit JSON or Change file lets you correct the input. Validation does not create an image. From a terminal, check a saved file with:
circuit validate netlist.json Python's validate() returns whether the netlist is valid and any structural errors:
import json from pathlib import Path from circuitgen import validate netlist = json.loads(Path("netlist.json").read_text(encoding="utf-8")) result = validate(netlist) print(result.valid) print(result.errors) Validation checks structure and selected electrical rules. It does not simulate circuit behavior or guarantee that a design is safe or will work as built. Review values and connections before using a schematic.
CircuitGen is open source under the MIT License. See the documentation, source code, and PyPI package.





