Created
May 21, 2023 21:38
-
-
Save selalipop/0d094da25b86f93d27b7d0f7acc35832 to your computer and use it in GitHub Desktop.
OpenAI Chat Endpoint Swagger Spec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openapi: 3.0.0 | |
info: | |
title: LLM Chat API | |
version: 1.0.0 | |
servers: | |
- url: https://api.openai.com/v1 | |
paths: | |
/chat/completions: | |
post: | |
summary: Creates a model response for the given chat conversation. | |
requestBody: | |
content: | |
application/json: | |
schema: | |
type: object | |
properties: | |
model: | |
type: string | |
description: ID of the model to use. See the model endpoint compatibility table for details on which models work with the Chat API. | |
messages: | |
type: array | |
description: A list of messages describing the conversation so far. | |
items: | |
$ref: '#/components/schemas/Message' | |
minItems: 1 | |
temperature: | |
# ... | |
# Other properties as before | |
# ... | |
responses: | |
200: | |
description: successful operation | |
content: | |
application/json: | |
schema: | |
type: object | |
properties: | |
id: | |
type: string | |
example: chatcmpl-123 | |
description: The completion identifier. | |
object: | |
type: string | |
example: chat.completion | |
description: The type of the returned object. | |
created: | |
type: integer | |
example: 1677652288 | |
description: The creation timestamp of the completion. | |
choices: | |
# ... | |
# Improved descriptions for response properties here | |
# ... | |
components: | |
schemas: | |
MessageRole: | |
type: string | |
description: The role of the message author. | |
enum: ["system", "user", "assistant"] | |
Message: | |
type: object | |
properties: | |
role: | |
$ref: '#/components/schemas/MessageRole' | |
content: | |
type: string | |
description: The content of the message. | |
name: | |
type: string | |
pattern: "^[a-zA-Z0-9_]{1,64}$" | |
description: The name of the author of this message. May contain a-z, A-Z, 0-9, and underscores, with a maximum length of 64 characters. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment