Skip to main content

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.

Metadata

Release files for docapi 1.1.14

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

Source distribution (sdist)

Source distribution for docapi 1.1.14
File Size Uploaded
docapi-1.1.14.tar.gz 18.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for docapi 1.1.14
File Interpreter ABI Platform
docapi-1.1.14-py3-none-any.whl Python 3 none any Details

Total release size: 44.0 kB

Release files / docapi-1.1.14.tar.gz

Download URL docapi-1.1.14.tar.gz
Size 18.8 kB
Tags Source
SHA-256 checksum
How to use checksums
30d52fc3aebd96e04d0aefaf0989efb0f98c62bd0bb21e229313ec21576efca6
BLAKE2b-256 checksum
How to use checksums
aa65246bdbc39b02411da20a090f173829e690e6ed52059c18e5c4137ebab8e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.13.5 Darwin/21.6.0

Release files / docapi-1.1.14-py3-none-any.whl

Download URL docapi-1.1.14-py3-none-any.whl
Size 25.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c03fb0d872af7cf58817dce28d108ca392d4d62a4fa085a94e2847a8a53202dc
BLAKE2b-256 checksum
How to use checksums
c7d1d512c2932d0e9802a58f1a05189915a7dfcc7e0f28a2d4abfddd05b46a16
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.13.5 Darwin/21.6.0

Release history Release notifications | RSS feed

This release

1.1.14 This release

2 release files

1.1.13

2 release files

1.1.12

2 release files

1.1.11

2 release files

1.1.10

2 release files

1.1.9

2 release files

1.1.8

2 release files

1.1.7

2 release files

1.1.6

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.0

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.0

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.18

2 release files

0.0.17

2 release files

0.0.16

2 release files

0.0.15

2 release files

0.0.14

2 release files

0.0.13

2 release files

0.0.12

2 release files

0.0.11

2 release files

0.0.10

2 release files

0.0.9

2 release files

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