Add Synthetic provider support

This commit is contained in:
Travis Hinton
2026-01-13 00:22:03 +00:00
committed by Peter Steinberger
parent 25297ce3f5
commit 8b5cd97ceb
22 changed files with 937 additions and 2 deletions

View File

@@ -9,11 +9,15 @@ import {
applyAuthProfileConfig,
applyMinimaxApiConfig,
applyMinimaxApiProviderConfig,
applySyntheticConfig,
applySyntheticProviderConfig,
applyOpencodeZenConfig,
applyOpencodeZenProviderConfig,
applyOpenrouterConfig,
applyOpenrouterProviderConfig,
OPENROUTER_DEFAULT_MODEL_REF,
SYNTHETIC_DEFAULT_MODEL_ID,
SYNTHETIC_DEFAULT_MODEL_REF,
writeOAuthCredentials,
} from "./onboard-auth.js";
@@ -260,6 +264,56 @@ describe("applyMinimaxApiProviderConfig", () => {
});
});
describe("applySyntheticConfig", () => {
it("adds synthetic provider with correct settings", () => {
const cfg = applySyntheticConfig({});
expect(cfg.models?.providers?.synthetic).toMatchObject({
baseUrl: "https://api.synthetic.new/anthropic",
api: "anthropic-messages",
});
});
it("sets correct primary model", () => {
const cfg = applySyntheticConfig({});
expect(cfg.agents?.defaults?.model?.primary).toBe(
SYNTHETIC_DEFAULT_MODEL_REF,
);
});
it("merges existing synthetic provider models", () => {
const cfg = applySyntheticProviderConfig({
models: {
providers: {
synthetic: {
baseUrl: "https://old.example.com",
apiKey: "old-key",
api: "openai-completions",
models: [
{
id: "old-model",
name: "Old",
reasoning: false,
input: ["text"],
cost: { input: 1, output: 2, cacheRead: 0, cacheWrite: 0 },
contextWindow: 1000,
maxTokens: 100,
},
],
},
},
},
});
expect(cfg.models?.providers?.synthetic?.baseUrl).toBe(
"https://api.synthetic.new/anthropic",
);
expect(cfg.models?.providers?.synthetic?.api).toBe("anthropic-messages");
expect(cfg.models?.providers?.synthetic?.apiKey).toBe("old-key");
const ids = cfg.models?.providers?.synthetic?.models.map((m) => m.id);
expect(ids).toContain("old-model");
expect(ids).toContain(SYNTHETIC_DEFAULT_MODEL_ID);
});
});
describe("applyOpencodeZenProviderConfig", () => {
it("adds allowlist entry for the default model", () => {
const cfg = applyOpencodeZenProviderConfig({});