Cancel the OpenAI API request without deducting the cost from the balance

if I make a request to the OpenAI API for a completion and quickly abort it using an AbortController, does OpenAI still process it on the backend and deduct the cost from my balance you think?

I haven’t verified recently, verification which is hard (with billing now made intentionally opaque and without audit-quality logging), and also don’t know what your “AbortController” is, but essentially,

  • if you close() https connection on a streaming response, this communication (of no more communication) will terminate the AI generation within a few tokens;
  • if you close connection on a non-streaming API request, the request continues until it completes…and you simply aren’t there to receive it.
1 Like