Files
plugins/packages/zen-free
yetone fe5631c1cb zen-free 0.1.10: the sign-in says a personal OpenCode key belongs in the built-in OpenCode Zen (TradingLife on Discord)
A user typed keys made under several OpenCode accounts into Zen Free's key
field and expected several accounts. The method's authorize() always
returns key "public", and magpie's host stores result.key over the typed
key (host.js save), so every such sign-in is the same shared credential
and the typed key is dropped. The label and README now say so and point
own keys to magpie's built-in OpenCode Zen provider (several keys,
rotation and failover).

Run: bun test in packages/zen-free, 174 pass 0 fail. Read host.js
apiKey/save on magpie 63be47717 to confirm the stored key is "public".
Not tried: a sign-in through magpie's GUI with the new label.
2026-10-16 16:59:02 +08:00
..

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

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.

Whatever is typed in the key field, the plugin signs in with the one shared public credential: a key made under your own OpenCode account does nothing here, and several of them don't make several accounts. Your own Zen keys go in magpie's built-in OpenCode Zen provider (or OpenCode's opencode provider), which takes several keys. 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.