diff --git a/src/index.ts b/src/index.ts index e2ce21c3..01ba1962 100644 --- a/src/index.ts +++ b/src/index.ts @@ -195,6 +195,7 @@ export class Anthropic extends Core.APIClient { static Anthropic = this; static HUMAN_PROMPT = '\n\nHuman:'; static AI_PROMPT = '\n\nAssistant:'; + static DEFAULT_TIMEOUT = 600000; // 10 minutes static AnthropicError = Errors.AnthropicError; static APIError = Errors.APIError; diff --git a/src/resources/completions.ts b/src/resources/completions.ts index fe9c2c0b..86e9c602 100644 --- a/src/resources/completions.ts +++ b/src/resources/completions.ts @@ -33,7 +33,7 @@ export class Completions extends APIResource { ): APIPromise | APIPromise> { return this._client.post('/v1/complete', { body, - timeout: 600000, + timeout: (this._client as any)._options.timeout ?? 600000, ...options, stream: body.stream ?? false, }) as APIPromise | APIPromise>; diff --git a/src/resources/messages.ts b/src/resources/messages.ts index e45f5b78..ebc8a3d1 100644 --- a/src/resources/messages.ts +++ b/src/resources/messages.ts @@ -34,7 +34,7 @@ export class Messages extends APIResource { ): APIPromise | APIPromise> { return this._client.post('/v1/messages', { body, - timeout: 600000, + timeout: (this._client as any)._options.timeout ?? 600000, ...options, stream: body.stream ?? false, }) as APIPromise | APIPromise>;