zen-free 0.1.17: deepseek-v4.1-flash-free's context floor is the measured 258,624 (#448)
deepseek-v4.1-flash-free's context is raised to the measured floor 258,624 (a 200 with upstream usage in 576 + cache_read 258,048 on 2026-10-26) whenever Zen's catalog reports less or nothing; a larger catalog value (262,144, 1,000,000) passes through. Output stays 32,000. Upstream data issue: anomalyco/models.dev#11768. Version 0.1.17.
Run at 4ff44683d6e326a2baaafa5fb12216b4298d0858, and merged onto main 95fa761, on mote (mote-run, sandbox HOME):
- bun test packages/zen-free: 200 pass, 0 fail (both trees).
- bun scripts/check.mjs zen-free: ok.
- Broke it by hand on the merged tree: always using the floor (no Math.max) and keying the floor to another id each turn the new test red (4 pass / 1 fail); restored, green.
- npm pack (0.1.17) and imported the packed index.mjs (exports ZenFreePlugin); buildModels over the live models.dev opencode catalog (deepseek-v4.1-flash-free at 200000/32000 today) gives context 258624, output 32000; big-pickle unchanged at 200000.
- npm has 0.1.16; 0.1.17 is free.
Not tried: a real request over 258,624 tokens; the true ceiling is still unknown. The code comment does not carry the models.dev issue link (it is in the PR body).
This commit is contained in:
@@ -53,6 +53,18 @@ function listedFree(id) {
|
||||
return /-free$/.test(id);
|
||||
}
|
||||
|
||||
// "258K" is the model's working label, not an exact maximum. Zen's live
|
||||
// catalog lists deepseek-v4.1-flash-free at 200000, but on 2026-10-26 a
|
||||
// request whose upstream usage was in 576 + cache_read 258,048 = 258,624
|
||||
// tokens got a 200 from the free tier. That is the measured floor; the
|
||||
// later 283,545-token attempt was magpie's own estimate, not upstream
|
||||
// usage, so it is not a ceiling. Reporting more than the vendor accepts
|
||||
// routes requests that then fail, so the floor is used until a source
|
||||
// says more. Remove this when the catalog carries the real value.
|
||||
const CONTEXT_FLOOR = {
|
||||
"deepseek-v4.1-flash-free": 258_624,
|
||||
};
|
||||
|
||||
export function buildModels(ids, provider, protocols, baseURL) {
|
||||
const result = {};
|
||||
for (const id of ids) {
|
||||
@@ -81,7 +93,13 @@ export function buildModels(ids, provider, protocols, baseURL) {
|
||||
providerID: PROVIDER,
|
||||
name: model.name ?? id,
|
||||
api: { id, url: baseURL, npm: SDK[protocol] },
|
||||
limit: { context: 32768, output: 4096, ...model.limit },
|
||||
limit: {
|
||||
output: 4096,
|
||||
...model.limit,
|
||||
context: CONTEXT_FLOOR[id]
|
||||
? Math.max(model.limit?.context ?? 0, CONTEXT_FLOOR[id])
|
||||
: model.limit?.context ?? 32768,
|
||||
},
|
||||
capabilities: {
|
||||
temperature: model.temperature ?? true,
|
||||
reasoning: model.reasoning ?? false,
|
||||
|
||||
@@ -113,3 +113,31 @@ test("reads the console docs' endpoint table, and Jev stays out as SystemOne", a
|
||||
const models = buildModels(["jev-1.13-free", "step-5-preview-free"], {}, protocols, baseURL);
|
||||
assert.deepEqual(Object.keys(models), ["step-5-preview-free"]);
|
||||
});
|
||||
|
||||
// The catalog's 200000 for deepseek-v4.1-flash-free is low. The model's
|
||||
// upstream usage on 2026-10-26 was in 576 + cache_read 258,048 = 258,624
|
||||
// tokens, and the request got a 200; 258,624 is therefore the measured
|
||||
// floor ("258K"), not an exact ceiling. A larger catalog value (a corrected
|
||||
// 262,144 or 1,000,000) must pass through untouched, and a missing one
|
||||
// falls back to the floor.
|
||||
test("deepseek-v4.1-flash-free keeps its measured 258K floor over a low 200K catalog", async () => {
|
||||
const { buildModels } = await subject;
|
||||
const model = (context) => ({
|
||||
name: "DeepSeek V4.1 Flash Free",
|
||||
cost: { input: 0, output: 0 },
|
||||
limit: { ...(context == null ? {} : { context }), output: 32000 },
|
||||
reasoning: true,
|
||||
tool_call: true,
|
||||
});
|
||||
const built = (context) => buildModels(
|
||||
["deepseek-v4.1-flash-free"],
|
||||
{ npm: "@ai-sdk/openai-compatible", models: { "deepseek-v4.1-flash-free": model(context) } },
|
||||
{},
|
||||
baseURL,
|
||||
)["deepseek-v4.1-flash-free"];
|
||||
assert.equal(built(200000).limit.context, 258624);
|
||||
assert.equal(built(undefined).limit.context, 258624);
|
||||
assert.equal(built(262144).limit.context, 262144);
|
||||
assert.equal(built(1000000).limit.context, 1000000);
|
||||
assert.equal(built(200000).limit.output, 32000);
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@magpie-community/opencode-zen-free-auth",
|
||||
"version": "0.1.16",
|
||||
"version": "0.1.17",
|
||||
"description": "OpenCode Zen free models through the public credential, with native streaming protocols",
|
||||
"type": "module",
|
||||
"main": "./index.mjs",
|
||||
|
||||
Reference in New Issue
Block a user