🚀 feat: Add OPENAI_ORGANIZATION for all OpenAI Requests (#1590)

This commit is contained in:
Danny Avila 2024-01-18 20:39:30 -05:00 committed by GitHub
parent 7e2e19a134
commit a7c54573c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 17 additions and 0 deletions

View file

@ -53,6 +53,10 @@ const fetchModels = async ({ apiKey, baseURL, name = 'OpenAI', azure = false })
payload.httpsAgent = new HttpsProxyAgent(PROXY);
}
if (process.env.OPENAI_ORGANIZATION && baseURL.includes('openai')) {
payload.headers['OpenAI-Organization'] = process.env.OPENAI_ORGANIZATION;
}
const res = await axios.get(`${baseURL}${azure ? '' : '/models'}`, payload);
models = res.data.data.map((item) => item.id);
} catch (err) {