OptionalmaxRetries after the first try. Defaults to 3.
OptionalbaseFirst backoff delay, doubled on each retry. Defaults to 1000 ms.
OptionalmaxThe longest we wait before one retry. Backoff is cut to it, and a
retry-after longer than it is not waited: the error is thrown.
Defaults to 60000 ms.
OptionaljitterAdds up to this part of the backoff delay at random. Defaults to 0.2.
OptionalrandomRandom numbers in [0, 1) for the jitter. Defaults to Math.random.
OptionalonCalled once per turn on context_too_long. It returns a smaller
request to try once more, or undefined to give up.
OptionalonCalled before each wait, so the user can see why nothing happens.
OptionalsecretsStrings that must never show in an error message, like the API key.
How withRetries retries.