# projectdiscovery/aix architecture

> Architecture diagram of the GitHub repository projectdiscovery/aix, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/projectdiscovery/aix
- Repository: https://github.com/projectdiscovery/aix

## Overview

AIx is a command-line client for querying OpenAI language models. The main workflow parses prompt and model options, sends a chat or model-list request, then formats or saves the result; streaming responses use a pipe to stdout. The README also documents model selection, system context, JSONL/file output, and update options. Source excerpts show the CLI-to-runner flow and response handling; no separate storage service is present, and update behavior is only partially evidenced.

Main entry points: [`cmd/aix/main.go`](https://github.com/projectdiscovery/aix/blob/main/cmd/aix/main.go) (AIx command), [`internal/runner/options.go`](https://github.com/projectdiscovery/aix/blob/main/internal/runner/options.go) (Input options), [`internal/runner/runner.go`](https://github.com/projectdiscovery/aix/blob/main/internal/runner/runner.go) (Request runner), [`internal/runner/result.go`](https://github.com/projectdiscovery/aix/blob/main/internal/runner/result.go) (Response result)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI interaction"]
  node_entry["AIx command<br/>[main.go]"]
  node_options["Input options<br/>[options.go]"]
  node_banner["Startup banner<br/>[banner.go]"]
  node_terminal["Terminal output"]
  node_output_file["Output file"]
end

subgraph group_runtime["Request and results"]
  node_runner["Request runner<br/>[runner.go]"]
  node_openai["OpenAI API"]
  node_result["Response result<br/>[result.go]"]
  node_update_service["Update service"]
end

node_user(("CLI user"))

node_user -->|"runs"| node_entry
node_entry -->|"parses options"| node_options
node_options -->|"shows banner"| node_banner
node_entry -->|"creates and runs"| node_runner
node_runner -->|"requests models or chat"| node_openai
node_runner -->|"builds response"| node_result
node_entry -->|"formats response"| node_result
node_entry -->|"prints or streams"| node_terminal
node_entry -->|"writes output"| node_output_file
node_options -->|"checks version"| node_update_service

click node_entry "https://github.com/projectdiscovery/aix/blob/main/cmd/aix/main.go"
click node_options "https://github.com/projectdiscovery/aix/blob/main/internal/runner/options.go"
click node_banner "https://github.com/projectdiscovery/aix/blob/main/internal/runner/banner.go"
click node_runner "https://github.com/projectdiscovery/aix/blob/main/internal/runner/runner.go"
click node_result "https://github.com/projectdiscovery/aix/blob/main/internal/runner/result.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_options,node_banner,node_terminal,node_output_file,node_user toneBlue
class node_runner,node_openai,node_result,node_update_service toneAmber
```

## Components

### CLI interaction

- [AIx command](https://github.com/projectdiscovery/aix/blob/main/cmd/aix/main.go): `cmd/aix/main.go`
- [Input options](https://github.com/projectdiscovery/aix/blob/main/internal/runner/options.go): `internal/runner/options.go`
- [Startup banner](https://github.com/projectdiscovery/aix/blob/main/internal/runner/banner.go): `internal/runner/banner.go`
- **Terminal output**
- **Output file**

### Request and results

- [Request runner](https://github.com/projectdiscovery/aix/blob/main/internal/runner/runner.go): `internal/runner/runner.go`
- **OpenAI API**
- [Response result](https://github.com/projectdiscovery/aix/blob/main/internal/runner/result.go): `internal/runner/result.go`
- **Update service**

### Other components

- **CLI user**

## Connections

- CLI user → AIx command: runs (evidence: `README.md`)
- AIx command → Input options: parses options (evidence: `cmd/aix/main.go`)
- Input options → Startup banner: shows banner (evidence: `internal/runner/options.go`)
- AIx command → Request runner: creates and runs (evidence: `cmd/aix/main.go`)
- Request runner → OpenAI API: requests models or chat (evidence: `internal/runner/runner.go`)
- Request runner → Response result: builds response (evidence: `internal/runner/runner.go`)
- AIx command → Response result: formats response (evidence: `cmd/aix/main.go`)
- AIx command → Terminal output: prints or streams (evidence: `cmd/aix/main.go`)
- AIx command → Output file: writes output (evidence: `cmd/aix/main.go`)
- Input options → Update service: checks version (evidence: `internal/runner/options.go`)
