Add fallback option for OpenRouter

This commit is contained in:
Cohee
2023-08-24 03:21:17 +03:00
parent ffc8150eef
commit 4aa31fcba9
3 changed files with 27 additions and 0 deletions

View File

@ -3478,6 +3478,10 @@ app.post("/generate_openai", jsonParser, function (request, response_generate_op
// OpenRouter needs to pass the referer: https://openrouter.ai/docs
headers = { 'HTTP-Referer': request.headers.referer };
bodyParams = { 'transforms': ["middle-out"] };
if (request.body.use_fallback) {
bodyParams['route'] = 'fallback';
}
}
if (!api_key_openai && !request.body.reverse_proxy) {