Skip to main content

Command Line

Estimated read~5-8 min
TL;DR
  • Interactive CLI: Run circuit and choose Generate (AI, provider and model required), Render (draw JSON), or Validate (check JSON). Render and Validate work offline.
  • Direct commands: Use circuit generate "DESCRIPTION" --provider ID --model ID, circuit render FILE.json, or circuit validate FILE.json. Add -o FILE to choose an output path and --force to replace an existing file.
  • Keys and models: Generate uses the provider and model saved in Settings unless you pass flags. Keys come from the provider environment variable first, then the CLI's secure credential store. New settings have no provider or model selected.
  • Setup help: Run python -m circuitgen doctor to check Python, installation, PATH, dependencies, settings, and credential storage.

CircuitGen's CLI lets you generate schematics, render netlists, and check connections from a terminal.

Open the CLI​

circuit

Use a terminal at least 80 columns wide and 24 rows tall for the best fit.

To move between screens and choose options in the interactive CLI, use these navigation keys:

KeyAction
↑ / ↓Move through menus
EnterChoose an item
Tab / Shift+TabMove between fields
EscGo back or cancel
Ctrl+QQuit CircuitGen
Ctrl+C / Ctrl+VCopy and paste text
Ctrl+ASelect all text in an editor

In a text editor, Enter adds a line. Clipboard shortcuts can vary by terminal; if Ctrl+C or Ctrl+V does not work, try Ctrl+Shift+C or Ctrl+Shift+V. Right-clicking selected text copies it, and right-clicking blank space pastes into the focused field.

Generate​

CircuitGen Generate screen

Choose Generate from Home. This uses an AI provider and requires internet access, a selected provider and model, and a key available from CLI Settings or the provider's environment variable.

  1. Describe your circuit. Enter the components and how they connect. Use clear terminal or pin names when they matter.
  2. Choose a provider and model. The line below the description shows the current selection. Select Change provider / model to change it, browse models, manage the API key, or test the connection.
  3. Choose where to save. Set the output directory and filename. The filename extension follows the saved output format, such as circuit.svg; use Browse output folders to choose a directory.
  4. Select Generate schematic. CircuitGen requests a netlist, checks it, renders the drawing, and saves the result. If a required wiring detail is unclear, it can ask a clarification question before continuing.

The generation screen shows progress through the provider request, validation and rendering, and saving steps. If the destination folder does not exist, the CLI asks whether to create it. If a file already exists, it asks before replacing it when overwrite confirmation is enabled.

After a successful save, choose Open schematic, View netlist, Generate another, or Back to home. If generation fails, the screen shows the provider or validation error. If the provider returned a netlist but rendering failed, choose to view that JSON in the editor, copy it, or return to Generate and edit the description.

Render​

CircuitGen Render screen

Choose Render to draw an existing JSON netlist. This uses the local schematic engine and works without an API key or internet connection. Select one of two input methods:

  • Open JSON file: choose an existing netlist on disk. You can type its path or use the file browser.
  • Paste JSON: enter the netlist directly in the editor. This is useful for a small netlist or one copied from another tool.

Set the output directory and filename, then select Render schematic. The configured output format is used; filenames use the matching .svg, .png, or .pdf extension. The CLI checks folder creation and file replacement according to your Output settings.

After rendering, choose Open schematic, View netlist, Render another, or Back to home. If Open schematic cannot launch a viewer, the file remains saved at the displayed path.

Validate​

CircuitGen Validate screen

Choose Validate to inspect a JSON netlist without creating a schematic. Open a file or paste JSON into the editor, then select Validate netlist.

The result reports structural errors and any warnings from CircuitGen's available electrical checks. If validation fails, use View details for the full report, then Edit JSON or Change file to fix the input. You can also validate another netlist or return home.

Validation checks netlist structure and selected electrical rules. It does not render the schematic, simulate analog behavior, guarantee electrical safety, or certify a design for manufacturing.

Settings​

CircuitGen Settings screen

Open Settings from Home to configure these categories. Changes are saved on confirmation.

CategoryWhat it controls
AI ProvidersSelect provider and model, browse models, manage its key, or test connection. None selected initially.
GenerationSet retry, clarification, and request timeout. Defaults: retry off, clarification on, 120 seconds.
OutputSet folder, format, overwrite prompt, auto-open, and JSON sidecar. Defaults: current folder, SVG, prompt on; auto-open and sidecar off.
Schematic PreferencesSet background and colors; show or hide component IDs and values. Defaults keep the current style and show labels.
InterfaceChoose PCB Green (default), Midnight Blue, Light, Monochrome, or Regular terminal; set motion and terminal color options.
Reset SettingsRestore defaults after confirmation. Stored API keys stay saved.
Run Setup AgainReopen setup. Existing settings remain unless changed.

