Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Decision model: OpenAI-compatible chat protocol for custom endpoints

Bugfixer 2d9ee8f43336c
diff --git a/docs/decision-model.md b/docs/decision-model.md
index ac99ad8fb8..5a68e192be 100644
--- a/docs/decision-model.md
+++ b/docs/decision-model.md
@@ -84,6 +84,15 @@ A failed decision falls back as described in "It fails open".
ordered `questions` list (`predicate`, `choice` with `choices`, `score`
with `levels`) to `{base URL}/decisions`, with `stream: false`, and reads
`answers` by position.
+ - **OpenAI-compatible chat** posts a chat completion to
+ `{base URL}/chat/completions` with `temperature: 0` and a strict JSON
+ schema (`response_format` `json_schema`), the same request an OpenRouter
+ chat model gets minus OpenRouter's own `provider` option, and reads the
+ answers from the reply's message. Any server that honours JSON schema works,
+ for example Gemini's OpenAI-compatible endpoint
+ (`https://generativelanguage.googleapis.com/v1beta/openai`, model
+ `gemini-2.5-flash`) or a local one. Chat models are not calibrated like
+ decision models, so their probabilities are rougher: use **Test** first.
Answers go through the same checks as every other provider's. A custom
endpoint decides only: it does not read mail or a bot's `extract` calls,
@@ -325,9 +334,10 @@ API is alpha at OpenRouter and may change. The model list comes from
`GET /api/decider/models`, which needs no key and spends nothing.
`customBaseUrl` follows the same https-or-loopback rule, and a custom key is
-used only with one. `customApi` is `"systemone"` (the default) or
-`"decisions"`; requests go to `{customBaseUrl}/systemone` or
-`{customBaseUrl}/decisions` with `customModel` as the model.
+used only with one. `customApi` is `"systemone"` (the default),
+`"decisions"` or `"chat"`; requests go to `{customBaseUrl}/systemone`,
+`{customBaseUrl}/decisions` or `{customBaseUrl}/chat/completions` with
+`customModel` as the model.
`workersAiAccountId` is 32 hexadecimal characters. `workersAiBaseUrl` has no
Settings UI and follows the same https-or-loopback rule. It is the REST root
diff --git a/server/app-settings/registry-config.ts b/server/app-settings/registry-config.ts
index c63c6d8142..a66687426a 100644
--- a/server/app-settings/registry-config.ts
+++ b/server/app-settings/registry-config.ts
@@ -53,7 +53,7 @@ export function configEntries(deps: Pick<RegistryDeps, "cfg" | "saveConfig" | "b
synonyms: ["decision", "extraction", "routing", "who answers", "jev", "openrouter", "workers ai", "cloudflare", "custom endpoint", "system one"],
// Security: a custom endpoint's address is where its key goes, so only the person sets it.
value: nonEmpty(withoutKeys(F.decider.unwrap().omit({ key: true, openrouterKey: true, workersAiToken: true, customKey: true, customBaseUrl: true }).strict())),
- allowed: '{"enabled"?,"provider"?:"jev"|"openrouter"|"custom"|"off","openrouterModel"?,"openrouterApi"?:"chat"|"decisions","customModel"?,"customApi"?:"systemone"|"decisions","jobs"?:{"roomRouting"?,"inboxTriage"?},"workersAiAccountId"?, addresses?}',
+ allowed: '{"enabled"?,"provider"?:"jev"|"openrouter"|"custom"|"off","openrouterModel"?,"openrouterApi"?:"chat"|"decisions","customModel"?,"customApi"?:"systemone"|"decisions"|"chat","jobs"?:{"roomRouting"?,"inboxTriage"?},"workersAiAccountId"?, addresses?}',
current: () => cfg().decider ?? {}, patch: (decider) => ({ decider }),
says: (decider) => `Decision and extraction: ${fields(decider)}. Decisions send conversation text to the chosen provider, off this computer`,
}),
diff --git a/server/decider/config.ts b/server/decider/config.ts
index 7cf53c24eb..291da55274 100644
--- a/server/decider/config.ts
+++ b/server/decider/config.ts
@@ -37,7 +37,7 @@ export const deciderConfigSchema = z.object({
.refine((value) => !value || /^https?:\/\//i.test(value), "the custom endpoint address must start with http:// or https://")
.optional(),
customModel: z.string().trim().max(CUSTOM_MODEL_ID_MAX).optional(),
- customApi: z.enum(["systemone", "decisions"]).optional(),
+ customApi: z.enum(["systemone", "decisions", "chat"]).optional(),
workersAiToken: optionalText,
workersAiAccountId: z.string().trim().refine((value) => !value || WORKERS_AI_ACCOUNT_ID.test(value), "a Cloudflare account ID is 32 letters and digits").optional(),
workersAiBaseUrl: z
@@ -74,11 +74,11 @@ export interface DeciderConfig {
provider?: "jev" | "openrouter" | "custom" | "off";
key?: string;
customKey?: string;
- /** The gateway's root, e.g. `https://gateway.example.com/v1`: requests go to `{customBaseUrl}/systemone` or `/decisions`. */
+ /** The gateway's root, e.g. `https://gateway.example.com/v1`: requests go to `{customBaseUrl}/systemone`, `/decisions` or `/chat/completions`. */
customBaseUrl?: string;
customModel?: string;
/** Absent is `systemone`. */
- customApi?: "systemone" | "decisions";
+ customApi?: "systemone" | "decisions" | "chat";
baseUrl?: string;
openrouterKey?: string;
openrouterModel?: string;
diff --git a/server/decider/custom.test.ts b/server/decider/custom.test.ts
index 28d94d3094..1708af0ee0 100644
--- a/server/decider/custom.test.ts
+++ b/server/decider/custom.test.ts
@@ -6,7 +6,7 @@ import { createDecider, deciderAccount, deciderPatchKey, deciderSavePatch, descr
const KEY = "gw-unit-secret-key";
const BASE = "https://gateway.example.com/v1";
const MODEL = "decision-model-1";
-const ON = (api: "systemone" | "decisions"): AppConfig => ({
+const ON = (api: "systemone" | "decisions" | "chat"): AppConfig => ({
decider: { enabled: true, provider: "custom", customKey: KEY, customBaseUrl: BASE, customModel: MODEL, customApi: api },
});
const QUESTIONS = {
@@ -82,6 +82,41 @@ describe("a custom decision endpoint", () => {
});
});
+ it("speaks OpenAI-compatible chat: strict JSON from {base}/chat/completions, with nothing only OpenRouter reads", async () => {
+ const content = JSON.stringify({
+ answers: {
+ wants_refund: { noul: 0.98 },
+ queue: { choice: "billing", probabilities: { billing: 0.9, technical: 0.03, other: 0.07 } },
+ urgency: { score: 1.7, probabilities: { 0: 0.05, 1: 0.2, 2: 0.75 } },
+ },
+ });
+ const { fetchImpl, result } = run(ON("chat"), reply({
+ model: MODEL, choices: [{ message: { role: "assistant", content } }], usage: { prompt_tokens: 140, completion_tokens: 40 },
+ }));
+ expect(await result).toMatchObject({
+ ok: true, provider: "custom", inputTokens: 140, model: MODEL,
+ answers: { wants_refund: { p: 0.98 }, queue: { choice: "billing", pTop: 0.9 }, urgency: { score: 1.7, level: 2 } },
+ });
+ const [url, init] = fetchImpl.mock.calls[0]!;
+ expect(String(url)).toBe(`${BASE}/chat/completions`);
+ expect(init).toMatchObject({ method: "POST", redirect: "error", headers: { authorization: `Bearer ${KEY}` } });
+ const body = JSON.parse(String(init?.body));
+ expect(body).toMatchObject({
+ model: MODEL, temperature: 0,
+ response_format: { type: "json_schema", json_schema: { strict: true } },
+ messages: [{ role: "system" }, { role: "user" }],
+ });
+ expect(body).not.toHaveProperty("provider");
+ expect(JSON.stringify(init?.headers)).not.toContain("openrouter");
+ });
+
+ it("refuses a chat reply that is not the answers JSON", async () => {
+ const say = (content: unknown) => reply({ choices: [{ message: { role: "assistant", content } }] });
+ expect(await run(ON("chat"), say("Sure! The queue is billing.")).result).toMatchObject({ ok: false, reason: "malformed" });
+ expect(await run(ON("chat"), say(JSON.stringify({ answers: { wants_refund: { noul: 0.9 } } }))).result).toMatchObject({ ok: false, reason: "malformed" });
+ expect(await run(ON("chat"), reply({ choices: [] })).result).toMatchObject({ ok: false, reason: "malformed" });
+ });
+
it("refuses /decisions answers out of order or short", async () => {
const swapped = [DECISIONS_ANSWERS[1], DECISIONS_ANSWERS[0], DECISIONS_ANSWERS[2]];
expect(await run(ON("decisions"), reply({ answers: swapped })).result).toMatchObject({ ok: false, reason: "malformed" });
@@ -118,6 +153,10 @@ describe("a custom decision endpoint", () => {
expect(deciderPatchKey({ customKey: "new" }, ON("decisions").decider)).toEqual({
provider: "custom", check: { key: "new", provider: "custom", api: "decisions", model: MODEL },
});
+ expect(deciderPatchKey({ customKey: "new" }, ON("chat").decider)).toEqual({
+ provider: "custom", check: { key: "new", provider: "custom", api: "chat", model: MODEL },
+ });
+ expect(describeDecider(ON("chat"))).toMatchObject({ provider: "custom", api: "chat", configured: true });
expect(deciderSavePatch({ customKey: "new" }, { customBaseUrl: BASE })).toMatchObject({ ok: true, patch: { enabled: true } });
expect(deciderSavePatch({ customKey: "new" }, {})).toMatchObject({ ok: false, errorKey: "serverError.decider.baseUrlRequired" });
expect(deciderSavePatch({ customKey: "" }, ON("systemone").decider)).toMatchObject({ ok: true, patch: { enabled: false } });
diff --git a/server/decider/custom.ts b/server/decider/custom.ts
index 2ac9d52874..18ed21d54b 100644
--- a/server/decider/custom.ts
+++ b/server/decider/custom.ts
@@ -3,12 +3,24 @@
import type { BackendRequest, BackendResult, CustomApi, DeciderBackend, DeciderQuestion } from "./types.ts";
import { keySafeUrl } from "../provider-key-check.ts";
import { jevRequestBody, parseJevResponse, questionsFit, refusal } from "./jev.ts";
+import { chatRequestBody, parseChatResponse } from "./openrouter.ts";
export const CUSTOM_DEFAULT_API: CustomApi = "systemone";
+const CUSTOM_PATH: Record<CustomApi, string> = { systemone: "systemone", decisions: "decisions", chat: "chat/completions" };
+
+/** A saved or requested protocol, or the default for anything else. */
+export const customApiOf = (api: unknown): CustomApi =>
+ api === "decisions" || api === "chat" ? api : CUSTOM_DEFAULT_API;
+
/** Null without a base URL, or when the key must not be sent there. */
export function customEndpoint(baseUrl: string | undefined, api: CustomApi): URL | null {
- return baseUrl?.trim() ? keySafeUrl(baseUrl, api) : null;
+ return baseUrl?.trim() ? keySafeUrl(baseUrl, CUSTOM_PATH[api]) : null;
+}
+
+function requestBody(api: CustomApi, state: unknown, questions: Record<string, DeciderQuestion>, model: string) {
+ if (api === "decisions") return decisionsBody(state, questions, model);
+ return api === "chat" ? chatRequestBody(state, questions, model) : systemOneBody(state, questions, model);
}
export function systemOneBody(state: unknown, questions: Record<string, DeciderQuestion>, model: string) {
@@ -70,7 +82,7 @@ export function parseDecisionsResponse(body: unknown, questions: Record<string,
}
async function decide(request: BackendRequest): Promise<BackendResult> {
- const api: CustomApi = request.api === "decisions" ? "decisions" : CUSTOM_DEFAULT_API;
+ const api = customApiOf(request.api);
const endpoint = customEndpoint(request.baseUrl, api);
const model = request.model?.trim();
if (!endpoint || !model || !questionsFit(request.questions)) return { ok: false, reason: "misconfigured" };
@@ -79,9 +91,7 @@ async function decide(request: BackendRequest): Promise<BackendResult> {
response = await request.fetch(endpoint, {
method: "POST",
headers: { authorization: `Bearer ${request.key}`, "content-type": "application/json", accept: "application/json" },
- body: JSON.stringify(api === "decisions"
- ? decisionsBody(request.state, request.questions, model)
- : systemOneBody(request.state, request.questions, model)),
+ body: JSON.stringify(requestBody(api, request.state, request.questions, model)),
signal: request.signal,
// Never replay the key to wherever a redirect points.
redirect: "error",
@@ -99,6 +109,7 @@ async function decide(request: BackendRequest): Promise<BackendResult> {
} catch {
return { ok: false, reason: "malformed" };
}
+ if (api === "chat") return parseChatResponse(body, request.questions);
const parsed = api === "decisions" ? parseDecisionsResponse(body, request.questions) : parseJevResponse(body, request.questions);
return parsed.ok ? parsed : { ok: false, reason: "malformed" };
}
diff --git a/server/decider/index.ts b/server/decider/index.ts
index 379b1a27f4..3a5b4a2667 100644
--- a/server/decider/index.ts
+++ b/server/decider/index.ts
@@ -6,7 +6,7 @@ import { deciderCredential } from "../included-services.ts";
import {
customAccount, helpersOn, includedAccount, jevAccount, openrouterAccount, sharedOpenRouterKey, workersAiAccount, type HelperAccount,
} from "./accounts.ts";
-import { CUSTOM_DEFAULT_API, customBackend, customEndpoint } from "./custom.ts";
+import { CUSTOM_DEFAULT_API, customApiOf, customBackend, customEndpoint } from "./custom.ts";
import { jevBackend } from "./jev.ts";
import { appendDeciderLog, stateHash } from "./log.ts";
import { OPENROUTER_DEFAULT_API, OPENROUTER_DEFAULT_MODEL, openrouterBackend } from "./openrouter.ts";
@@ -43,7 +43,7 @@ export function deciderModel(cfg: AppConfig): string {
}
export function customDeciderApi(cfg: AppConfig): CustomApi {
- return cfg.decider?.customApi === "decisions" ? "decisions" : CUSTOM_DEFAULT_API;
+ return customApiOf(cfg.decider?.customApi);
}
export function deciderApi(cfg: AppConfig): OpenRouterApi {
@@ -182,7 +182,7 @@ export function deciderPatchKey(
const customKey = patch.customKey?.trim();
if (customKey) {
const model = (patch.customModel ?? current?.customModel)?.trim();
- const api = (patch.customApi ?? current?.customApi) === "decisions" ? "decisions" : CUSTOM_DEFAULT_API;
+ const api = customApiOf(patch.customApi ?? current?.customApi);
return { provider: "custom", check: { key: customKey, provider: "custom", api, ...(model ? { model } : {}) } };
}
if (jevKey) return { provider: "jev", check: { key: jevKey, provider: "jev" } };
@@ -337,7 +337,7 @@ export function createDecider(deps: DeciderDeps): Decider {
const modelRequest = (cfg: AppConfig, account: HelperAccount, input: { model?: string; api?: OpenRouterApi | CustomApi } = {}) => {
if (account.provider === "custom") {
const model = input.model?.trim() || cfg.decider?.customModel?.trim();
- return { ...(model ? { model } : {}), api: input.api === "decisions" || input.api === "systemone" ? input.api : customDeciderApi(cfg) };
+ return { ...(model ? { model } : {}), api: input.api ? customApiOf(input.api) : customDeciderApi(cfg) };
}
if (account.provider !== "openrouter") return {};
return input.model?.trim() ? { model: input.model.trim(), api: input.api ?? "chat" } : { model: deciderModel(cfg), api: deciderApi(cfg) };
diff --git a/server/decider/openrouter.ts b/server/decider/openrouter.ts
index 2dbe8f67f8..4f64e3dda5 100644
--- a/server/decider/openrouter.ts
+++ b/server/decider/openrouter.ts
@@ -75,7 +75,8 @@ function keyChars(questions: Record<string, DeciderQuestion>): number {
);
}
-export function openrouterRequestBody(state: unknown, questions: Record<string, DeciderQuestion>, model: string) {
+/** An OpenAI-style chat request for strict JSON answers: shared with custom gateways that speak chat. */
+export function chatRequestBody(state: unknown, questions: Record<string, DeciderQuestion>, model: string) {
return {
model,
temperature: 0,
@@ -83,7 +84,6 @@ export function openrouterRequestBody(state: unknown, questions: Record<string,
MAX_TOKENS_CEILING,
MAX_TOKENS_FLOOR + MAX_TOKENS_PER_OPTION * optionCount(questions) + MAX_TOKENS_PER_KEY_CHAR * keyChars(questions),
),
- provider: { require_parameters: true },
response_format: {
type: "json_schema",
json_schema: { name: "decision", strict: true, schema: openrouterSchema(questions) },
@@ -95,9 +95,32 @@ export function openrouterRequestBody(state: unknown, questions: Record<string,
};
}
+export function openrouterRequestBody(state: unknown, questions: Record<string, DeciderQuestion>, model: string) {
+ return { ...chatRequestBody(state, questions, model), provider: { require_parameters: true } };
+}
+
const isRecord = (value: unknown): value is Record<string, unknown> =>
Boolean(value) && typeof value === "object" && !Array.isArray(value);
+/** A chat completion whose message is the answers JSON, read as Jev's answers. */
+export function parseChatResponse(body: unknown, questions: Record<string, DeciderQuestion>): BackendResult {
+ let answered: unknown;
+ try {
+ const content = isRecord(body) && Array.isArray(body.choices) && isRecord(body.choices[0]) && isRecord(body.choices[0].message)
+ ? body.choices[0].message.content
+ : undefined;
+ answered = typeof content === "string" ? JSON.parse(content) : undefined;
+ } catch {
+ return { ok: false, reason: "malformed" };
+ }
+ const parsed = parseJevResponse(answered, questions);
+ if (!parsed.ok || !isRecord(body)) return { ok: false, reason: "malformed" };
+ const promptTokens = isRecord(body.usage) ? body.usage.prompt_tokens : undefined;
+ const inputTokens = typeof promptTokens === "number" && Number.isFinite(promptTokens) && promptTokens >= 0 ? promptTokens : undefined;
+ const model = typeof body.model === "string" && body.model.length <= MODEL_ECHO_MAX ? body.model : undefined;
+ return { ok: true, answers: parsed.answers, ...(inputTokens !== undefined ? { inputTokens } : {}), ...(model ? { model } : {}) };
+}
+
export function openrouterDecisionsBody(state: unknown, questions: Record<string, DeciderQuestion>, model: string) {
return { ...jevRequestBody(state, questions), model };
}
@@ -132,26 +155,14 @@ async function decide(request: BackendRequest): Promise<BackendResult> {
return refusal(response.status);
}
let body: unknown;
- let answered: unknown;
try {
body = await response.json();
- if (decisions) {
- const parsed = parseJevResponse(body, request.questions);
- return parsed.ok ? parsed : { ok: false, reason: "malformed" };
- }
- const content = isRecord(body) && Array.isArray(body.choices) && isRecord(body.choices[0]) && isRecord(body.choices[0].message)
- ? body.choices[0].message.content
- : undefined;
- answered = typeof content === "string" ? JSON.parse(content) : undefined;
} catch {
return { ok: false, reason: "malformed" };
}
- const parsed = parseJevResponse(answered, request.questions);
- if (!parsed.ok || !isRecord(body)) return { ok: false, reason: "malformed" };
- const promptTokens = isRecord(body.usage) ? body.usage.prompt_tokens : undefined;
- const inputTokens = typeof promptTokens === "number" && Number.isFinite(promptTokens) && promptTokens >= 0 ? promptTokens : undefined;
- const model = typeof body.model === "string" && body.model.length <= MODEL_ECHO_MAX ? body.model : undefined;
- return { ok: true, answers: parsed.answers, ...(inputTokens !== undefined ? { inputTokens } : {}), ...(model ? { model } : {}) };
+ if (!decisions) return parseChatResponse(body, request.questions);
+ const parsed = parseJevResponse(body, request.questions);
+ return parsed.ok ? parsed : { ok: false, reason: "malformed" };
}
export const openrouterBackend: DeciderBackend = { id: "openrouter", decide };
diff --git a/server/decider/types.ts b/server/decider/types.ts
index 33b06c9f3a..a11c0dd243 100644
--- a/server/decider/types.ts
+++ b/server/decider/types.ts
@@ -4,8 +4,9 @@ export type DeciderProvider = "jev" | "workersai" | "openrouter" | "custom";
/** chat: a chat model asked for strict JSON; decisions: OpenRouter's Decisions API (output modality `decisions`). */
export type OpenRouterApi = "chat" | "decisions";
-/** A custom gateway's protocol: systemone is `POST {base}/systemone` (Jev's shape), decisions is `POST {base}/decisions`. */
-export type CustomApi = "systemone" | "decisions";
+/** A custom gateway's protocol: systemone is `POST {base}/systemone` (Jev's shape), decisions is `POST {base}/decisions`,
+ * chat is `POST {base}/chat/completions` (any OpenAI-compatible server, such as Gemini's, asked for strict JSON). */
+export type CustomApi = "systemone" | "decisions" | "chat";
export type DeciderJob = "roomRouting" | "inboxTriage";
export const DECIDER_JOBS: readonly DeciderJob[] = ["roomRouting", "inboxTriage"];
diff --git a/src/components/DecisionModelSettings.test.ts b/src/components/DecisionModelSettings.test.ts
index 3800bc9a6c..82bf5d4603 100644
--- a/src/components/DecisionModelSettings.test.ts
+++ b/src/components/DecisionModelSettings.test.ts
@@ -47,6 +47,7 @@ function render() {
job: byTestId("decider-job-roomRouting")[0]!,
provider: byTestId("decider-provider")[0],
model: byTestId("decider-model")[0],
+ customApi: byTestId("decider-custom-api")[0],
save: byTestId("decider-save")[0]!,
test: byTestId("decider-test")[0]!,
manage: byTestId("decider-manage-keys")[0],
@@ -130,6 +131,18 @@ describe("DecisionModelSettings", () => {
expect(deciderFailureText({ reason: "http_error", status: 500 }, false, "custom")).toBe("Your endpoint sent back an error (500).");
});
+ it("offers OpenAI-compatible chat as a custom endpoint protocol and saves it", async () => {
+ fixture.config = status({ provider: "custom", model: "gemini-2.5-flash", api: "chat", baseUrl: "https://generativelanguage.googleapis.com/v1beta/openai", configured: true, enabled: true, jobs: { roomRouting: true } });
+ const view = render();
+ expect(optionsOf(view.customApi!)).toEqual(["systemone", "decisions", "chat"]);
+ expect(view.customApi!.props.value).toBe("chat");
+ expect(view.html).toContain("OpenAI-compatible chat");
+ fixture.api.mockResolvedValue(fixture.config);
+ change(view.customApi!, "chat");
+ await flush();
+ expect(fixture.api).toHaveBeenCalledWith("/api/config", { method: "PUT", body: JSON.stringify({ decider: { customApi: "chat" } }) });
+ });
+
it("lists only the jobs that work: no coming-soon rows", () => {
const view = render();
for (const label of ["Browser clicks", "Tool selection", "Where work runs", "Coming soon"]) expect(view.html).not.toContain(label);
diff --git a/src/components/DecisionModelSettings.tsx b/src/components/DecisionModelSettings.tsx
index 6fc35c85ac..566f5a159b 100644
--- a/src/components/DecisionModelSettings.tsx
+++ b/src/components/DecisionModelSettings.tsx
@@ -9,6 +9,9 @@ import { Select } from "./Select";
import { WorkersAiKeyCard } from "./WorkersAiKeyCard";
import { openKeySettings } from "./keys/key-focus";
+type CustomApi = "systemone" | "decisions" | "chat";
+const customApiOf = (api: string | undefined): CustomApi => (api === "decisions" || api === "chat" ? api : "systemone");
+
const KEY_URL = { jev: "https://typesafe.ai", openrouter: "https://openrouter.ai/keys" } as const;
const KEY_SLOT = {
jev: { credential: "jevApiKey", field: "key" },
@@ -205,7 +208,7 @@ export function DecisionModelSettings() {
return () => { cancelled = true; };
}, [openrouter, models]);
- const choose = (decision: { provider: Provider } | { openrouterModel: string; openrouterApi: "chat" | "decisions" } | { customApi: "systemone" | "decisions" }) => {
+ const choose = (decision: { provider: Provider } | { openrouterModel: string; openrouterApi: "chat" | "decisions" } | { customApi: CustomApi }) => {
setValue("");
setVerdict(null);
void patch(decision);
@@ -317,13 +320,14 @@ export function DecisionModelSettings() {
<SettingRow title={t("decider.custom.api")}>
<Select
data-testid="decider-custom-api"
- value={decider?.api === "decisions" ? "decisions" : "systemone"}
- onChange={(event) => choose({ customApi: event.target.value === "decisions" ? "decisions" : "systemone" })}
+ value={customApiOf(decider?.api)}
+ onChange={(event) => choose({ customApi: customApiOf(event.target.value) })}
disabled={switching}
aria-label={t("decider.custom.api")}
>
<option value="systemone">{t("decider.custom.api.systemone")}</option>
<option value="decisions">{t("decider.custom.api.decisions")}</option>
+ <option value="chat">{t("decider.custom.api.chat")}</option>
</Select>
</SettingRow>
</>
diff --git a/src/locales/en.json b/src/locales/en.json
index b68de68e59..c492687607 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -4175,13 +4175,14 @@
"decider.custom.master": "Use your endpoint for fast decisions",
"decider.custom.masterNeedsKey": "Save a base URL and a key below to turn this on.",
"decider.custom.baseUrl": "Base URL",
- "decider.custom.baseUrlDetail": "Requests go to this address plus /systemone or /decisions. Use https, or http to this machine. Your endpoint decides only; it does not read mail.",
+ "decider.custom.baseUrlDetail": "Requests go to this address plus /systemone, /decisions or /chat/completions. Use https, or http to this machine. Your endpoint decides only; it does not read mail.",
"decider.custom.baseUrlPlaceholder": "https://gateway.example.com/v1",
"decider.custom.model": "Model ID",
"decider.custom.modelPlaceholder": "The model your endpoint serves",
"decider.custom.api": "Protocol",
"decider.custom.api.systemone": "System One",
"decider.custom.api.decisions": "OpenAI Decisions",
+ "decider.custom.api.chat": "OpenAI-compatible chat",
"decider.custom.key.label": "Endpoint API key",
"decider.custom.key.placeholder": "Paste the key your endpoint expects",
"decider.custom.test.ok": "Your endpoint answered in {ms} ms.",
diff --git a/src/locales/pt-br.json b/src/locales/pt-br.json
index ed5bc36018..13b98cb28c 100644
--- a/src/locales/pt-br.json
+++ b/src/locales/pt-br.json
@@ -3982,12 +3982,13 @@
"decider.custom.masterNeedsKey": "Salve uma URL base e uma chave abaixo para ativar.",
"decider.custom.baseUrl": "URL base",
"decider.custom.baseUrlPlaceholder": "https://gateway.example.com/v1",
- "decider.custom.baseUrlDetail": "As solicitações vão para este endereço mais /systemone ou /decisions. Use https, ou http apenas para este computador. Seu endpoint só decide. Ele não lê e-mails.",
+ "decider.custom.baseUrlDetail": "As solicitações vão para este endereço mais /systemone, /decisions ou /chat/completions. Use https, ou http apenas para este computador. Seu endpoint só decide. Ele não lê e-mails.",
"decider.custom.model": "ID do modelo",
"decider.custom.modelPlaceholder": "O modelo que seu endpoint oferece",
"decider.custom.api": "Protocolo",
"decider.custom.api.systemone": "System One",
"decider.custom.api.decisions": "OpenAI Decisions",
+ "decider.custom.api.chat": "Chat compatível com OpenAI",
"decider.custom.key.label": "Chave de API do endpoint",
"decider.custom.key.placeholder": "Cole a chave que seu endpoint espera",
"decider.custom.test.ok": "Seu endpoint respondeu em {ms} ms.",
diff --git a/src/locales/source-hashes.json b/src/locales/source-hashes.json
index 346866c61e..0c5ad63aed 100644
--- a/src/locales/source-hashes.json
+++ b/src/locales/source-hashes.json
@@ -36800,13 +36800,14 @@
"decider.custom.master": "fb358a0554b30e5cbb67256d5bfbb7e5fea005ec86ea59454f2578c780e930b7",
"decider.custom.masterNeedsKey": "89db6b4605d9fa86398c2d4b80660b848f663cc2f2efdf1f7583c4e902a6861b",
"decider.custom.baseUrl": "70589413a3c9793339fcf764276727ac652fa7dfe2f15fb5671251303a52ca49",
- "decider.custom.baseUrlDetail": "c8ab9ecb22687e7208ebcb6f1a2bcd02c32b0b10890c36a790d3c642939ace58",
+ "decider.custom.baseUrlDetail": "9db506c16c3f8282c63ee248726f470a57d9b4db75a2d7646176b6f7d7978bb2",
"decider.custom.baseUrlPlaceholder": "2467c53b1babc443bf5bd26d6e2bf571499a5e6324bae883d466c67157b51c25",
"decider.custom.model": "089ef2b6dbb34fa9bb82acd6a7a001bf8859980102e4b39463bc39a9a0819491",
"decider.custom.modelPlaceholder": "3d8be4b4bb18bec3193355037111dad4e084322d1b12230620df7e75311f9b96",
"decider.custom.api": "cf0883343f4abef779b777c35764f86c9f1f4324e8b5490840245d02ad2f7c6f",
"decider.custom.api.systemone": "00903117ec9648335567de3ebeccc236a5c1efb958c2cbb81455777748c06379",
"decider.custom.api.decisions": "cae68d32fa06751079244a2f47fcfd6d7aafe3f5032f0242bc19cbb5e9abc5d7",
+ "decider.custom.api.chat": "0d2bf27ce2f0da9d769cc5b72daae5734896f549faf792976236fde58be9b95e",
"decider.custom.key.label": "2c267e43b088e304dcf795c4cfce3880853ff17ff0bf1848a0246a697ec62faa",
"decider.custom.key.placeholder": "9679ac728723e3ac12d82c91057a0a3c3a29bbd24d38862328505a0a8fde111c",
"decider.custom.test.ok": "f0c36a57aa27d1c74f62930474c06fc38155bbac04d1cb0de6d6f6560ef6ff05",