Is it possible to run and stop an endpoint using code/API to avoid be billed when it is not used?
I want to use the HF inference endpoint for my project but, since the model will be used just few hours per day I want to launch the endpoint and stop it within the same day. Is it possible?
2023-01-23T20:54:18Z
hi@smartinezbragado, currently it’s no possible, but it’s on a short term milestone to implement it.
2023-02-17T03:47:32Z
Happy to let you know we’ve just made this possible!:Pause and Resume your EndpointYou can Pause/Resume as often as you’d like to only be billed while you need the model.
2023-02-20T22:50:28Z
Thanks@radamesand@ronvolutional. I am reading the documentations of the API and I did not find anything to pause and resume the endpoint (only downscale it to 0). Is it possible to pause/resume it through API or only manually?Thanks in advance
2023-02-22T01:48:40Z
just copying and pasting@philschmidresponse from discord herecurl --request PUT \
 --url https://api.endpoints.huggingface.cloud/endpoint/ENPOINT-NAME \
 --header 'Authorization: Bearer TOKEN' \
 --header 'Content-Type: application/json' \
 --data '{
 "compute": {
  "scaling": {
   "minReplica": 0,
   "maxReplica": 0
  }
 }
}'
2023-06-19T12:25:21Z
This does not work anymore. I get a400error.The dashboard get the exact same error when clicking on the “Stop endpoint” button.I guess it’s linked to the new “Automatic Scale-to-Zero” option.Any idea on how to pause/resume endpoints now?
2023-06-19T15:10:51Z
Hello, we’ve indeed changed the way you pause/stop an endpoint. There are two new routes,/pauseand/resume.You can check the swagger docshere, let me know if there is anything else I can do to help.