diff --git a/docs/resilient-openai.md b/docs/resilient-openai.md index c0dc5b86..2623c68d 100644 --- a/docs/resilient-openai.md +++ b/docs/resilient-openai.md @@ -13,7 +13,7 @@ broader Moonbeam service. | Feature | Default | | -------------------------------------------------------- | ---------------------------------- | -| Per-request timeout | 10 s | +| Per-request timeout | 30 s | | Automatic retries with exponential backoff + full jitter | 3 retries | | `Retry-After` header honored on 429 responses | yes | | Circuit breaker | opens after 5 consecutive failures | @@ -47,7 +47,7 @@ All variables are optional. Defaults are shown. | Variable | Default | Description | | ------------------------------- | ------- | ------------------------------------------------------------- | | `FEATURE_FLAG_RESILIENT_OPENAI` | `true` | Set to `false` to bypass the wrapper entirely. | -| `OPENAI_TIMEOUT_MS` | `10000` | Maximum ms to wait for a single request before aborting. | +| `OPENAI_TIMEOUT_MS` | `30000` | Maximum ms to wait for a single request before aborting. | | `OPENAI_RETRIES` | `3` | Maximum retry attempts on transient errors. | | `OPENAI_BACKOFF_BASE_MS` | `500` | Base interval (ms) for exponential backoff with full jitter. | | `CIRCUIT_BREAKER_FAILURES` | `5` | Consecutive failures needed to open the circuit. | diff --git a/packages/backend/src/config/openai.ts b/packages/backend/src/config/openai.ts index 6616e09b..4aeeca97 100644 --- a/packages/backend/src/config/openai.ts +++ b/packages/backend/src/config/openai.ts @@ -33,7 +33,7 @@ const parseIntWithDefault = (value: string | undefined, defaultValue: number): n }; export const getOpenAIClientConfig = (): OpenAIClientConfig => ({ - timeoutMs: Math.max(1, parseIntWithDefault(process.env.OPENAI_TIMEOUT_MS, 10_000)), + timeoutMs: Math.max(1, parseIntWithDefault(process.env.OPENAI_TIMEOUT_MS, 30_000)), retries: Math.max(0, parseIntWithDefault(process.env.OPENAI_RETRIES, 3)), backoffBaseMs: Math.max(0, parseIntWithDefault(process.env.OPENAI_BACKOFF_BASE_MS, 500)), circuitBreakerFailures: Math.max(1, parseIntWithDefault(process.env.CIRCUIT_BREAKER_FAILURES, 5)),