{"openapi":"3.0.3","info":{"title":"ai-engine API","version":"1.0.0"},"components":{"schemas":{}},"paths":{"/openapi.json":{"get":{"responses":{"200":{"description":"Default Response"}}}},"/api/ai/execute/":{"post":{"summary":"Execute AI completion (plain text or structured JSON)","tags":["AI Execution"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"modelId":{"type":"string","format":"uuid"},"agentId":{"type":"string","format":"uuid"},"message":{"type":"string","minLength":1},"conversationHistory":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["user","assistant"]},"content":{"type":"string"}},"required":["role","content"],"additionalProperties":false}},"messages":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["user","assistant","system"]},"content":{"type":"string"}},"required":["role","content"],"additionalProperties":false},"minItems":1},"responseFormat":{"type":"object","properties":{"type":{"type":"string","enum":["json_schema"]},"name":{"type":"string","minLength":1},"schema":{"type":"object","additionalProperties":{}}},"required":["type","name","schema"],"additionalProperties":false},"testUserId":{"type":"string","format":"uuid"},"requestedBy":{"type":"string","format":"uuid"},"promptId":{"type":"string","format":"uuid"},"responseStyleId":{"type":"string","format":"uuid"},"source":{"type":"string","enum":["playground","api","chat","test_lab","dream_analysis"]},"systemDirective":{"type":"string","minLength":1}},"additionalProperties":false}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"response":{"type":"string"},"parsed":{"type":"object","additionalProperties":{},"nullable":true},"usage":{"type":"object","properties":{"promptTokens":{"type":"number"},"completionTokens":{"type":"number"},"durationMs":{"type":"number"}},"required":["promptTokens","completionTokens","durationMs"],"additionalProperties":false},"executionLogId":{"type":"string","format":"uuid"}},"required":["response","parsed","usage","executionLogId"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}}},"/api/ai/chat/":{"post":{"summary":"Execute AI chat (multi-turn)","tags":["AI Execution"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"modelId":{"type":"string","format":"uuid"},"agentId":{"type":"string","format":"uuid"},"message":{"type":"string","minLength":1},"conversationHistory":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["user","assistant"]},"content":{"type":"string"}},"required":["role","content"],"additionalProperties":false}},"messages":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["user","assistant","system"]},"content":{"type":"string"}},"required":["role","content"],"additionalProperties":false},"minItems":1},"responseFormat":{"type":"object","properties":{"type":{"type":"string","enum":["json_schema"]},"name":{"type":"string","minLength":1},"schema":{"type":"object","additionalProperties":{}}},"required":["type","name","schema"],"additionalProperties":false},"testUserId":{"type":"string","format":"uuid"},"requestedBy":{"type":"string","format":"uuid"},"promptId":{"type":"string","format":"uuid"},"responseStyleId":{"type":"string","format":"uuid"},"source":{"type":"string","enum":["playground","api","chat","test_lab","dream_analysis"]},"systemDirective":{"type":"string","minLength":1}},"additionalProperties":false}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"response":{"type":"string"},"parsed":{"type":"object","additionalProperties":{},"nullable":true},"usage":{"type":"object","properties":{"promptTokens":{"type":"number"},"completionTokens":{"type":"number"},"durationMs":{"type":"number"}},"required":["promptTokens","completionTokens","durationMs"],"additionalProperties":false},"executionLogId":{"type":"string","format":"uuid"}},"required":["response","parsed","usage","executionLogId"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}}},"/api/ai/stream/":{"post":{"summary":"Stream AI response (SSE)","tags":["AI Execution"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"modelId":{"type":"string","format":"uuid"},"agentId":{"type":"string","format":"uuid"},"message":{"type":"string","minLength":1},"conversationHistory":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["user","assistant"]},"content":{"type":"string"}},"required":["role","content"],"additionalProperties":false}},"messages":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["user","assistant","system"]},"content":{"type":"string"}},"required":["role","content"],"additionalProperties":false},"minItems":1},"responseFormat":{"type":"object","properties":{"type":{"type":"string","enum":["json_schema"]},"name":{"type":"string","minLength":1},"schema":{"type":"object","additionalProperties":{}}},"required":["type","name","schema"],"additionalProperties":false},"testUserId":{"type":"string","format":"uuid"},"requestedBy":{"type":"string","format":"uuid"},"promptId":{"type":"string","format":"uuid"},"responseStyleId":{"type":"string","format":"uuid"},"source":{"type":"string","enum":["playground","api","chat","test_lab","dream_analysis"]},"systemDirective":{"type":"string","minLength":1}},"additionalProperties":false}}}},"responses":{"200":{"description":"Default Response"}}}},"/api/ai/models/":{"get":{"summary":"List active models","tags":["Models (Read-Only)"],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"provider":{"type":"string"},"modelName":{"type":"string"},"isActive":{"type":"boolean"}},"required":["id","name","provider","modelName","isActive"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}}}}},"/api/ai/logs/":{"get":{"summary":"List execution logs","tags":["Execution Logs"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":100,"default":20},"in":"query","name":"limit","required":false},{"schema":{"type":"string","enum":["createdAt"],"default":"createdAt"},"in":"query","name":"sort","required":false},{"schema":{"type":"string","enum":["asc","desc"],"default":"desc"},"in":"query","name":"order","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"modelId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"agentId","required":false},{"schema":{"type":"string","enum":["playground","api","chat","test_lab","dream_analysis"]},"in":"query","name":"source","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"testUserId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"userId","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"modelId":{"type":"string","format":"uuid","nullable":true},"agentId":{"type":"string","format":"uuid","nullable":true},"provider":{"type":"string"},"model":{"type":"string"},"promptContent":{"type":"string","nullable":true},"styleInstruction":{"type":"string","nullable":true},"userMessage":{"type":"string"},"assistantMessage":{"type":"string","nullable":true},"promptTokens":{"type":"number","nullable":true},"completionTokens":{"type":"number","nullable":true},"durationMs":{"type":"number","nullable":true},"source":{"type":"string"},"requestedBy":{"type":"string","format":"uuid","nullable":true},"testUserId":{"type":"string","format":"uuid","nullable":true},"error":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["id","modelId","agentId","provider","model","promptContent","styleInstruction","userMessage","assistantMessage","promptTokens","completionTokens","durationMs","source","requestedBy","testUserId","error","createdAt"],"additionalProperties":false}},"pagination":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}},"required":["page","limit","total","totalPages"],"additionalProperties":false}},"required":["data","pagination"],"additionalProperties":false}}}}}}},"/api/ai/logs/{id}":{"get":{"summary":"Get a single execution log by id","tags":["Execution Logs"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"modelId":{"type":"string","format":"uuid","nullable":true},"agentId":{"type":"string","format":"uuid","nullable":true},"provider":{"type":"string"},"model":{"type":"string"},"promptContent":{"type":"string","nullable":true},"styleInstruction":{"type":"string","nullable":true},"userMessage":{"type":"string"},"assistantMessage":{"type":"string","nullable":true},"promptTokens":{"type":"number","nullable":true},"completionTokens":{"type":"number","nullable":true},"durationMs":{"type":"number","nullable":true},"source":{"type":"string"},"requestedBy":{"type":"string","format":"uuid","nullable":true},"testUserId":{"type":"string","format":"uuid","nullable":true},"error":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"requestMessages":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["system","user","assistant"]},"content":{"type":"string"}},"required":["role","content"],"additionalProperties":false},"nullable":true},"systemDirective":{"type":"string","nullable":true},"parsedResponse":{"type":"object","additionalProperties":{},"nullable":true}},"required":["id","modelId","agentId","provider","model","promptContent","styleInstruction","userMessage","assistantMessage","promptTokens","completionTokens","durationMs","source","requestedBy","testUserId","error","createdAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}}}}}