Observed since 21 Oct, 10:32 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
A CLI tool for generating safe, NumPy/Sphinx style docstrings using AST parsing.
A simple, secure, and cost-aware CLI tool for generating high-quality NumPy/Sphinx style docstrings using AI.
ai-docify helps you document your Python code instantly using either cloud-based models (OpenAI) or local privacy-focused models (Ollama). It is designed to be safe (using AST parsing), transparent (pre-flight cost checks), and non-destructive.
tiktoken before you spend a penny.ai-docify parses your code's Abstract Syntax Tree to surgically inject docstrings without breaking indentation or logic.strip command to safely remove all docstrings if you change your mind.rewrite for speed/coverage, or inject for surgical precision.Install ai-docify directly from PyPI:
pip install ai-docify
If you plan to use OpenAI models, set your API key as an environment variable:
Mac/Linux:
export OPENAI_API_KEY=sk-your-api-key-here
Windows (PowerShell):
$env:OPENAI_API_KEY="sk-your-api-key-here"
(Alternatively, you can create a .env file in your project root)
Prefer a GUI? This CLI powers the AI Docify for VS Code extension. 👉 **Download AI Docify for VS Code
You must specify the Provider, Model, and Mode.
inject Mode (Recommended)Best for: Surgical precision and preserving formatting. Uses AST parsing to find functions and classes, injecting docstrings exactly where they belong without touching a single line of your actual code.
ai-docify generate my_script.py --provider openai --model gpt-5-mini --mode inject
rewrite ModeBest for: Speed and heavy refactoring. Asks the AI to rewrite the file with docs included. Good for initial drafts or undocumented legacy files.
# Using a local model (Free)
ai-docify generate my_script.py --provider ollama --model llama3 --mode rewrite
Best for: Quickly documenting a specific piece of code you're working on.
Use the --function flag to target a single function or class by name. This is faster, cheaper, and automatically uses the safe inject mode.
# Target only the 'calculate_total' function in the file
ai-docify generate utils.py --provider openai --model gpt-5-mini --function calculate_total
Before generating anything, the tool will pause and show you an exact cost estimate:
🤖 ai-docify: Checking my_script.py in INJECT mode
📊 Estimation (Input Only):
Tokens: 350
Est. Cost: $0.00009
Do you want to proceed? [y/n]:
Need to start over? The strip command uses AST parsing to cleanly remove all docstrings from a file, leaving your logic intact. It saves the clean version to a stripped_scripts/ folder by default.
ai-docify strip my_script.py
To remove all generated files from the default ai_output/ directory:
ai-docify clean
ai-docify comes pre-configured with pricing and token limits for popular models.
OpenAI:
o3-2025-04-16gpt-5 / gpt-5-mini / gpt-5-nanogpt-5.2Ollama (Local):
llama3.1:8bqwen2.5-coder:7bollama pull works with the --provider ollama flag)Missing a model? Feel free to open an Issue or Pull Request to update the internal pricing configuration!
We welcome contributions! Whether it's a bug fix, a new feature, or a better prompt template:
git checkout -b feature/NewModel)git commit -m 'Add GPT-6 support')git push origin feature/NewModel)Distributed under the MIT License. See LICENSE for more information.
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 1.1.2 | 3 Jan 2026 | 12 |
This describes our collected data; it is not a security assessment.
Observed since 21 Oct, 10:32 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:03478dc1bcd9a4c95c1fd83f4c30bc3a5f978ab0ede3798c876917d2f61f2424