A lightweight CLI tool that renders OpenAPI (Swagger) specifications as beautiful terminal tree diagrams. Supports local files and remote servers, with keyword search, LLM-optimized output, and RAG knowledge base export.
-
Zero Dependencies — Pure Python 3 standard library. No third-party packages required.
-
Multi-Source — Read local JSON files or fetch from remote OpenAPI servers.
-
Smart Search —
-sflag filters endpoints by path, method, or summary. -
Color-Coded Methods — HTTP methods highlighted in distinct colors:
Method Color GET Green POST Blue PUT Yellow DELETE Red PATCH Magenta -
HTML Export —
--htmlsaves a styled HTML file with Catppuccin light/dark theme toggle. -
Agent Output —
--agent-outputgenerates LLM-friendly formats for AI-assisted development. -
RAG Export —
--rag-outputgenerates structured chunks for vector databases and retrieval systems. -
Smart Path Merging — Auto-collapses single-child path segments for cleaner output.
-
Springdoc Compatible — Auto-appends
/v3/api-docsto bare URLs.
Download from GitHub Releases — no Python required.
macOS: If you see "api-tree cannot be opened because the developer cannot be verified", run:
xattr -cr /path/to/api-treeOr right-click the binary → Open → Open Anyway.
git clone https://github.com/Abyss-PlayerEG/api-tree.git
cd api-tree
uv sync
uv run api-tree-
pip install api-tree -
pipx install api-tree -
brew install api-tree -
winget install api-tree
# Connect to local server (default: localhost:8080)
api-tree
# Specify a server
api-tree http://localhost:9090
# Read from local file
api-tree ./openapi.jsonapi-tree # Default: localhost:8080
api-tree http://localhost:9090 # Custom server
api-tree /path/to/openapi.json # Local file
api-tree -s auth # Search endpoints containing 'auth'
api-tree --html # Export as HTMLUse $:{pattern} syntax with -s flag for regex matching:
api-tree -s '$:{user|pet}' # Match "user" or "pet"
api-tree -s '$:{^/api/v1}' # Paths starting with /api/v1
api-tree -s '$:{GET|POST}' # Match GET or POST methods
api-tree -s '$:{create|update}' # Match create or updateIf the URL has no path (e.g.
http://localhost:9090), the tool auto-appends/v3/api-docs. To use a different endpoint, specify the full URL directly.
Generate LLM-optimized representations of your API structure. Useful when feeding API context to AI coding assistants.
api-tree --agent-output markdown # Clean markdown table
api-tree --agent-output json # Structured JSON
api-tree --agent-output curl # Ready-to-use curl commandsUse cases:
- Feed API structure to ChatGPT/Claude for code generation
- Generate curl commands for API testing
- Create API reference docs for AI pair programming
Generate structured chunks for vector databases and retrieval-augmented generation systems.
api-tree --rag-output jsonl # One JSON object per line (for vector DB ingestion)
api-tree --rag-output json # Full JSON structure
api-tree --rag-chunk-size 20 # Endpoints per chunk (default: 10)Use cases:
- Build a searchable API knowledge base
- Enhance RAG systems with endpoint context
- Feed structured data to embedding pipelines
api-tree --init-config # Generate ~/.config/api-tree/config.json
api-tree --show-config # Show current configapi-tree update --check # Check for new version (no install)
api-tree update # Download and install latest versionSupports single-file .py, macOS zip, Windows zip, and Windows installer. Downloads are verified with SHA256 and auto-rolled back on failure.
Config file:
{
"output_dir": "~/Downloads",
"default_url": "http://localhost:8080"
}


