Skip to main content

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

Project description

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/NewToolAI/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.

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

docapi-1.1.14.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

docapi-1.1.14-py3-none-any.whl (25.2 kB view details)

Uploaded Python 3

File details

Details for the file docapi-1.1.14.tar.gz.

File metadata

  • Download URL: docapi-1.1.14.tar.gz
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.5 Darwin/21.6.0

File hashes

Hashes for docapi-1.1.14.tar.gz
Algorithm Hash digest
SHA256 30d52fc3aebd96e04d0aefaf0989efb0f98c62bd0bb21e229313ec21576efca6
MD5 c554c26d51c3a9cb9ac428e6f06c3e06
BLAKE2b-256 aa65246bdbc39b02411da20a090f173829e690e6ed52059c18e5c4137ebab8e9

See more details on using hashes here.

File details

Details for the file docapi-1.1.14-py3-none-any.whl.

File metadata

  • Download URL: docapi-1.1.14-py3-none-any.whl
  • Upload date:
  • Size: 25.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.5 Darwin/21.6.0

File hashes

Hashes for docapi-1.1.14-py3-none-any.whl
Algorithm Hash digest
SHA256 c03fb0d872af7cf58817dce28d108ca392d4d62a4fa085a94e2847a8a53202dc
MD5 9020742b601dfec81d8492e3bf07055b
BLAKE2b-256 c7d1d512c2932d0e9802a58f1a05189915a7dfcc7e0f28a2d4abfddd05b46a16

See more details on using hashes here.

Supported by

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