Add null checks for OR pricing

This commit is contained in:
Cohee
2023-11-12 13:07:57 +02:00
parent 86caffb1c6
commit 4c0b3fb7ae
2 changed files with 2 additions and 2 deletions

View File

@@ -2743,7 +2743,7 @@ app.post("/getstatus_openai", jsonParser, async function (request, response_gets
data.data.forEach(model => {
const context_length = model.context_length;
const tokens_dollar = Number(1 / (1000 * model.pricing.prompt));
const tokens_dollar = Number(1 / (1000 * model.pricing?.prompt));
const tokens_rounded = (Math.round(tokens_dollar * 1000) / 1000).toFixed(0);
models[model.id] = {
tokens_per_dollar: tokens_rounded + 'k',