Generate OpenAPI specifications for any REST API project directory.
Project description
OpenAPI Generator
A pip-installable CLI tool that uses AI to generate OpenAPI 3.0.3 specifications for any REST API project directory.
Overview
Point this tool at any REST API project and it will scan the source files, send them to an AI model (Claude or OpenAI), and produce a valid OpenAPI 3.0.3 JSON specification.
Installation
# With Claude support (default)
pip install "openapi-generator[claude]"
# With OpenAI support
pip install "openapi-generator[openai]"
# Both providers
pip install "openapi-generator[all]"
Usage
openapi-gen <path-to-project> --api-key <your-api-key>
The API key can also be provided via the OPENAPI_GEN_API_KEY environment variable:
export OPENAPI_GEN_API_KEY=sk-ant-...
openapi-gen <path-to-project>
Options
| Option | Default | Description |
|---|---|---|
<path> |
(required) | Path to the REST API project directory |
--api-key |
OPENAPI_GEN_API_KEY env var |
AI provider API key |
--provider |
claude |
AI provider: claude or openai |
--output, -o |
openapi.json |
Output file path |
--title |
API |
API title in the spec |
--version |
1.0.0 |
API version in the spec |
Examples
# Generate a spec using Claude (default)
export OPENAPI_GEN_API_KEY=sk-ant-...
openapi-gen ./my-api
# Generate a spec using OpenAI
openapi-gen ./my-api --provider openai --api-key sk-...
# Specify title, version, and output path
openapi-gen ./my-api --title "My REST API" --version "2.0.0" --output ./docs/openapi.json
Output
The generated file follows the OpenAPI 3.0.3 specification and can be used directly with tools like Swagger UI, Postman, or any OpenAPI-compatible client generator.
Supported Languages
The tool scans files with the following extensions: .py, .js, .ts, .go, .java, .rb, .php, .cs
Development
git clone https://github.com/your-org/openapi-generator
cd openapi-generator
pip install -e ".[dev]"
pytest
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file openapi_spec_generator-0.1.0.tar.gz.
File metadata
- Download URL: openapi_spec_generator-0.1.0.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e45e1ee06cba7d344ce2232e546f3f3f7582c22223339d533d1cd6ebc88cc53d
|
|
| MD5 |
7e5e4981f0c4ca304493f23beb6ef5e8
|
|
| BLAKE2b-256 |
63fbae7c079aa122817781ac69699e7123f4fc0457457b3498e971e61ef8653f
|
File details
Details for the file openapi_spec_generator-0.1.0-py3-none-any.whl.
File metadata
- Download URL: openapi_spec_generator-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
341a8d2592aeab07890719d532f8008907e65acba614ba1c2d633141d1b3c64c
|
|
| MD5 |
e6476f9f18e9a4db82823f5e74c89bd7
|
|
| BLAKE2b-256 |
bf918aef079436d06b4ec10de5f641f5691e239d1ab608a7f37e11849e7b3c28
|