Cancelling Openai api's request

i have implemented openai’s api to my application.Now, i want to set if response time is more than x sec
( i consider 10 seconds) i want to cancel that request and my balance not be charged for incomplete requests.How can i achieve that?(I am using spring boot for my application)

2 Likes

Before answer this question, I think should know something first. Are you using completion API or fine-tuning API?

I am using completion API instead of fine-tuning API

If you are using completion API, I think to kill request that been sent is unavailable. But if fine-tuning API, you can kill the job before been trained.

1 Like