{"openapi":"3.1.0","info":{"title":"ModelPilot Task API","version":"0.9.0","description":"Execution decisions and verified AI work. ModelPilot does not host or resell models."},"servers":[{"url":"https://modelpilot.andycywu.cc"}],"paths":{"/v1/tasks/execute":{"post":{"summary":"Execute and verify an AI task","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskRequest"}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecutionTaskReceipt"}}}},"201":{"description":"Created"},"401":{"description":"Missing or invalid tenant API key"}}}},"/v1/strategy/recommend":{"post":{"summary":"Preview a policy-aware execution strategy","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskRequest"}}}},"responses":{"200":{"description":"Successful response"},"201":{"description":"Created"},"401":{"description":"Missing or invalid tenant API key"}}}},"/v1/tasks/{id}":{"get":{"summary":"Retrieve tenant-scoped task evidence","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecutionTaskReceipt"}}}},"201":{"description":"Created"},"401":{"description":"Missing or invalid tenant API key"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}]}},"/v1/models":{"get":{"summary":"List model-compatible execution targets","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response"},"201":{"description":"Created"},"401":{"description":"Missing or invalid tenant API key"}}}},"/v1/targets":{"get":{"summary":"List execution targets and policy metadata","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response"},"201":{"description":"Created"},"401":{"description":"Missing or invalid tenant API key"}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"mp_live_..."}},"schemas":{"TaskRequest":{"type":"object","required":["task"],"properties":{"task":{"type":"object","required":["instruction"],"properties":{"instruction":{"type":"string"}}},"strategy":{"type":"string","enum":["auto","direct","cheap_first_escalate","plan_execute_verify","jev_first"],"default":"auto"},"requirements":{"type":"object","description":"Capability, quality SLA, privacy, risk, latency, and DataPolicy constraints."},"economics":{"type":"object","description":"Business value, maximum task budget, currency, and attribution contract."},"verification":{"type":"object","description":"Explicit success contract for the completed task."},"decision":{"type":"object","description":"Optional Jev-first controls. Real Jev calls require one typed noul, choice, or score question."}}},"JevJudgment":{"type":"object","required":["mode","status","selected_strategy","confidence","latency_ms","cost","reason"],"properties":{"mode":{"type":"string","enum":["active","shadow"]},"status":{"type":"string","enum":["selected","delegated","fallback"]},"selected_strategy":{"type":["string","null"]},"confidence":{"type":["number","null"]},"latency_ms":{"type":"number"},"cost":{"type":"number"},"reason":{"type":"string"}}},"ExecutionStep":{"type":"object","required":["sequence","role","target_type","target_id","provider","purpose"],"properties":{"sequence":{"type":"integer"},"role":{"type":"string"},"target_type":{"type":"string"},"target_id":{"type":"string"},"provider":{"type":"string"},"purpose":{"type":"string"},"run_when":{"type":"string"},"status":{"type":"string"},"latency_ms":{"type":"number"},"actual_cost":{"type":"number"}}},"ExecutionTaskReceipt":{"type":"object","required":["id","object","status","decision","execution_plan","verification","economics","usage"],"properties":{"id":{"type":"string"},"object":{"type":"string","const":"execution.task"},"status":{"type":"string","enum":["awaiting_approval","verified","unverified","failed"]},"output":{"type":"string","description":"Returned only on the immediate execution response; ModelPilot does not retain prompt or response content by default."},"decision":{"type":"object","properties":{"source":{"type":"string"},"recommended_strategy":{"type":"string"},"jev_judgment":{"$ref":"#/components/schemas/JevJudgment"}}},"execution_plan":{"type":"object","required":["id","strategy","reason","steps"],"properties":{"id":{"type":"string"},"strategy":{"type":"string"},"reason":{"type":"string"},"predicted_cost":{"type":"number"},"predicted_quality":{"type":"number"},"steps":{"type":"array","items":{"$ref":"#/components/schemas/ExecutionStep"}}}},"verification":{"type":"object","required":["type","method","passed","reason"],"properties":{"type":{"type":"string"},"method":{"type":"string"},"passed":{"type":["boolean","null"]},"reason":{"type":"string"}}},"economics":{"type":"object"},"usage":{"type":"object","required":["actual_cost","baseline_cost","estimated_savings","latency_ms","steps_executed"],"properties":{"actual_cost":{"type":"number"},"baseline_cost":{"type":"number"},"estimated_savings":{"type":"number"},"latency_ms":{"type":"number"},"steps_executed":{"type":"integer"},"cost_breakdown":{"type":"object"}}},"created_at":{"type":"string","format":"date-time"},"completed_at":{"type":["string","null"],"format":"date-time"}}}}}}