Files
plugins/packages/zen-free/README.md
T
yetone da27b4ce6b zen-free 0.1.9: a free model Zen lists is offered the hour it lists it, before OpenCode's catalog or docs describe it, and a list read with them out of reach isn't said as fallen back (yetone/magpie#2385)
Zen made deepseek-v4.1-flash-free free (in its /models as the public key
reads it, 2026-10-15) and the plugin never offered it. Two causes:

- buildModels left out a listed model that neither the catalog
  (models.opencode.ai) nor the docs' endpoint table described: a free
  model Zen lists before they catch up, or every model but the snapshot's
  when either can't be read. A listed id ending in -free with no word from
  either is now asked through the provider's own package
  (openai-compatible, chat), as OpenCode asks a model with no package of
  its own. A paid or unknown id that doesn't say -free still needs the
  catalog; the docs saying SystemOne still keep one out.
- A discovery with the catalog or the docs unread was marked
  magpie.fellBack, though Zen's own list was read. magpie answers a
  fallen-back list by keeping the last list read in full
  (plugin.keepListed), so a user who can't reach GitHub's raw host or the
  catalog kept that old list, and every model Zen made free since stayed
  out. Only a failed read of Zen's /models is fallen back now; models
  verified before are still kept while Zen lists them.

Tests (no network; the fixture server serves
fixtures/zen-models-2026-10-15.json, Zen's /models byte for byte):
- "a free model Zen lists that the catalog and the docs don't describe is
  offered, on chat (#2385)": catalog 503, docs 404 -> the ten free models
  Zen lists (Jev, "test" and the paid ones out), deepseek-v4.1-flash-free
  on chat, muse-spark-1.3 on Responses, not fallen back; a request for it
  goes to /chat/completions
- "... before the catalog has it is offered with the catalog read (#2385)"
- models.test: an unknown -free id is offered on the provider's package,
  "unknown-paid", "freebie" and "free-model" aren't, SystemOne stays out
  (replaces "unknown models require a known protocol rather than a
  guessed chat endpoint")
- two partial-discovery tests now expect no fellBack
Broken by hand: models.mjs back to 0.1.8's -> 3 fail; provider.mjs back
to 0.1.8's -> 3 fail; both fixed: bun test 174 pass, 0 fail (bun 1.4.2).
bun scripts/check.mjs zen-free: ok.

Not tried: a live request to deepseek-v4.1-flash-free through the plugin
(one GET of Zen's /models was the only network used). A future free
model Zen serves on Responses or Messages that the catalog doesn't
describe yet would be offered on chat and refused by Zen until the
catalog has it.

No magpie mover to raise: zen-free isn't a moved built-in, and magpie
updates @magpie-community plugins by itself within the hour.
2026-10-15 19:46:57 +08:00

71 lines
3.1 KiB
Markdown

# OpenCode Zen Free
OpenCode Zen's free models in magpie and OpenCode. Provider id:
`opencode-zen-free`.
Since 2026-10-13 Zen's free tier answers 403 FreeTierError ("can only be
used from within OpenCode") to a request that isn't OpenCode's. From
0.1.6 the plugin sends a free-model request with exactly the headers
OpenCode 1.19.0 sends to Zen, and a session id of OpenCode's own form.
Older versions (0.1.1 on npm before it) get the 403: update the plugin.
## Install
```sh
magpie plugin add @magpie-community/opencode-zen-free-auth
magpie plugin login opencode-zen-free
```
## Sign in
Enter `public` in the key field. No personal API key is needed.
The credential is kept in OpenCode's `auth.json` or magpie's
`plugin-auth.json`.
## Models
The plugin discovers Zen's current free models, including their context
windows and reasoning levels. Use `opencode-zen-free/<model>`, for example
`opencode-zen-free/big-pickle`.
Retired models and SystemOne models are excluded. The list is asked
again each time the host lists models (magpie does this on start and every
hour): a model Zen no longer gives free leaves it, and a new free one joins
it. A model Zen lists as `-free` that OpenCode's catalog and docs don't
describe yet (or can't be read) is offered too, on Chat Completions, as
OpenCode asks a model with no package of its own. When Zen's list can't be
read, the last list is kept. A request for a
model that isn't free now gets a 404 naming the free ones; one made free
since the last list is served after the list is asked again (at most once a
minute). Availability and rate limits are set by Zen; the plugin has no
remaining-quota data.
## Requests
Requests go to `https://opencode.ai/inference/v1` using each model's native
Chat Completions, Responses or Anthropic Messages API. Streaming and
ordinary JSON replies are supported.
The agent's tools are preserved. Zen's models often call OpenCode's own
tool names; such a call is given the agent's tool whose name differs only
in case (`bash` to `Bash`), or else only in case and `_`/`-` (`todowrite`
to `todo_write`, `webfetch` to `web_fetch`), when exactly one does. A
call with no such tool (or with no name) is left out of the reply, and
the reply's text says which name was left out; a turn whose every call
was left out ends as an ordinary answer. Tools run in the agent.
Zen's free tier only answers a request that carries tools, so a request
is sent with the five core OpenCode tools the agent doesn't declare
itself (`bash`, `edit`, `glob`, `grep`, `read`), described as not
available. A call of one of them the agent doesn't have is left out like
any other.
Now and then Zen closes a streamed Chat Completions reply before its
`[DONE]`. When the reply has said something and no tool call of it is
unfinished, it ends there as an ordinary answer, and its text says it was
cut short; asking again goes on. A reply cut short with a tool call
unfinished, with nothing said, or collapsed for a client that doesn't
stream fails with an error naming the reply's id and how much of it came.
An Anthropic Messages or Responses reply cut short fails too: magpie
tells it from a whole one and, where the model can, goes on with it.