Skip to content

OpenAPI specification for the OpenAI API

License

Notifications You must be signed in to change notification settings

rozek/openai-openapi

 
 

Repository files navigation

OpenAPI spec for the OpenAI API

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 executable openapi-generator-cli to openapi-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 and node 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.

SDK Generation Examples

JavaScript

$ python scripts/generate_sdk.py -s javascript -o openai-js

Node.js

$ python scripts/generate_sdk.py -s node -o openai-node

Node.js specific details

  • 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

About

OpenAPI specification for the OpenAI API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Mustache 82.1%
  • Python 17.9%