openapi: 3.0.0 info: title: Chat Completion API version: 0.0.1 paths: /chat_completion/: post: summary: Submit a chat completion request description: | This endpoint allows clients to submit a chat completion request. requestBody: required: true content: application/json: schema: type: object properties: messages: type: array items: $ref: '#/components/schemas/Message' model: type: string options: $ref: '#/components/schemas/Options' n_completions: type: integer responses: '200': description: Successful response content: application/json: schema: type: object properties: id: type: string candidates: type: array items: $ref: '#/components/schemas/Completion' model_called: type: string usage: $ref: '#/components/schemas/TokenUsage' components: schemas: Message: type: object properties: role: type: string text: type: string attachments: type: array items: $ref: '#/components/schemas/MediaAttachment' eot: type: boolean description: "End of transmission flag." tool_call: type: boolean description: "Indicates if it's a tool call - builtin, custom, or ipython." is_complete: type: boolean description: "For streaming, indicates if the message is complete." is_header_complete: type: boolean description: "For streaming, indicates if the header of the message is complete." metadata: type: object additionalProperties: true description: "Additional metadata as JSON." MediaAttachment: type: object properties: attachment_type: $ref: '#/components/schemas/MediaAttachmentType' data_type: $ref: '#/components/schemas/MediaAttachmentDataType' data: type: string MediaAttachmentType: type: string enum: - image - video - audio - text description: "Type of media attachment." MediaAttachmentDataType: type: string enum: - raw_bytes - filepath - uri description: "Data type of the media attachment." Completion: type: object properties: id: type: string message: $ref: '#/components/schemas/Message' tokens: type: array items: type: integer logprobs: type: array items: type: number finish_reason: type: string enum: - stop - safety - max-length description: "Reason for completion termination." Options: type: object properties: logprobs: type: boolean max_tokens: type: integer temperature: type: number top_p: type: number TokenUsage: type: object properties: input_tokens: type: integer output_tokens: type: integer total_tokens: type: integer