Skip to content

Commit

Permalink
docs(readme): fix https proxy example (#310)
Browse files Browse the repository at this point in the history
  • Loading branch information
fatjyc authored and stainless-bot committed Mar 6, 2024
1 parent c7db92c commit 165f1d8
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,18 +326,24 @@ If you would like to disable or customize this behavior, for example to use the
<!-- prettier-ignore -->
```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
Expand Down

0 comments on commit 165f1d8

Please sign in to comment.