Is openai charged when returning messages or when making requests? For example, if I have a request and waited for 20 seconds without receiving a response(non-stream, maybe it is generating in the server), and then I canceled it, will I be charged? Thank you
If you are not using streaming then you will be charged for the full generation, if you are using streaming then you will be charged for the tokens you have so far received plus a small number of tokens generated while the system detects you have closed the connection, usually 7-15 tokens.
Disconnects and errors in API communications are typically considered losses unless you have a specific agreement to track and reimburse, these agreements are only typically offered to high volume users by contractual arrangement.
Thanks for your reply. So can I understand it this way? For non-stream requests, as long as the request is sent, it will be charged.
Correct, you can make the assumption that upon return of the sending API call that it is likely that the OpenAI service selected will be executed,
In reality there are a number of possible failure modes in which this will not happen, but as above, the assumption should be that the call made will be charged for.
thank you, Very clear explanation. (If the text is too short, it seems can’t sent…)