Skip to content
PluginStats

ai-sdk-provider-opencode-sdk weekly downloads statistics

By ben-vargas (3 listings) · npm · AI SDKs

AI SDK v7 provider for OpenCode 2.x via @opencode/client: sessions, streaming, tool approvals, and interactive forms

View on npm Fresh · Oct 17, 2026

ai-sdk-provider-opencode-sdk has 36,735 recorded weekly downloads on npm, a decrease of 55.9% over the past 30 days.

It ranks #620 of 2,251 tracked npm listings by weekly downloads.

Over 90 days, weekly downloads changed by -78.1%.

PluginStats has 543 daily observations since Apr 23, 2025; the latest is from Oct 17, 2026.

Weekly downloads
36,735
Official API · Oct 17, 2026
7-day growth
-57.2%
-49.1K weekly downloads
30-day growth
-55.9%
-46.5K weekly downloads
90-day growth
-78.1%
-131K weekly downloads
Rank
#620
Among tracked npm listings

About ai-sdk-provider-opencode-sdk

AI SDK Provider for OpenCode

5.x targets OpenCode 2.x. Still running an OpenCode 1.x server? Use the 4.x line: npm install ai-sdk-provider-opencode-sdk@opencode-v1. Not sure which you have? See Which version do I need?

A community provider for the Vercel AI SDK (v7) that runs generations through an OpenCode 2.x server via @opencode/client. OpenCode is an AI coding agent: it owns the model catalog, executes tools server-side, and manages sessions; this provider maps that onto generateText() / streamText() with tool observation, two-phase tool approvals, interactive forms, and native usage/cost metadata.

Which version do I need?

Two things decide it: your AI SDK major version and your OpenCode server major version.

| | OpenCode 2.x | OpenCode 1.x |

| AI SDK v7 | 5.x — npm i ai-sdk-provider-opencode-sdk | 4.x — npm i ai-sdk-provider-opencode-sdk@opencode-v1 | | AI SDK v6 | not supported | 3.x (legacy) — npm i ai-sdk-provider-opencode-sdk@ai-sdk-v6 | | AI SDK v5 | not supported | 0.x (legacy) — npm i ai-sdk-provider-opencode-sdk@ai-sdk-v5 |

Which OpenCode do I have? opencode --version prints opencode v2.x.y on OpenCode 2 and a bare 1.x.y on OpenCode 1. A running 2.x server also answers GET /api/info with its version; a 1.x server has no such route. Note that the npm package opencode-ai is OpenCode 1.x — OpenCode 2.x is published as @opencode/cli.

Version compatibility

| Provider | AI SDK | OpenCode server | npm tag | Branch | Status |

| 5.x | v7 | 2.x (@opencode/cli; tested against 2.0.24) | latest | main | Active | | 4.x | v7 | 1.x (opencode-ai) | opencode-v1 | opencode-v1 | Maintenance | | 3.x | v6 | 1.x | ai-sdk-v6 | ai-sdk-v6 | Legacy | | 2.x, 1.x | v6 | 1.x | — | historical | Legacy | | 0.x | v5 | 1.x | ai-sdk-v5 | ai-sdk-v5 | Legacy |

Maintenance lines get bug fixes; Legacy lines stay installable but receive no further releases.

Upgrading from 4.x? OpenCode 2.x is a new backend, not an SDK bump, and most settings changed — see docs/migrating-v4-to-v5.md and the CHANGELOG.

Server

5.x pins @opencode/client@2.0.24. Run the matching server from the published @opencode/cli (binary opencode, also exposed as opencode2), or use the opencode 2.x binary from the official installer:

serve requires HTTP Basic auth on every route: username opencode, password from OPENCODE_PASSWORD or printed at startup as server password . A server without the 2.x /api/info route (OpenCode 1.x, or the pre-2.0 beta builds) is reported as incompatible on first use.

Requirements

• Node.js >= 22 • An OpenCode 2.x server — npx @opencode/cli@2.0.24 serve (note the package is @opencode/cli, not opencode-ai) • Credentials on that server for the providers you want to use. The OpenCode zen free tier works without credentials on 2.x.

Quick start

The 2.x server requires Basic auth (opencode:) on every route:

Backends

createOpencode selects exactly one backend, in precedence order:

1. client — a caller-supplied OpenCode.make(...) client. Used as-is; the provider never closes it.

2. clientManager — a caller-supplied manager (advanced injection seam; see createClientManagerFromPort). Never disposed by the provider.

3. baseUrl — the provider constructs the client with clientOptions (headers, fetch).

4. Service discovery — Service.discover() via the local registration file, with the registered endpoint's auth merged automatically. opencode serve --service writes $XDG_STATE_HOME/opencode/service.json ({id, version, url, pid, password}) and binds a fixed port (49374). autoStart: true additionally spawns one via Service.ensure, whose default command is opencode serve --service — that opencode must be the 2.x binary (a v1 opencode from opencode-ai has no --service flag), or pass service.command explicitly. Auto-start is opt-in because it leaves a long-lived background service running. The zero-config default provider (import { opencode }) works once a registered service exists.

