-
Notifications
You must be signed in to change notification settings - Fork 869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plz add 'proxy' option for configuration #85
Comments
Since the axios is used for requesting, you can try the following, import HttpsProxyAgent from 'https-proxy-agent'
const rst = await openai.createChatCompletion(
{
model: 'gpt-3.5-turbo',
messages: [{ role: 'user', content: 'Hello!' }]
},
{
proxy: false,
httpAgent: HttpsProxyAgent('http://proxy-host:proxy-port'),
httpsAgent: HttpsProxyAgent('http://proxy-host:proxy-port')
}
) |
There is no reliable mainland agent recommended |
Maybe you not need proxy configuration option (。・∀・)ノ゙ I also had a need to use proxy, found a import { Configuration, OpenAIApi } from 'openai';
const configuration = new Configuration({
apiKey: process.env.OPENAI_API_KEY,
basePath: `https://${process.env.OPENAI_PROXY_URL}/v1`
});
const openai = new OpenAIApi(configuration); |
I love you sooooooooooooooooooooo much! 解决了我一个多小时的问题。 |
Our upcoming v4 also has support for proxies, as documented here: https://github.com/openai/openai-node/tree/v4#configuring-an-https-agent-eg-for-proxies |
Describe the feature or improvement you're requesting
I want to break through some firewalls to access the openai api, but I don't want to affect the access speed of other services. In addition to customizing proxy rules for openai domain names, the best way is to support the configuration of request proxies, which will facilitate the overall configuration.
Additional context
No response
The text was updated successfully, but these errors were encountered: