openapi: 3.1.0 info: # Do not change the title, if the title changes, the import paths will be broken title: Api version: 0.1.0 description: API specification servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: openai description: OpenAI AI chat, image, and audio operations paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check description: Returns server health status responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /openai/conversations: get: operationId: listOpenaiConversations tags: [openai] summary: List all conversations responses: "200": description: List of conversations content: application/json: schema: type: array items: $ref: "#/components/schemas/OpenaiConversation" post: operationId: createOpenaiConversation tags: [openai] summary: Create a new conversation requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/OpenaiConversationInput" responses: "201": description: Created conversation content: application/json: schema: $ref: "#/components/schemas/OpenaiConversation" /openai/conversations/{id}: get: operationId: getOpenaiConversation tags: [openai] summary: Get conversation with messages parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Conversation with messages content: application/json: schema: $ref: "#/components/schemas/OpenaiConversationWithMessages" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/OpenaiError" delete: operationId: deleteOpenaiConversation tags: [openai] summary: Delete a conversation parameters: - name: id in: path required: true schema: type: integer responses: "204": description: Deleted "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/OpenaiError" /openai/conversations/{id}/messages: get: operationId: listOpenaiMessages tags: [openai] summary: List messages in a conversation parameters: - name: id in: path required: true schema: type: integer responses: "200": description: List of messages content: application/json: schema: type: array items: $ref: "#/components/schemas/OpenaiMessage" post: operationId: sendOpenaiMessage tags: [openai] summary: Send a text message and receive a streaming text response parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/OpenaiMessageInput" responses: "200": description: SSE stream of assistant text chunks content: text/event-stream: {} /openai/conversations/{id}/voice-messages: post: operationId: sendOpenaiVoiceMessage tags: [openai] summary: Send audio and receive a streaming voice response parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/OpenaiVoiceMessageInput" responses: "200": description: SSE stream of transcript and audio chunks content: text/event-stream: {} /openai/generate-image: post: operationId: generateOpenaiImage tags: [openai] summary: Generate an image from a text prompt requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/OpenaiImageInput" responses: "200": description: Generated image data content: application/json: schema: $ref: "#/components/schemas/OpenaiImageOutput" components: schemas: HealthStatus: type: object properties: status: type: string required: - status OpenaiConversation: type: object properties: id: type: integer title: type: string createdAt: type: string format: date-time required: - id - title - createdAt OpenaiMessage: type: object properties: id: type: integer conversationId: type: integer role: type: string content: type: string createdAt: type: string format: date-time required: - id - conversationId - role - content - createdAt OpenaiConversationInput: type: object properties: title: type: string required: - title OpenaiMessageInput: type: object properties: content: type: string required: - content OpenaiVoiceMessageInput: type: object properties: audio: type: string description: Base64-encoded audio data required: - audio OpenaiConversationWithMessages: type: object properties: id: type: integer title: type: string createdAt: type: string format: date-time messages: type: array items: $ref: "#/components/schemas/OpenaiMessage" required: - id - title - createdAt - messages OpenaiImageInput: type: object properties: prompt: type: string size: type: string enum: ["1024x1024", "512x512", "256x256"] required: - prompt OpenaiImageOutput: type: object properties: b64_json: type: string required: - b64_json OpenaiError: type: object properties: error: type: string required: - error