Every backend runs a connection preflight (server.info + migration.v1.status) on first use; a server without /api/info is reported as an incompatible pre-2.0 build.

Model IDs

Models are providerID/modelID strings from your server's catalog (model.list); a bare modelID omits the model at session create so the server default applies. OpencodeModels exports shortcuts for three OpenCode zen free-tier IDs, each present in a live 2.0.24 catalog and in the upstream models.dev catalog (no credentials needed on 2.x; the free tier churns and catalogs are server-dependent, so any ID your own catalog lists works — the shortcuts are a convenience, not a limit):

Sessions and conversations

OpenCode owns the transcript: model and agent are session state, and a prompt sends only new user text. The binding rule is one model instance = one conversation = one pinned session:

Session state is model-instance-local: the instance creates or pins a session on first use and reuses it for every later call on that instance. Nothing outlives the instance — no session ID is persisted, and each opencode(...) call builds a new model. sessionMode selects which session that is:

• "ephemeral" (default) — the provider creates a session on first use and owns it exclusively (it survives tool-approval round-trips). • "existing" — pin the session given by sessionId (implied when sessionId is set without a mode). Shared-session caveat: OpenCode 2.x has no inbox→execution correlation key, so events from other clients on the same session (e.g. a TUI) can be misattributed to your call. Use exclusively-owned sessions unless you accept that.

For a fresh session on every ordinary call, use createNewSession: true (approval continuations still reattach to the blocked session).

Per call, providerOptions.opencode.sessionId targets an existing session for that one request, and providerOptions.opencode.id sets the prompt's user-message ID (a msg_-prefixed id; when omitted the provider generates one, which it uses to correlate the turn's own events):…

Description from the npm listing.

  • ai-sdk
  • ai-sdk-provider
  • vercel-ai-sdk
  • opencode
  • opencode-v2
  • opencode-sdk
  • language-model
  • llm

Where ai-sdk-provider-opencode-sdk sits in the listing

Each band is one page of 20. Weekly downloads on a log scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.

All npm2,248 listings · 113 pages · page 31, #20 (overall #620)
All npm: every listing in weekly downloads order
PNG SVG
AI SDKs249 listings · 13 pages · page 2, #15 (overall #35)
AI SDKs: every listing in weekly downloads order
PNG SVG

Charts

Images: 30d · 1y · all time · 1600×900 dark

Adoption over time

ai-sdk-provider-opencode-sdk weekly downloads on npm, last 90 days: 36,735 weekly downloads as of Oct 17, 2026, -78.1% over 90 days.ai-sdk-provider-opencode-sdkWeekly downloads on npm · Last 90 days36,735downloads / week-78.1% over 90 days020K40K60K80K100K120K140K160K180KJul 19Aug 3Aug 18Sep 2Sep 17Oct 2Oct 17downloads / weekobservedarchived (Internet Archive)no observationsJul 21, 2026 – Oct 17, 2026 · 89 observations · Updated Oc…pluginstats.com
ai-sdk-provider-opencode-sdk weekly downloads on npm, last 90 days: 36,735 weekly downloads as of Oct 17, 2026, -78.1% over 90 days.
PNG SVG

7/30/90-day growth

ai-sdk-provider-opencode-sdk weekly downloads growth on npm: -57.2% over 7 days, -55.9% over 30 days, -78.1% over 90 days.ai-sdk-provider-opencode-sdkWeekly downloads growth on npm36,735downloads / week now7-day growth-49,138 weekly downloads-57.2%30-day growth-46,549 weekly downloads-55.9%90-day growth-130,972 weekly downloads-78.1%Growth vs. nearest observation to each baseline date · Updated Oct 17, 2026pluginstats.com
ai-sdk-provider-opencode-sdk weekly downloads growth on npm: -57.2% over 7 days, -55.9% over 30 days, -78.1% over 90 days.
PNG SVG

Ranking history

ai-sdk-provider-opencode-sdk npm ranking history: currently #620 (by weekly downloads).ai-sdk-provider-opencode-sdknpm ranking · by weekly downloads · Last 90 days#620current rank#100#200#300#400#500#600#700Jul 20Aug 4Aug 19Sep 3Sep 18Oct 3Oct 18rankOct 17, 2026 – Oct 18, 2026 · 2 observations · Updated Oct 17, 2026pluginstats.com
ai-sdk-provider-opencode-sdk npm ranking history: currently #620 (by weekly downloads).
PNG SVG

Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.

Recent observations

Full history (543)
Recent weekly downloads observations for ai-sdk-provider-opencode-sdk
Date (UTC)Weekly downloadsChange vs. previous
36,735-15.1K
51,794-4.6K
56,350-13.8K
70,128-14.9K
85,0340
85,034+1.8K
83,195-2.7K
85,873-1.6K
87,500+493
87,007+1.2K
85,850+1.4K
84,426-13K
97,466-7.1K
104,571—

Similar npm AI SDKs plugins

Data source

Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.

Listing: https://www.npmjs.com/package/ai-sdk-provider-opencode-sdk. First seen Oct 16, 2026; last successful collection Oct 18, 2026. See the methodology.