Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 154 additions & 0 deletions packages/core/test/generate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,160 @@ describe("catalog generation", () => {
});
});

test("Zenifra model IDs preserve the upstream namespace", async () => {
const root = path.join(import.meta.dirname, "..", "..", "..");
const providers = await generate(path.join(root, "providers"));
const modelIDs = Object.keys(providers.zenifra?.models ?? {});

expect(modelIDs).not.toEqual([]);
expect(modelIDs.every((modelID) => modelID.startsWith("zenifra/"))).toBe(true);
});

test("Zenifra exposes only native reasoning controls", async () => {
const root = path.join(import.meta.dirname, "..", "..", "..");
const providers = await generate(path.join(root, "providers"));
const models = providers.zenifra?.models ?? {};

const actual = Object.fromEntries(
Object.entries(models).map(([modelID, model]) => [
modelID,
model.reasoning_options,
]),
);

expect(actual).toEqual({
"zenifra/deepseek-v4-flash-0731": [
{ type: "toggle" },
{ type: "effort", values: ["low", "high", "max"] },
],
"zenifra/deepseek-v4-pro": [
{ type: "toggle" },
{ type: "effort", values: ["high", "max"] },
],
"zenifra/glm-5.1": [{ type: "toggle" }],
"zenifra/glm-5.2": [
{ type: "toggle" },
{ type: "effort", values: ["high", "max"] },
],
"zenifra/kimi-k2.5": [{ type: "toggle" }],
"zenifra/kimi-k2.7-code": [],
"zenifra/kimi-k3": [
{ type: "effort", values: ["low", "high", "max"] },
],
"zenifra/qwen3.6-flash": [{ type: "toggle" }],
"zenifra/qwen3.6-plus": [{ type: "toggle" }],
"zenifra/qwen3.7-max": [{ type: "toggle" }],
"zenifra/qwen3.7-plus": [{ type: "toggle" }],
"zenifra/qwen3.8-27b": [
{ type: "toggle" },
{ type: "effort", values: ["low", "medium", "xhigh"] },
],
"zenifra/qwen3.8-flash": [
{ type: "toggle" },
{ type: "effort", values: ["low", "medium", "xhigh"] },
],
"zenifra/qwen3.8-max": [
{ type: "toggle" },
{ type: "effort", values: ["low", "medium", "xhigh"] },
],
});
});

test("Zenifra attachment support matches its served input modalities", async () => {
const root = path.join(import.meta.dirname, "..", "..", "..");
const providers = await generate(path.join(root, "providers"));
const models = providers.zenifra?.models ?? {};

const actual = Object.fromEntries(
Object.entries(models).map(([modelID, model]) => [
modelID,
model.attachment,
]),
);

expect(actual).toEqual({
"zenifra/deepseek-v4-flash-0731": false,
"zenifra/deepseek-v4-pro": false,
"zenifra/glm-5.1": false,
"zenifra/glm-5.2": false,
"zenifra/kimi-k2.5": true,
"zenifra/kimi-k2.7-code": true,
"zenifra/kimi-k3": true,
"zenifra/qwen3.6-flash": true,
"zenifra/qwen3.6-plus": true,
"zenifra/qwen3.7-max": false,
"zenifra/qwen3.7-plus": true,
"zenifra/qwen3.8-27b": false,
"zenifra/qwen3.8-flash": true,
"zenifra/qwen3.8-max": true,
});
});

test("Zenifra serves current limits, modalities, and converted tier prices", async () => {
const root = path.join(import.meta.dirname, "..", "..", "..");
const providers = await generate(path.join(root, "providers"));
const models = providers.zenifra?.models ?? {};

expect(models["zenifra/glm-5.1"]?.limit).toEqual({
context: 202_745,
output: 131_072,
});
expect(models["zenifra/qwen3.6-flash"]?.limit).toEqual({
context: 991_808,
output: 65_536,
});
expect(models["zenifra/qwen3.6-plus"]?.limit).toEqual({
context: 991_808,
output: 65_536,
});
expect(models["zenifra/qwen3.8-27b"]?.modalities?.input).toEqual(["text"]);
expect(models["zenifra/qwen3.8-max"]?.modalities?.input).toEqual(["text", "image", "video"]);

expect(models["zenifra/glm-5.1"]?.cost).toEqual({
input: 1.144231,
output: 4.578846,
cache_read: 0.228846,
tiers: [{
tier: { type: "context", size: 32_001 },
input: 1.526923,
output: 5.340385,
cache_read: 0.305769,
}],
});
expect(models["zenifra/qwen3.6-flash"]?.cost).toEqual({
input: 0.163462,
output: 0.980769,
cache_read: 0.017308,
context_over_200k: {
input: 0.653846,
output: 3.923077,
cache_read: 0.065385,
},
tiers: [{
tier: { type: "context", size: 256_001 },
input: 0.653846,
output: 3.923077,
cache_read: 0.065385,
}],
});
expect(models["zenifra/qwen3.6-plus"]?.cost).toEqual({
input: 0.275,
output: 1.636538,
cache_read: 0.028846,
context_over_200k: {
input: 1.092308,
output: 6.540385,
cache_read: 0.111538,
},
tiers: [{
tier: { type: "context", size: 256_001 },
input: 1.092308,
output: 6.540385,
cache_read: 0.111538,
}],
});
});

