File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,9 @@ const clientOptions = {
88 // Warning: This will expose your `openaiApiKey` to a third party. Consider the risks before using this.
99 // reverseProxyUrl: 'https://chatgpt.hato.ai/completions',
1010 // (Optional) Parameters as described in https://platform.openai.com/docs/api-reference/completions
11+ // (Optional) to use Azure OpenAI API, set `azure` to true and `reverseProxyUrl` to your completion endpoint:
12+ // azure: true,
13+ // reverseProxyUrl: 'https://{your-resource-name}.openai.azure.com/openai/deployments/{deployment-id}/chat/completions?api-version={api-version}',
1114 modelOptions : {
1215 // You can override the model name and any other parameters here, like so:
1316 model : 'gpt-3.5-turbo' ,
Original file line number Diff line number Diff line change @@ -170,7 +170,10 @@ export default class ChatGPTClient {
170170 headersTimeout : 0 ,
171171 } ) ,
172172 } ;
173- if ( this . apiKey ) {
173+
174+ if ( this . apiKey && this . options . azure && this . options . reverseProxyUrl ) {
175+ opts . headers [ 'api-key' ] = this . apiKey ;
176+ } else if ( this . apiKey ) {
174177 opts . headers . Authorization = `Bearer ${ this . apiKey } ` ;
175178 }
176179
You can’t perform that action at this time.
0 commit comments