From 165f1d8c6e3fdff0c165f4341e1fc7527b4fb310 Mon Sep 17 00:00:00 2001 From: Jiang Yucheng Date: Tue, 5 Mar 2024 19:05:52 +0800 Subject: [PATCH] docs(readme): fix https proxy example (#310) --- README.md | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 97b615de..e4fc0e7e 100644 --- a/README.md +++ b/README.md @@ -326,18 +326,24 @@ If you would like to disable or customize this behavior, for example to use the ```ts import http from 'http'; -import HttpsProxyAgent from 'https-proxy-agent'; +import { HttpsProxyAgent } from 'https-proxy-agent'; // Configure the default for all requests: const anthropic = new Anthropic({ httpAgent: new HttpsProxyAgent(process.env.PROXY_URL), + baseURL: 'http://localhost:8080/test-api', }); // Override per-request: -await anthropic.messages.create({ max_tokens: 1024, messages: [{ role: 'user', content: 'Hello, Claude' }], model: 'claude-3-opus-20240229' }, { - baseURL: 'http://localhost:8080/test-api', - httpAgent: new http.Agent({ keepAlive: false }), -}) +await anthropic.messages.create({ + max_tokens: 1024, + messages: [{ role: 'user', content: 'Hello, Claude' }], + model: 'claude-3-opus-20240229' + }, + { + httpAgent: new http.Agent({ keepAlive: false }), + } +) ``` ## Semantic Versioning