test("base_model can factor metadata without changing provider JSON", async () => {
await withFixture(async (root) => {
await write(root, "providers/direct/provider.toml", providerToml("Direct"));
Expand Down
14 changes: 0 additions & 14 deletions providers/zenifra/models/alibaba/qwen3.6-35b-a3b.toml

This file was deleted.

23 changes: 23 additions & 0 deletions providers/zenifra/models/zenifra/deepseek-v4-flash-0731.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Source: GET https://ai.zenifra.com/v1/models (accessed 2026-09-12).
# Conversion: Zenifra prices are BRL; models.dev costs use BRL / 5.20 = USD (project rate, applied 2026-09-12).
# Off-peak 14:00-00:00 UTC: BRL/1M input 1.10, output 3.30, cache read 0.14;
# the models.dev cost schema does not represent time-of-day pricing.
# Toggle: enable_thinking = true|false.
# Effort: reasoning_effort = low|high|max.
base_model = "deepseek/deepseek-v4-flash-0731"
structured_output = false
reasoning_options = [
{ type = "toggle" },
{ type = "effort", values = ["low", "high", "max"] },
]

[limit]
output = 393_216

[provider]
shape = "completions"

[cost]
input = 0.423077
output = 1.269231
cache_read = 0.055769
23 changes: 23 additions & 0 deletions providers/zenifra/models/zenifra/deepseek-v4-pro.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Source: GET https://ai.zenifra.com/v1/models (accessed 2026-09-12).
# Conversion: Zenifra prices are BRL; models.dev costs use BRL / 5.20 = USD (project rate, applied 2026-09-12).
# Toggle: enable_thinking = true|false.
# Effort: reasoning_effort = high|max (GET /v1/models, 2026-09-22).
# Off-peak 14:00-00:00 UTC: BRL/1M input 4.30, output 8.50, cache read 0.35;
# the models.dev cost schema does not represent time-of-day pricing.
base_model = "deepseek/deepseek-v4-pro-0813"
structured_output = false
reasoning_options = [
{ type = "toggle" },
{ type = "effort", values = ["high", "max"] },
]

[limit]
output = 393_216

[provider]
shape = "completions"

[cost]
input = 1.634615
output = 3.269231
cache_read = 0.134615
23 changes: 23 additions & 0 deletions providers/zenifra/models/zenifra/glm-5.1.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Source: GET https://ai.zenifra.com/v1/models (accessed 2026-09-22).
# Conversion: Zenifra prices are BRL; models.dev costs use BRL / 5.20 = USD (project rate).
# No native reasoning_effort levels advertised; expose the model's thinking toggle only.
# Toggle: enable_thinking = true|false (top-level chat/completions request).
base_model = "zhipuai/glm-5.1"
reasoning_options = [{ type = "toggle" }]

[limit]
context = 202_745

[provider]
shape = "completions"

[cost]
input = 1.144231
output = 4.578846
cache_read = 0.228846

[[cost.tiers]]
tier = { type = "context", size = 32_001 }
input = 1.526923
output = 5.340385
cache_read = 0.305769
21 changes: 21 additions & 0 deletions providers/zenifra/models/zenifra/glm-5.2.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Source: GET https://ai.zenifra.com/v1/models (accessed 2026-09-12).
# Conversion: Zenifra prices are BRL; models.dev costs use BRL / 5.20 = USD (project rate, applied 2026-09-12).
# Toggle: enable_thinking = true|false.
# Effort: reasoning_effort = high|max.
base_model = "zhipuai/glm-5.2"
structured_output = false
reasoning_options = [
{ type = "toggle" },
{ type = "effort", values = ["high", "max"] },
]

[limit]
context = 1_048_576

[provider]
shape = "completions"

[cost]
input = 1.096154
output = 3.846154
cache_read = 0.269231
20 changes: 20 additions & 0 deletions providers/zenifra/models/zenifra/kimi-k2.5.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Source: GET https://ai.zenifra.com/v1/models (accessed 2026-09-12).
# Conversion: Zenifra prices are BRL; models.dev costs use BRL / 5.20 = USD (project rate, applied 2026-09-12).
# Capabilities: structured_outputs = false.
# Toggle: enable_thinking = true|false; no native reasoning_effort levels.
base_model = "moonshotai/kimi-k2.5"
temperature = true
structured_output = false
reasoning_options = [{ type = "toggle" }]

[limit]
context = 229_376
output = 16_384

[provider]
shape = "completions"

[cost]
input = 0.576923
output = 3.019231
cache_read = 0.115385
18 changes: 18 additions & 0 deletions providers/zenifra/models/zenifra/kimi-k2.7-code.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Source: GET https://ai.zenifra.com/v1/models (accessed 2026-09-12).
# Conversion: Zenifra prices are BRL; models.dev costs use BRL / 5.20 = USD (project rate, applied 2026-09-12).
# Reasoning is always on and no caller control is listed in supported_parameters.
base_model = "moonshotai/kimi-k2.7-code"
temperature = true
reasoning_options = []

[limit]
context = 229_376
output = 16_384

[provider]
shape = "completions"

[cost]
input = 0.903846
output = 3.730769
cache_read = 0.067308
17 changes: 17 additions & 0 deletions providers/zenifra/models/zenifra/kimi-k3.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Source: GET https://ai.zenifra.com/v1/models (accessed 2026-09-12).
# Conversion: Zenifra prices are BRL; models.dev costs use BRL / 5.20 = USD (project rate, applied 2026-09-12).
# Reasoning is always on; Zenifra advertises effort levels low|high|max.
base_model = "moonshotai/kimi-k3"
temperature = true
reasoning_options = [{ type = "effort", values = ["low", "high", "max"] }]

[limit]
output = 1_048_576

[provider]
shape = "completions"

[cost]
input = 2.826923
output = 14.132692
cache_read = 0.288462
23 changes: 23 additions & 0 deletions providers/zenifra/models/zenifra/qwen3.6-flash.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Source: GET https://ai.zenifra.com/v1/models (accessed 2026-09-22).
# Conversion: Zenifra prices are BRL; models.dev costs use BRL / 5.20 = USD (project rate).
# No native reasoning_effort levels advertised; expose the model's thinking toggle only.
# Toggle: enable_thinking = true|false (top-level chat/completions request).
base_model = "alibaba/qwen3.6-flash"
reasoning_options = [{ type = "toggle" }]

[limit]
context = 991_808

[provider]
shape = "completions"

[cost]
input = 0.163462
output = 0.980769
cache_read = 0.017308

[[cost.tiers]]
tier = { type = "context", size = 256_001 }
input = 0.653846
output = 3.923077
cache_read = 0.065385
23 changes: 23 additions & 0 deletions providers/zenifra/models/zenifra/qwen3.6-plus.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Source: GET https://ai.zenifra.com/v1/models (accessed 2026-09-22).
# Conversion: Zenifra prices are BRL; models.dev costs use BRL / 5.20 = USD (project rate).
# No native reasoning_effort levels advertised; expose the model's thinking toggle only.
# Toggle: enable_thinking = true|false (top-level chat/completions request).
base_model = "alibaba/qwen3.6-plus"
reasoning_options = [{ type = "toggle" }]

[limit]
context = 991_808

[provider]
shape = "completions"

[cost]
input = 0.275000
output = 1.636538
cache_read = 0.028846

[[cost.tiers]]
tier = { type = "context", size = 256_001 }
input = 1.092308
output = 6.540385
cache_read = 0.111538
18 changes: 18 additions & 0 deletions providers/zenifra/models/zenifra/qwen3.7-max.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Source: GET https://ai.zenifra.com/v1/models (accessed 2026-09-12).
# Conversion: Zenifra prices are BRL; models.dev costs use BRL / 5.20 = USD (project rate, applied 2026-09-12).
# Capabilities: structured_outputs = true; input_modalities = text.
# Toggle: enable_thinking = true|false; no native reasoning_effort levels.
base_model = "alibaba/qwen3.7-max"
structured_output = true
reasoning_options = [{ type = "toggle" }]

[limit]
output = 131_072

[provider]
shape = "completions"

[cost]
input = 1.634615
output = 4.903846
cache_read = 0.326923
Loading
Loading