# @opencode/client

> Private generation target for clients derived directly from OpenCode's authoritative Effect `HttpApi`.

Latest version **2.0.32** (published 2026-10-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install @opencode/client
pnpm add @opencode/client
yarn add @opencode/client
bun add @opencode/client
```

## Health

**Score 70/100 (B)** — status: active.

Positive: esm support; no vulnerabilities; recently updated; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 2.0.32 |
| Published | 2026-10-16 |
| First published | 2026-09-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 2 |
| Unpacked size | 1 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 207552 |
| Maintainers | thdxr |

## Links

- npm: https://www.npmjs.com/package/@opencode/client
- Repository: https://github.com/anomalyco/opencode
- Homepage: https://github.com/anomalyco/opencode#readme
- Issues: https://github.com/anomalyco/opencode/issues
- npm.io page: https://npm.io/package/@opencode/client

## Dependencies (2)

- [@opencode/schema](https://npm.io/package/@opencode/schema.md) 2.0.32
- [@opencode/protocol](https://npm.io/package/@opencode/protocol.md) 2.0.32

## Recent versions

- 2.0.32 (latest) — 2026-10-16
- 0.0.0-dev-21268 (dev) — 2026-10-20
- 0.0.0-beta-19507 (beta) — 2026-09-12
- 0.0.0-reserved (reserved) — 2026-09-02
- 0.0.0-dev-21267 — 2026-10-20
- 0.0.0-dev-21266 — 2026-10-20
- 0.0.0-dev-21259 — 2026-10-20
- 0.0.0-dev-21255 — 2026-10-20
- 0.0.0-dev-21253 — 2026-10-20
- 0.0.0-dev-21252 — 2026-10-19
- 0.0.0-dev-21246 — 2026-10-19
- 0.0.0-dev-21244 — 2026-10-19
- 0.0.0-dev-21240 — 2026-10-19
- 0.0.0-dev-21233 — 2026-10-19
- 0.0.0-dev-21225 — 2026-10-19
- … 1173 more at https://npm.io/package/@opencode/client/versions

## README

# @opencode/client

Private generation target for clients derived directly from OpenCode's authoritative Effect `HttpApi`.

## Entrypoints

- `@opencode/client`: zero-Effect Promise client using `fetch`.
- `@opencode/client/effect`: rich Effect network client using an environment-provided `HttpClient`.

The generated surface includes every standard HTTP group from Server's concrete API. The build compiler reads `@opencode/server/api`; the generated Effect runtime imports a client-local projection built from Protocol, with a generation-equivalence test preventing transport drift. Custom transports such as the PTY WebSocket connection remain outside the generic HTTP client. Run `bun run generate` after changing the contract and `bun run check:generated` to detect committed-output drift.

The Effect entrypoint uses canonical decoded values such as `Session.ID`, `Location.Ref`, and `Prompt`. These datatypes come from the lightweight `@opencode/schema` package and are re-exported so callers depend only on the client surface. Protocol owns endpoint construction and middleware placement; Server supplies the concrete middleware keys used by the build-time API.

The Promise root remains structural and has no Core or Effect runtime dependency. `/effect` depends only on Effect, Schema, and Protocol and is browser-bundle safe. Bundle-boundary tests enforce both import graphs.

Effect consumers construct canonical decoded inputs:

```ts
import { AbsolutePath, Location, OpenCode, Prompt } from "@opencode/client/effect"

const client = yield * OpenCode.make({ baseUrl: "https://opencode.example" })
yield *
  client.sessions.create({
    location: Location.Ref.make({ directory: AbsolutePath.make("/workspace") }),
  })
yield * client.sessions.prompt({ sessionID, prompt: Prompt.make({ text: "Hello" }) })
```

---
_Source: https://npm.io/package/@opencode/client · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
