Add support for DreamGen API.

API docs: https://dreamgen.com/docs/models/opus/v1
API keys: https://dreamgen.com/account/api-keys

I decided to base this on the text-completion API since it's more
flexible with SillyTavern's prompt formating capabilities.

This also means that custom context and instruct settings are required.

Will add documentation in a followup PR.
This commit is contained in:
DreamGenX
2024-03-07 10:55:08 +01:00
parent bb53fef531
commit 5c410986a4
14 changed files with 223 additions and 8 deletions

View File

@ -27,6 +27,14 @@ function getInfermaticAIHeaders() {
}) : {};
}
function getDreamGenHeaders() {
const apiKey = readSecret(SECRET_KEYS.DREAMGEN);
return apiKey ? ({
'Authorization': `Bearer ${apiKey}`,
}) : {};
}
function getOpenRouterHeaders() {
const apiKey = readSecret(SECRET_KEYS.OPENROUTER);
const baseHeaders = { ...OPENROUTER_HEADERS };
@ -98,6 +106,9 @@ function setAdditionalHeaders(request, args, server) {
case TEXTGEN_TYPES.INFERMATICAI:
headers = getInfermaticAIHeaders();
break;
case TEXTGEN_TYPES.DREAMGEN:
headers = getDreamGenHeaders();
break;
case TEXTGEN_TYPES.OPENROUTER:
headers = getOpenRouterHeaders();
break;