mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +03:00
docs(opencode): announce @omniroute/opencode-provider on npm
- README: dedicated OpenCode integration section with npm/downloads/bundle size badges, install command, two-path usage example (CLI + npm), and the resulting opencode.json shape. - CHANGELOG: note the 0.1.0 npm publish under Unreleased > Changed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
57
README.md
57
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`
|
||||
|
||||
[](https://www.npmjs.com/package/@omniroute/opencode-provider)
|
||||
[](https://www.npmjs.com/package/@omniroute/opencode-provider)
|
||||
[](https://bundlephobia.com/package/@omniroute/opencode-provider)
|
||||
[](./@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)
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user