New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

docapi

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

docapi

DocAPI is a Python package that automatically generates API documentation using LLMs. It currently supports Flask and Django frameworks.

  • 0.1.2
  • PyPI
  • Socket score

Maintainers
1

image

Python Version OS License PyPI GitHub pull request

[ 中文 | English ]

DocAPI is an API documentation generation tool based on large language models (LLM), currently supporting Flask and Django frameworks. With DocAPI, you can quickly generate, update, and display API documentation, significantly enhancing development efficiency.


Important Notes

  • Version 1.x.x introduces significant changes compared to 0.x.x. Please refer to the latest usage guide below.
  • By default, generating or updating documentation requires the API service's dependency environment.
  • Use the parameter --static for static route scanning that does not depend on the project environment, only supported for Flask projects. The downside is that it may include unused routes in the documentation, suitable for single-page Flask API projects.

Core Features

  • Framework Support: Automatically scans the route structure of Flask and Django services.
  • Multi-Model Compatibility: Supports various mainstream commercial and open-source large models.
  • Documentation Operations: Automatically generates complete documentation and updates parts of the documentation.
  • Multi-Language Support: Generates multi-language API documentation (requires LLM support).
  • Web Display: Supports displaying API documentation through a web page.

Changelog

  • [2025-01-29]: The .env file by default searches upwards starting from the current directory.
  • [2025-01-24]: Support for Deepseek, Moonshot, Baichuan, Doubao models.
  • [2024-12-16]: Displays progress bar when generating or updating documentation; Flask projects support static route scanning without project environment dependency.
  • [2024-12-05]: Full support for Django versions 3, 4, and 5 with completed testing.
  • [2024-12-02]: Windows system testing passed (requires PowerShell or Windows Terminal), optimized model name management to avoid environment variable conflicts.
  • [2024-11-26]: Supports loading environment variables from .env files and multi-language documentation.
  • [2024-11-24]: Introduced multithreading to accelerate request processing.
  • [2024-11-20]: Added support for custom documentation templates.
  • [2024-11-17]: Support for Zhipu AI and Baidu Qianfan models, optimized documentation structure, added JavaScript example code; removed configuration file execution mode.

Installation

Install the latest version via PyPI:

pip install -U docapi

Install the version with all dependencies:

pip install -U "docapi[all]"

Install with support for a specific framework only:

pip install -U "docapi[flask]"
pip install -U "docapi[django]"

Install from the official PyPI source:

pip install -U "docapi[all]" -i https://pypi.org/simple

Install from GitHub:

pip install git+https://github.com/Shulin-Zhang/docapi

Usage Guide

Below are typical usage examples:

OpenAI Model Example 1. Configure Model and Key:

export DOCAPI_MODEL=openai:gpt-4o-mini

export OPENAI_API_KEY=your_api_key
  1. Generate Documentation:
  • Flask Service:
docapi generate server.py

# Static route scanning, does not depend on the project environment
# docapi generate server.py --static
  • Django Service:
docapi generate manage.py
  1. Update Documentation:
  • Flask Service:
docapi update server.py

# Static route scanning, does not depend on the project environment
# docapi update server.py --static
  • Django Service:
docapi update manage.py
  1. Start Web Service to Display Documentation:
docapi serve

For more usage, please refer to


Supported Models

  • OpenAI
  • Azure OpenAI
  • XAI
  • Open Source Models
  • Baidu Qianfan
  • Tongyi Qianwen
  • Zhipu AI
  • Deepseek
  • (Kimi) Moonshot
  • Doubao
  • Baichuan

Supported Frameworks

  • Flask (>=3.0.0)
  • Django (3, 4, 5)

Example: API Documentation Web Page

image

TODO

  • Support more large models and API frameworks.

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc