Hi and welcome Carolina,
There is a Python library available for interacting with the OpenRefine API at
https://github.com/opencultureconsulting/openrefine-client (although be aware that the purpose of the OpenRefine API is to enable the OpenRefine UI (running in a browser) to communicate with the OpenRefine Java application - so use of the API through other means isn't specifically supported by the project, although it is certainly possible).
I'm not sure exactly how you are hoping to use OpenRefine here, but be aware that the clustering tools in OpenRefine are designed to run against data in an OpenRefine project, so the only way I'm aware you could use them via python and the API would be to use this to:
1. Create an OpenRefine project based on the data you need to cluster
2. Computer a cluster on a column in the project you've created (using whichever clustering method suits you)
The commands for doing this using the Python Client library I mention above are documented with examples at
https://github.com/opencultureconsulting/openrefine-client#option-3-the-upstream-way (note I believe the Python client library is Python 2 rather than Python 3). If you'd prefer not to use the python client library you could of course create your own code for interacting with the API - but the overall method would be the same - create a project then compute clusters on columns in that project.
I hope this is of some help
Owen