This repository contains an OpenAPI specification for the OpenAI API, as well as a Python script that uses OpenAPI Generator to auto-generate client SDKs from the specification.
Nota bene: this repository is basically just a copy of its original with some corrections and enhancements in this ReadMe file and the SDK generator script.
Note: if you plan to create SDKs from this specification, you will first have to install the openapi-generator
If you choose to do so using
npm
, you will additionally have to rename the created executableopenapi-generator-cli
toopenapi-generator
- as that is the name expected by the Python script in this repository
Finally, you will also have to install YAML support for Python, e.g. using
pip install pyyaml
Currently, the generator script only supports
javascript
andnode
as targets
OpenAPI Generator uses mustache templates to generate code — the files in the sdk-template-overrides
folder override the corresponding built-in template files with small edits required for the OpenAI SDKs. More detail on each currently generated SDK is provided below.
$ python scripts/generate_sdk.py -s javascript -o openai-js
$ python scripts/generate_sdk.py -s node -o openai-node
- The
operationId
of each operation is used as the function name for that operation - The
tag
determines the name of the Javascript class that contains that operation schema
names map to Typescript type names