{
  "openapi": "3.1.0",
  "info": {
    "title": "entropiav2 - VideoDanza Generativa Agent",
    "version": "2.0.2",
    "description": "Agente ERC-8004 de Petra Synthetic. Due diligence de agentes antes de pagarles y composiciones de videodanza generativa. Pago por llamada en USDC sobre Base, sin cuenta ni API key.",
    "contact": {
      "name": "Petra Synthetic",
      "email": "dfrmnc22@gmail.com",
      "url": "https://petrasynthetic.com"
    },
    "x-guidance": "Empieza gratis con GET /v1/agent-check/preview?agent_id=<token id ERC-8004> para ver el veredicto y las banderas de un agente. Si te sirve, GET /v1/agent-check con los mismos parametros cuesta 0.02 USDC en Base y devuelve el reporte completo: servicios, metadata, reputacion, wallet y score 0-100. Para arte generativo, GET /v1/premium-composition cuesta 0.10 USDC y devuelve una composicion determinista a partir de una semilla, con descripcion poetica y texto curatorial. Las rutas pagadas responden 402 con el header Payment-Required (base64 JSON) que trae precio, red y esquema; paga con cualquier cliente x402 y reintenta con el header PAYMENT-SIGNATURE. GET /v1/contract lista rutas y precios vigentes."
  },
  "servers": [{ "url": "https://entropia.petrasynthetic.com" }],
  "paths": {
    "/v1/agent-check/preview": {
      "get": {
        "summary": "Vista gratuita de due diligence de un agente ERC-8004",
        "operationId": "agentCheckPreview",
        "tags": ["Due diligence"],
        "security": [],
        "parameters": [
          { "name": "chain", "in": "query", "required": false, "schema": { "type": "string", "default": "8453" }, "description": "Chain id EVM del agente." },
          { "name": "agent_id", "in": "query", "required": true, "schema": { "type": "string" }, "description": "Token id del agente en el Identity Registry de ERC-8004." }
        ],
        "responses": {
          "200": {
            "description": "Veredicto, banda de score y codigos de banderas.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": { "type": "boolean" },
                    "preview": { "type": "boolean" },
                    "agent": {
                      "type": "object",
                      "properties": {
                        "chain_id": { "type": "integer" },
                        "token_id": { "type": "string" },
                        "name": { "type": ["string", "null"] },
                        "active": { "type": "boolean" }
                      }
                    },
                    "verdict": { "type": "string", "enum": ["usable", "caution", "avoid"] },
                    "score_band": { "type": "string", "enum": ["80-100", "60-79", "0-59"] },
                    "flags": { "type": "array", "items": { "type": "string" } },
                    "full_report": { "type": "string" },
                    "checked_at": { "type": "string" }
                  }
                }
              }
            }
          },
          "429": { "description": "Limite gratuito alcanzado (20 por IP y dia)." }
        }
      }
    },
    "/v1/agent-check": {
      "get": {
        "summary": "Due diligence completa de un agente ERC-8004",
        "operationId": "agentCheck",
        "tags": ["Due diligence"],
        "parameters": [
          { "name": "chain", "in": "query", "required": false, "schema": { "type": "string", "default": "8453" }, "description": "Chain id EVM del agente." },
          { "name": "agent_id", "in": "query", "required": true, "schema": { "type": "string" }, "description": "Token id del agente en el Identity Registry de ERC-8004." }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "chain": { "type": "string", "description": "Chain id EVM del agente (default 8453, Base)." },
                  "agent_id": { "type": "string", "description": "Token id del agente en el Identity Registry de ERC-8004." }
                },
                "required": ["agent_id"]
              }
            }
          }
        },
        "x-payment-info": {
          "price": { "mode": "fixed", "currency": "USD", "amount": "0.02" },
          "protocols": [{ "x402": {} }]
        },
        "responses": {
          "200": {
            "description": "Reporte completo con veredicto y score.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": { "type": "boolean" },
                    "agent": {
                      "type": "object",
                      "properties": {
                        "chain_id": { "type": "integer" },
                        "token_id": { "type": "string" },
                        "name": { "type": ["string", "null"] },
                        "owner": { "type": ["string", "null"] },
                        "agent_wallet": { "type": ["string", "null"] },
                        "active": { "type": "boolean" }
                      }
                    },
                    "services": {
                      "type": "object",
                      "properties": {
                        "healthy": { "type": "integer" },
                        "total": { "type": "integer" },
                        "declared": { "type": "array", "items": { "type": "object" } }
                      }
                    },
                    "reputation": {
                      "type": "object",
                      "properties": {
                        "feedbacks": { "type": "integer" },
                        "average_score": { "type": "number" },
                        "evidence_tier": { "type": ["string", "null"] },
                        "validations": { "type": "integer" },
                        "rank": { "type": ["integer", "null"] }
                      }
                    },
                    "flags": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "code": { "type": "string" },
                          "severity": { "type": "string", "enum": ["blocker", "warning", "info"] },
                          "message": { "type": "string" }
                        }
                      }
                    },
                    "verdict": { "type": "string", "enum": ["usable", "caution", "avoid"] },
                    "score": { "type": "integer", "minimum": 0, "maximum": 100 },
                    "checked_at": { "type": "string" }
                  }
                }
              }
            }
          },
          "402": { "description": "Payment Required" }
        }
      }
    },
    "/v1/premium-composition": {
      "get": {
        "summary": "Composicion premium de videodanza generativa",
        "operationId": "premiumComposition",
        "tags": ["Creative"],
        "parameters": [
          { "name": "seed", "in": "query", "required": false, "schema": { "type": "string" }, "description": "Semilla determinista." },
          { "name": "mood", "in": "query", "required": false, "schema": { "type": "string" } },
          { "name": "gender", "in": "query", "required": false, "schema": { "type": "string" } },
          { "name": "energy", "in": "query", "required": false, "schema": { "type": "string" } },
          { "name": "perspective", "in": "query", "required": false, "schema": { "type": "string" } },
          { "name": "token_id", "in": "query", "required": false, "schema": { "type": "integer", "default": 1 } }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "seed": { "type": "string", "description": "Semilla determinista: la misma semilla produce la misma composicion." },
                  "mood": { "type": "string", "description": "Tono emocional." },
                  "gender": { "type": "string", "description": "Perspectiva de genero del cuerpo." },
                  "energy": { "type": "string", "description": "Nivel de energia." },
                  "perspective": { "type": "string", "description": "Punto de vista de la danza." },
                  "token_id": { "type": "integer", "description": "ID de token para el texto poetico." }
                }
              }
            }
          }
        },
        "x-payment-info": {
          "price": { "mode": "fixed", "currency": "USD", "amount": "0.10" },
          "protocols": [{ "x402": {} }]
        },
        "responses": {
          "200": {
            "description": "Composicion, descripcion poetica y texto curatorial.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "composition": {
                      "type": "object",
                      "properties": {
                        "seed": { "type": "string" },
                        "videoIds": { "type": "array", "items": { "type": "integer" } },
                        "musicTrack": { "type": "integer" },
                        "blendMode": { "type": "string" }
                      }
                    },
                    "poetic_description": { "type": "string" },
                    "curatorial_text": { "type": "string" },
                    "token_id": { "type": "integer" },
                    "deterministic": { "type": "boolean" }
                  }
                }
              }
            }
          },
          "402": { "description": "Payment Required" }
        }
      }
    },
    "/v1/prompt/analyze": {
      "post": {
        "summary": "Prompt que describe una imagen",
        "operationId": "promptFromImage",
        "tags": ["Creative"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "image_url": { "type": "string", "format": "uri", "description": "URL HTTPS publica de la imagen (jpg, png, webp)." }
                },
                "required": ["image_url"]
              }
            }
          }
        },
        "x-payment-info": {
          "price": { "mode": "fixed", "currency": "USD", "amount": "0.02" },
          "protocols": [{ "x402": {} }]
        },
        "responses": {
          "200": {
            "description": "Prompt, negativo y los seis campos estructurados.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "schema_version": { "type": "string" },
                    "ok": { "type": "boolean" },
                    "analysis": {
                      "type": "object",
                      "properties": {
                        "framing": { "type": "string" },
                        "gesture": { "type": "string" },
                        "light": { "type": "string" },
                        "palette": { "type": "string" },
                        "medium": { "type": "string" },
                        "camera": { "type": "string" }
                      }
                    },
                    "prompt": { "type": "string" },
                    "negative": { "type": "string" },
                    "fields_completed": { "type": "integer" },
                    "model": { "type": "string" },
                    "elapsed_ms": { "type": "integer" },
                    "note": { "type": "string" }
                  }
                }
              }
            }
          },
          "402": { "description": "Payment Required" }
        }
      }
    },
    "/v1/contract": {
      "get": {
        "summary": "Contrato del servicio: rutas, precios, redes y changelog",
        "operationId": "contract",
        "tags": ["Utility"],
        "security": [],
        "responses": {
          "200": {
            "description": "Documento con version, rutas y precios.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "service": { "type": "string" },
                    "version": { "type": "string" },
                    "api_version": { "type": "string" },
                    "updated_at": { "type": "string" },
                    "routes": { "type": "array", "items": { "type": "object" } },
                    "uptime": { "type": "object" }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/health": {
      "get": {
        "summary": "Estado del agente",
        "operationId": "health",
        "tags": ["Utility"],
        "security": [],
        "responses": {
          "200": {
            "description": "Estado.",
            "content": {
              "application/json": { "schema": { "type": "object", "properties": { "status": { "type": "string" } } } }
            }
          }
        }
      }
    }
  }
}
