Skip to main content

Turn natural language descriptions into Excalidraw diagrams

Project description

DiagramScribe

Describe a diagram in plain English. DiagramScribe generates it.

diagram-scribe
> Describe your diagram: CI/CD pipeline  push code, run tests, if tests pass deploy to
>                         staging, run smoke tests, if smoke tests pass deploy to production,
>                         otherwise notify the team.
> [diagram opens in Excalidraw]
> Refine (or press Enter to finish): add a manual approval step before production deploy
> [diagram updates]
> Refine (or press Enter to finish):
> Done.

Works as a CLI tool or as a Python library you can embed in your own project.


Example prompts

Flowchart with decision branches:

user login flow with decisions: user submits login form, system validates
credentials, if valid show dashboard, if invalid show error message

System architecture diagram:

Generate a high-level system architecture diagram for an e-commerce platform.
The system should have an API Gateway that routes traffic to three distinct
microservices: 1. An Auth Service connected to a PostgreSQL database. 2. An
Order Service connected to a MongoDB database. 3. A Notification Service that
handles emails. Show an asynchronous message queue (like RabbitMQ) sitting
between the Order Service and the Notification Service to handle background tasks.

UML sequence diagram:

Create a UML sequence diagram showing a user logging into a mobile application.
The flow should include four participants: User, Mobile App, API Gateway, and
Identity Provider. The sequence must show: 1. The User entering credentials into
the Mobile App. 2. The Mobile App sending a POST request to the API Gateway.
3. The API Gateway forwarding the validation request to the Identity Provider.
4. The Identity Provider verifying the credentials, returning a JWT token back
to the Gateway, which passes it to the Mobile App. 5. The Mobile App successfully
displaying the home dashboard to the User.

Install

pip install diagram-scribe

Usage

CLI — interactive, no code needed:

diagram-scribe

Library — embed in your own tool:

from diagram_scribe import DiagramScribe

ds = DiagramScribe()
ds.draw("User authentication flow — user submits credentials, validate token, "
        "if valid return dashboard, if invalid increment retry count, "
        "if retries exceeded lock account.")
ds.refine("add a password reset path after account lock")

LLM Options

DiagramScribe needs an LLM to interpret your description. By default it uses OpenRouter — free models available, no credit card required. Or run one locally with Ollama (no account needed).

# Free via OpenRouter (default) — sign up at openrouter.ai, create a key
OPENROUTER_API_KEY=sk-or-... diagram-scribe

# Local via Ollama (no internet, no account)
OLLAMA_MODEL=qwen2.5 diagram-scribe

# Claude via Anthropic (paid) — pip install "diagram-scribe[claude]"
ANTHROPIC_API_KEY=sk-ant-... diagram-scribe

Or create ~/.config/diagram-scribe/.env (works from any directory):

# OpenRouter (default)
OPENROUTER_API_KEY=sk-or-...
OPENROUTER_MODEL=nvidia/nemotron-3-super-120b-a12b:free

# Ollama
# OLLAMA_MODEL=qwen2.5

# Anthropic
# ANTHROPIC_API_KEY=sk-ant-...

Documentation

  • User Guide — setup, all LLM options, CLI and library examples, architecture
  • API Reference — full class and method docs generated from source

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

diagram_scribe-0.1.0.tar.gz (2.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

diagram_scribe-0.1.0-py3-none-any.whl (2.4 MB view details)

Uploaded Python 3

File details

Details for the file diagram_scribe-0.1.0.tar.gz.

File metadata

  • Download URL: diagram_scribe-0.1.0.tar.gz
  • Upload date:
  • Size: 2.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for diagram_scribe-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cfe9722949c631a207099828c4d797745c9ec0407f8ece69af0e1fe72437b338
MD5 04bd311cbbe51d690e214f9ca73a5d02
BLAKE2b-256 7cdebad773b0df0994bdcdc2012c3d94952f3772c40e2fecf3895235dc5dede0

See more details on using hashes here.

File details

Details for the file diagram_scribe-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: diagram_scribe-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 2.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for diagram_scribe-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 efb48c8b5e565e8e3e35fad6099e2e58878c603144af4bff2e0dbcbc339963aa
MD5 07e51cb98c3ef386628cb08505ae3de3
BLAKE2b-256 fa5112d6d0aa6c40475de5e95345ea498c6d37beec03f6f71bfb93d065c79bd3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page