(e: APICallError)
| 21 | } |
| 22 | |
| 23 | function isOpenAiErrorRetryable(e: APICallError) { |
| 24 | const status = e.statusCode |
| 25 | if (!status) return e.isRetryable |
| 26 | // openai sometimes returns 404 for models that are actually available |
| 27 | return status === 404 || e.isRetryable |
| 28 | } |
| 29 | |
| 30 | // Providers not reliably handled in this function: |
| 31 | // - z.ai: can accept overflow silently (needs token-count/context-window checks) |