You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+47-11Lines changed: 47 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -599,25 +599,61 @@ const client = new OpenAI({
599
599
Note that if given a `OPENAI_LOG=debug` environment variable, this library will log all requests and responses automatically.
600
600
This is intended for debugging purposes only and may change in the future without notice.
601
601
602
-
### Configuring an HTTP(S) Agent (e.g., for proxies)
602
+
### Fetch options
603
603
604
-
By default, this library uses a stable agent for all http/https requests to reuse TCP connections, eliminating many TCP & TLS handshakes and shaving around 100ms off most requests.
604
+
If you want to set custom `fetch` options without overriding the `fetch` function, you can provide a `fetchOptions` object when instantiating the client or making a request. (Request-specific options override client options.)
605
605
606
-
If you would like to disable or customize this behavior, for example to use the API behind a proxy, you can pass an `httpAgent` which is used for all requests (be they http or https), for example:
606
+
```ts
607
+
importOpenAIfrom'openai';
608
+
609
+
const client =newOpenAI({
610
+
fetchOptions: {
611
+
// `RequestInit` options
612
+
},
613
+
});
614
+
```
615
+
616
+
#### Configuring proxies
617
+
618
+
To modify proxy behavior, you can provide custom `fetchOptions` that add runtime-specific proxy
0 commit comments