Skip to main content

LLM Editor

A CLI tool to edit files using LLMs.

Installation

pip install llm-editor

or, if you are installing from git directly

git@github.com:gptabhinav/llm-editor.git
pip install .

Configuration

You can configure the tool using a YAML file.

YAML Configuration

Run the following command to generate a default configuration file at ~/.llm-editor/config.yaml:

edit --init-config

Then edit the file to add your API key:

llm:
  provider: openai
  api_key: "your-api-key"
  model: "gpt-4o"

app:
  backup_enabled: true
  backup_suffix: ".backup"

Usage

1. Using Prompt Tags (Scripting Mode)

Add your instructions directly to the file using <tag> markers.

Example input.txt:

<tag> start_prompt
Convert the following Python code to JavaScript.
<tag> end_prompt

def greet(name):
    print(f"Hello, {name}!")

greet("World")

Run the tool:

edit input.txt

2. Interactive Mode

If the input file does not contain prompt tags, the tool will open your default text editor (configured via $EDITOR). You can type your instructions there, save, and close the editor to proceed.

Interactive Mode Workflow

3. Chat Mode

You can start an interactive chat session about your files using the --chat flag. This is useful for asking questions, getting explanations, or discussing potential changes without modifying the files directly.

Single File:

edit file.py --chat

Multiple Files: You can pass multiple files to load them all into the chat context.

edit file1.py file2.py --chat

Directories & Patterns: You can also pass directories or glob patterns to load multiple files at once.

# Load all files in a directory (recursive)
edit src/ --chat

# Load all Python files using glob pattern
# (Use quotes to ensure the tool handles the pattern matching)
edit "src/**/*.py" --chat

Options

  • --outfile <path>: Write output to a specific file (input file is preserved).
  • --inplace: Overwrite the input file directly (skips backup).
  • --init-config: Initialize the configuration file.
  • --chat: Start an interactive chat session about the file(s).

Usage Tracking & Costs

The tool automatically tracks token usage and estimates costs for each operation.

Logs are stored in ~/.llm-editor/logs/usage.log and contain:

  • Timestamp
  • Model used
  • Token counts (Input/Output/Total)
  • Estimated cost (USD)

Example log entry:

--- Usage Report (2023-10-27T10:00:00.123456) ---
Model: gpt-4o
Input Tokens:  150
Output Tokens: 50
Total Tokens:  200
Estimated Cost: $0.001250
------------------------------

Metadata

Release files for llm-editor 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llm-editor 0.1.5
File Size Uploaded Provenance
llm_editor-0.1.5.tar.gz 10.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for llm-editor 0.1.5
File Interpreter ABI Platform
llm_editor-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 22.3 kB

Release files / llm_editor-0.1.5.tar.gz

Download URL llm_editor-0.1.5.tar.gz
Size 10.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9caf18792514cc3b99759955103f480de4a6e50a863d65046f702b8fb07663f3
BLAKE2b-256 checksum
How to use checksums
748bcf507cb183a4bfee63d7d467efb6477a4eb9dcf22a65d36a283bdcb84453
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / llm_editor-0.1.5-py3-none-any.whl

Download URL llm_editor-0.1.5-py3-none-any.whl
Size 11.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
23f0347d1c9c6fd162c09bbe3b73cee422269feab5c7307d202699bf1b848274
BLAKE2b-256 checksum
How to use checksums
439432269cb2de4c018447dc47616fd120e8e9ff904872071e843b6c51ede6fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Security for llm-editor 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page