Skip to content

Commit ba6fd51

Browse files
authored
Update README.md
1 parent ee9424e commit ba6fd51

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

README.md

+22
Original file line numberDiff line numberDiff line change
@@ -165,3 +165,25 @@ func main() {
165165
}
166166
```
167167
</details>
168+
169+
<details>
170+
<summary>Configuring proxy</summary>
171+
172+
```go
173+
config := openai.DefaultConfig("token")
174+
proxyUrl, err := url.Parse("http://localhost:{port}")
175+
if err != nil {
176+
panic(err)
177+
}
178+
transport := &http.Transport{
179+
Proxy: http.ProxyURL(proxyUrl),
180+
}
181+
config.HTTPClient = &http.Client{
182+
Transport: transport,
183+
}
184+
185+
c := openai.NewClientWithConfig(config)
186+
```
187+
188+
See also: https://pkg.go.dev/github.com/sashabaranov/go-openai#ClientConfig
189+
</details>

0 commit comments

Comments
 (0)