update OpenAIComp to include additional headers for OpenRouter API requests. see #401
This commit is contained in:
parent
700b4d5878
commit
ca29885aa4
1 changed files with 5 additions and 0 deletions
|
|
@ -41,6 +41,11 @@ export class OpenAIComp {
|
|||
"Content-Type": "application/json",
|
||||
};
|
||||
if(this.apiKey !== '') curr_headers["Authorization"] = "Bearer "+ this.apiKey;
|
||||
|
||||
if(this.host.includes('openrouter.ai')) {
|
||||
curr_headers['HTTP-Referer'] = 'https://micz.it/thunderbird-addon-thunderai/';
|
||||
curr_headers['X-Title'] = 'ThunderAI';
|
||||
}
|
||||
|
||||
const response = await fetch(this.host + (this.use_v1 ? "/v1" : "") + "/models", {
|
||||
method: "GET",
|
||||
|
|
|
|||
Loading…
Reference in a new issue