openai-openapi icon indicating copy to clipboard operation
openai-openapi copied to clipboard

OpenAPI document missing the security scheme definition

Open justinyoo opened this issue 2 years ago • 3 comments

According to the Authorization section of the API document, to make an API call it requires one mandatory Authorization header and an optional OpenAI-Organization header.

As both are missing in the OpenAPI document, they need to be added. Here are examples:

...
paths:
  ...
  /models:
    get:
      operationId: listModels
      tags:
        - OpenAI
      summary: Lists the currently available models, and provides basic information about each one such as the owner and availability.
      # add optional header parameter like below
      parameters:
        - in: header
          name: OpenAI-Organization
          required: false
          schema:
            type: string
            example:
              org-hP479gBqdEuqjgkVyFPZ5g5h
          description: For users who belong to multiple organizations, you can pass a header to specify which organization is used for an API request. Usage from these API requests will count against the specified organization's subscription quota.
...
# global authorization
security:
  - api_key: []

components:
  # authorization scheme
  securitySchemes:
    api_key:
      type: 'http'
      scheme: 'bearer'
      bearerFormat: 'Bearer'
...

justinyoo avatar Mar 10 '23 06:03 justinyoo

Thanks @justinyoo, I would also like to see these two things added.

#12 partially solves this (Adds the AuthorizationsecurityScheme).

Adding the OpenAI-Organization Header Parameter to all endpoints would also be great.

thejamescollins avatar Mar 10 '23 06:03 thejamescollins

@om4james I've created a PR for this issue at #26 which has broader coverage than the other two #10 and #12

justinyoo avatar Mar 10 '23 07:03 justinyoo

Was about to ask the same thing, good to see someone already thought about it. Can't wait for it to be merged

MarianSWA avatar Mar 10 '23 23:03 MarianSWA

Security schema is now fixed, the org ID will take a bit more work but is on my radar! Thanks again for flagging.

logankilpatrick avatar Sep 06 '23 01:09 logankilpatrick