diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f7679d095..ea738227f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Changed - **refactor(@omniroute/opencode-provider):** complete rewrite of the npm helper. The `1.0.0` artifact was non-functional โ€” `index.js` re-exported from `.ts` (unrunnable at install time) and the emitted shape didn't match the OpenCode `https://opencode.ai/config.json` schema. The new release ships a real `tsup` build (CJS + ESM + `.d.ts`), schema-correct output (`npm: "@ai-sdk/openai-compatible"`, with `models` catalog), `baseURL` deduplication (no more `/v1/v1`), input validation, 13 unit tests, and full documentation in [`docs/frameworks/OPENCODE.md`](docs/frameworks/OPENCODE.md). Versioned as `0.1.0` to signal the pre-1.0 reset. +- **chore(npm):** [`@omniroute/opencode-provider@0.1.0`](https://www.npmjs.com/package/@omniroute/opencode-provider) published to npmjs.com under the new `@omniroute` org. Install with `npm install --save-dev @omniroute/opencode-provider`. ### Security diff --git a/README.md b/README.md index a331c83ade..e4b62a38a3 100644 --- a/README.md +++ b/README.md @@ -291,7 +291,62 @@ OmniRoute works seamlessly with **16+ AI coding tools** โ€” one config, all tool ๐Ÿ“– Full setup for each tool: [`docs/CLI-TOOLS.md`](docs/CLI-TOOLS.md) -> **OpenCode tip:** the [`@omniroute/opencode-provider`](./@omniroute/opencode-provider) npm package emits a schema-valid `opencode.json` entry. Use `omniroute config opencode` (CLI) or `buildOmniRouteOpenCodeConfig()` (library) โ€” see [`docs/frameworks/OPENCODE.md`](docs/frameworks/OPENCODE.md) for the full integration guide. +### ๐Ÿงฉ OpenCode integration โ€” `@omniroute/opencode-provider` + +[![npm version](https://img.shields.io/npm/v/@omniroute/opencode-provider.svg?logo=npm&label=%40omniroute%2Fopencode-provider)](https://www.npmjs.com/package/@omniroute/opencode-provider) +[![npm downloads](https://img.shields.io/npm/dm/@omniroute/opencode-provider.svg?logo=npm)](https://www.npmjs.com/package/@omniroute/opencode-provider) +[![bundle size](https://img.shields.io/bundlephobia/minzip/@omniroute/opencode-provider?label=minzip)](https://bundlephobia.com/package/@omniroute/opencode-provider) +[![license](https://img.shields.io/npm/l/@omniroute/opencode-provider.svg)](./@omniroute/opencode-provider/LICENSE) + +Schema-valid generator for [`opencode.json`](https://opencode.ai/config.json). Emits a `provider.omniroute` entry that delegates the runtime to [`@ai-sdk/openai-compatible`](https://www.npmjs.com/package/@ai-sdk/openai-compatible) โ€” every OpenCode request flows through OmniRoute's `/v1` surface and benefits from Auto-Combo routing, circuit breakers, key policies, and observability. + +**Two integration paths:** + +```bash +# Path 1 โ€” CLI generator (ships with OmniRoute) +omniroute config opencode \ + --baseUrl http://localhost:20128 \ + --apiKey "$OMNIROUTE_API_KEY" +``` + +```bash +# Path 2 โ€” npm package (for scripted / programmatic setups) +npm install --save-dev @omniroute/opencode-provider +``` + +```ts +import { writeFileSync } from "node:fs"; +import { buildOmniRouteOpenCodeConfig } from "@omniroute/opencode-provider"; + +const config = buildOmniRouteOpenCodeConfig({ + baseURL: "http://localhost:20128", + apiKey: process.env.OMNIROUTE_API_KEY ?? "sk_omniroute", +}); + +writeFileSync("opencode.json", JSON.stringify(config, null, 2)); +``` + +Resulting `opencode.json` (excerpt): + +```jsonc +{ + "$schema": "https://opencode.ai/config.json", + "provider": { + "omniroute": { + "npm": "@ai-sdk/openai-compatible", + "name": "OmniRoute", + "options": { "baseURL": "http://localhost:20128/v1", "apiKey": "sk_omniroute" }, + "models": { + "claude-opus-4-5-thinking": { "name": "claude-opus-4-5-thinking" }, + "gemini-3.1-pro-high": { "name": "gemini-3.1-pro-high" }, + // โ€ฆ + }, + }, + }, +} +``` + +๐Ÿ“ฆ Package: [`@omniroute/opencode-provider`](https://www.npmjs.com/package/@omniroute/opencode-provider) ยท ๐Ÿ“– Full guide: [`docs/frameworks/OPENCODE.md`](docs/frameworks/OPENCODE.md) ยท ๐Ÿ›  Source: [`@omniroute/opencode-provider/`](./@omniroute/opencode-provider) ---