Help​

Choose Help from Home for getting started instructions, keyboard shortcuts, example prompts, common troubleshooting tips, and command help. Select Documentation to open the hosted documentation or the GitHub repository.

Direct commands​

Direct commands run one operation and return to the shell. Use circuit --help for the top-level command list, or circuit help COMMAND for a specific command.

Generate from a description​

circuit generate "A 9 V battery connected to an LED through a resistor." --provider YOUR_PROVIDER --model YOUR_MODEL_ID -o led.svg
Argument or flagMeaning
DESCRIPTIONRequired circuit description, unless --stdin is used.
--provider IDProvider ID. Required unless saved in Settings.
--model IDExact model ID available to your key. Required unless saved in Settings.
-o FILE, --output FILEOutput path. If omitted, uses circuit.<format> in the current directory; the format comes from Settings.
--forceReplace an existing output file without stopping for confirmation. Without this flag, an existing file causes an error.
--stdinRead the description from standard input instead of the positional description. These input forms cannot be used together.
--no-colorPrint plain text without terminal colors.

For example, pipe a description from a file:

type prompt.txt | circuit generate --stdin --provider YOUR_PROVIDER --model YOUR_MODEL_ID -o led.svg

The command gets its API key from the provider's environment variable or the key saved in CLI Settings. If both exist, the environment variable is used. It also uses saved generation and schematic preferences. Python library code does not read the CLI's stored key.

Render a netlist​

circuit render led.json -o led.pdf
Argument or flagMeaning
FILEJSON netlist file, required unless --stdin is used.
-o FILE, --output FILEOutput path. If omitted, uses circuit.<format> in the current directory, with the format from Settings. .svg, .png, or .pdf selects the output type.
--forceReplace an existing output file. Otherwise, the command stops with an error if the path already exists.
--stdinRead JSON from standard input instead of a file path. These input forms cannot be used together.
--no-colorPrint plain text without terminal colors.

Rendering is offline. It applies saved schematic appearance settings and does not use provider keys.

Validate a netlist​

circuit validate led.json
Argument or flagMeaning
FILEJSON netlist file, required unless --stdin is used.
--stdinRead JSON from standard input instead of a file path.
--no-colorPrint plain text without terminal colors.

Validation prints structural errors or available electrical findings. It does not write an output file. To validate piped JSON, use type led.json | circuit validate --stdin in Windows Command Prompt or PowerShell; use cat led.json | circuit validate --stdin on macOS or Linux.

Show or open Settings​

circuit config --show
Argument or flagMeaning
--showPrint saved preferences as JSON, without API keys.
--no-colorPrint plain text without terminal colors.

With no flags, circuit config opens the interactive Settings screen in a terminal. If standard input or output is not interactive, it prints the saved configuration instead.

Troubleshooting​

Run diagnostics​

python -m circuitgen doctor
python -m circuitgen doctor --debug

doctor checks the Python environment, installed package, launcher and PATH, dependencies, configuration, credential storage, and terminal. It does not change settings. --debug shows full tracebacks if a check fails.

Check or update Windows PATH​

python -m circuitgen setup-path --check
python -m circuitgen setup-path
FlagMeaning
--checkReport whether PATH needs an update without changing it.
--yes, -yApply the PATH update without asking for confirmation.

Without --check or --yes, the command asks before updating the Windows user PATH. Restart the terminal after a PATH change. This command is for Windows; on other systems, use the relevant shell or environment setup.

CircuitGen uses the wrong Python environment​

Run python -m circuitgen doctor. If Python Version, Python Environment Type, or CircuitGen Package shows an unexpected version or location, activate the intended environment and install CircuitGen with that Python:

python -m pip install circuitgen

CircuitGen or a dependency is missing​

If Doctor reports a failed CircuitGen Package or Dependency check, reinstall or upgrade CircuitGen with the Python shown in the report:

python -m pip install --upgrade circuitgen

Settings cannot be saved​

If the Config Directory check warns or fails, make sure the reported folder is writable by your account.

Secure API key storage is unavailable​

If Credential Storage warns, set the provider's environment variable. The CLI can use that key without saving it in Settings.

Shared command options​

OptionMeaning
--help, -hShow help for a command and exit. For example, circuit render --help.
--version, -vPrint the CircuitGen version and exit.
--debugEnable diagnostic traceback output. Use circuit --debug COMMAND for global debug mode; python -m circuitgen doctor --debug is also supported.

--stdin cannot be combined with a description or input filename. --force applies only to commands that save a schematic. The output extension must be .svg, .png, or .pdf.