refactor(ai): rename llm package
This commit is contained in:
@@ -338,7 +338,7 @@
|
|||||||
"@opencode-ai/codemode": "workspace:*",
|
"@opencode-ai/codemode": "workspace:*",
|
||||||
"@opencode-ai/effect-drizzle-sqlite": "workspace:*",
|
"@opencode-ai/effect-drizzle-sqlite": "workspace:*",
|
||||||
"@opencode-ai/effect-sqlite-node": "workspace:*",
|
"@opencode-ai/effect-sqlite-node": "workspace:*",
|
||||||
"@opencode-ai/llm": "workspace:*",
|
"@opencode-ai/ai": "workspace:*",
|
||||||
"@opencode-ai/plugin": "workspace:*",
|
"@opencode-ai/plugin": "workspace:*",
|
||||||
"@opencode-ai/schema": "workspace:*",
|
"@opencode-ai/schema": "workspace:*",
|
||||||
"@openrouter/ai-sdk-provider": "2.9.0",
|
"@openrouter/ai-sdk-provider": "2.9.0",
|
||||||
@@ -561,8 +561,8 @@
|
|||||||
"@typescript/native-preview": "catalog:",
|
"@typescript/native-preview": "catalog:",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"packages/llm": {
|
"packages/ai": {
|
||||||
"name": "@opencode-ai/llm",
|
"name": "@opencode-ai/ai",
|
||||||
"version": "1.17.20",
|
"version": "1.17.20",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@opencode-ai/schema": "workspace:*",
|
"@opencode-ai/schema": "workspace:*",
|
||||||
@@ -623,7 +623,7 @@
|
|||||||
"@opencode-ai/cli": "workspace:*",
|
"@opencode-ai/cli": "workspace:*",
|
||||||
"@opencode-ai/client": "workspace:*",
|
"@opencode-ai/client": "workspace:*",
|
||||||
"@opencode-ai/codemode": "workspace:*",
|
"@opencode-ai/codemode": "workspace:*",
|
||||||
"@opencode-ai/llm": "workspace:*",
|
"@opencode-ai/ai": "workspace:*",
|
||||||
"@opencode-ai/plugin": "workspace:*",
|
"@opencode-ai/plugin": "workspace:*",
|
||||||
"@opencode-ai/protocol": "workspace:*",
|
"@opencode-ai/protocol": "workspace:*",
|
||||||
"@opencode-ai/schema": "workspace:*",
|
"@opencode-ai/schema": "workspace:*",
|
||||||
@@ -884,7 +884,7 @@
|
|||||||
"@fontsource/commit-mono": "5.2.5",
|
"@fontsource/commit-mono": "5.2.5",
|
||||||
"@napi-rs/canvas": "1.0.2",
|
"@napi-rs/canvas": "1.0.2",
|
||||||
"@opencode-ai/core": "workspace:*",
|
"@opencode-ai/core": "workspace:*",
|
||||||
"@opencode-ai/llm": "workspace:*",
|
"@opencode-ai/ai": "workspace:*",
|
||||||
"@opentui/core": "catalog:",
|
"@opentui/core": "catalog:",
|
||||||
"effect": "catalog:",
|
"effect": "catalog:",
|
||||||
},
|
},
|
||||||
@@ -2204,7 +2204,7 @@
|
|||||||
|
|
||||||
"@opencode-ai/httpapi-codegen": ["@opencode-ai/httpapi-codegen@workspace:packages/httpapi-codegen"],
|
"@opencode-ai/httpapi-codegen": ["@opencode-ai/httpapi-codegen@workspace:packages/httpapi-codegen"],
|
||||||
|
|
||||||
"@opencode-ai/llm": ["@opencode-ai/llm@workspace:packages/llm"],
|
"@opencode-ai/ai": ["@opencode-ai/ai@workspace:packages/ai"],
|
||||||
|
|
||||||
"@opencode-ai/plugin": ["@opencode-ai/plugin@workspace:packages/plugin"],
|
"@opencode-ai/plugin": ["@opencode-ai/plugin@workspace:packages/plugin"],
|
||||||
|
|
||||||
@@ -6862,9 +6862,9 @@
|
|||||||
|
|
||||||
"@opencode-ai/desktop/typescript": ["typescript@5.6.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw=="],
|
"@opencode-ai/desktop/typescript": ["typescript@5.6.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw=="],
|
||||||
|
|
||||||
"@opencode-ai/llm/@smithy/eventstream-codec": ["@smithy/eventstream-codec@4.2.14", "", { "dependencies": { "@aws-crypto/crc32": "5.2.0", "@smithy/types": "^4.14.1", "@smithy/util-hex-encoding": "^4.2.2", "tslib": "^2.6.2" } }, "sha512-erZq0nOIpzfeZdCyzZjdJb4nVSKLUmSkaQUVkRGQTXs30gyUGeKnrYEg+Xe1W5gE3aReS7IgsvANwVPxSzY6Pw=="],
|
"@opencode-ai/ai/@smithy/eventstream-codec": ["@smithy/eventstream-codec@4.2.14", "", { "dependencies": { "@aws-crypto/crc32": "5.2.0", "@smithy/types": "^4.14.1", "@smithy/util-hex-encoding": "^4.2.2", "tslib": "^2.6.2" } }, "sha512-erZq0nOIpzfeZdCyzZjdJb4nVSKLUmSkaQUVkRGQTXs30gyUGeKnrYEg+Xe1W5gE3aReS7IgsvANwVPxSzY6Pw=="],
|
||||||
|
|
||||||
"@opencode-ai/llm/@smithy/util-utf8": ["@smithy/util-utf8@4.2.2", "", { "dependencies": { "@smithy/util-buffer-from": "^4.2.2", "tslib": "^2.6.2" } }, "sha512-75MeYpjdWRe8M5E3AW0O4Cx3UadweS+cwdXjwYGBW5h/gxxnbeZ877sLPX/ZJA9GVTlL/qG0dXP29JWFCD1Ayw=="],
|
"@opencode-ai/ai/@smithy/util-utf8": ["@smithy/util-utf8@4.2.2", "", { "dependencies": { "@smithy/util-buffer-from": "^4.2.2", "tslib": "^2.6.2" } }, "sha512-75MeYpjdWRe8M5E3AW0O4Cx3UadweS+cwdXjwYGBW5h/gxxnbeZ877sLPX/ZJA9GVTlL/qG0dXP29JWFCD1Ayw=="],
|
||||||
|
|
||||||
"@opencode-ai/script/semver": ["semver@7.8.5", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA=="],
|
"@opencode-ai/script/semver": ["semver@7.8.5", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA=="],
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# LLM Package Guide
|
# AI Package Guide
|
||||||
|
|
||||||
## Effect
|
## Effect
|
||||||
|
|
||||||
@@ -115,10 +115,10 @@ Keep provider facades small and explicit:
|
|||||||
|
|
||||||
### Provider Package Entrypoints
|
### Provider Package Entrypoints
|
||||||
|
|
||||||
Catalog-selected native providers use package-like export paths from `@opencode-ai/llm`. They are internal entrypoints in one npm package, not separately published provider packages. Every entrypoint implements `ProviderPackage.Definition` and exposes `model(modelID, settings)`, where settings are serializable provider configuration plus common `headers`, `body`, and `limits` overlays.
|
Catalog-selected native providers use package-like export paths from `@opencode-ai/ai`. They are internal entrypoints in one npm package, not separately published provider packages. Every entrypoint implements `ProviderPackage.Definition` and exposes `model(modelID, settings)`, where settings are serializable provider configuration plus common `headers`, `body`, and `limits` overlays.
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import { model } from "@opencode-ai/llm/providers/openai/responses"
|
import { model } from "@opencode-ai/ai/providers/openai/responses"
|
||||||
|
|
||||||
const selected = model("gpt-5", {
|
const selected = model("gpt-5", {
|
||||||
apiKey,
|
apiKey,
|
||||||
@@ -133,7 +133,7 @@ Do not expose `Route` in provider package settings. Route composition stays an i
|
|||||||
### Folder layout
|
### Folder layout
|
||||||
|
|
||||||
```
|
```
|
||||||
packages/llm/src/
|
packages/ai/src/
|
||||||
schema/ canonical Schema model, split by concern
|
schema/ canonical Schema model, split by concern
|
||||||
ids.ts branded IDs, literal types, ProviderMetadata
|
ids.ts branded IDs, literal types, ProviderMetadata
|
||||||
options.ts Generation/Provider/Http options, Limits, Model, cache policy
|
options.ts Generation/Provider/Http options, Limits, Model, cache policy
|
||||||
@@ -143,7 +143,7 @@ packages/llm/src/
|
|||||||
index.ts barrel
|
index.ts barrel
|
||||||
llm.ts request constructors and convenience helpers
|
llm.ts request constructors and convenience helpers
|
||||||
route/
|
route/
|
||||||
index.ts @opencode-ai/llm/route advanced barrel
|
index.ts @opencode-ai/ai/route advanced barrel
|
||||||
client.ts Route.make + LLMClient.prepare/stream/generate
|
client.ts Route.make + LLMClient.prepare/stream/generate
|
||||||
executor.ts RequestExecutor service + transport error mapping
|
executor.ts RequestExecutor service + transport error mapping
|
||||||
protocol.ts Protocol type + Protocol.make
|
protocol.ts Protocol type + Protocol.make
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
# AI Library Design
|
# AI Library Design
|
||||||
|
|
||||||
> Discussion draft. This document describes the intended replacement for the
|
> Discussion draft. This document describes an intended clean-break redesign of
|
||||||
> current private `@opencode-ai/llm` API. Names and exact TypeScript signatures
|
> the current private `@opencode-ai/ai` API. Names and exact TypeScript signatures
|
||||||
> are illustrative until implementation, but the domain boundaries and defaults
|
> are illustrative until implementation, but the domain boundaries and defaults
|
||||||
> are deliberate.
|
> are deliberate.
|
||||||
|
|
||||||
@@ -1074,7 +1074,6 @@ The redesign intentionally removes or changes these current concepts:
|
|||||||
|
|
||||||
| Current | Proposed |
|
| Current | Proposed |
|
||||||
| --------------------------------------- | ----------------------------------------------------------- |
|
| --------------------------------------- | ----------------------------------------------------------- |
|
||||||
| `@opencode-ai/llm` | `@opencode-ai/ai` |
|
|
||||||
| Mandatory `LLM.request({ model, ... })` | Inline calls or model-free portable requests |
|
| Mandatory `LLM.request({ model, ... })` | Inline calls or model-free portable requests |
|
||||||
| `LLM.generate` means one turn | `LLM.generate` means complete run |
|
| `LLM.generate` means one turn | `LLM.generate` means complete run |
|
||||||
| `LLMClient.generate/stream` | `LLM.generateTurn/streamTurn` for one turn |
|
| `LLMClient.generate/stream` | `LLM.generateTurn/streamTurn` for one turn |
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
# @opencode-ai/llm
|
# @opencode-ai/ai
|
||||||
|
|
||||||
Schema-first LLM core for opencode. One typed request, response, event, and tool language; provider quirks live in adapters, not in calling code.
|
Schema-first LLM core for opencode. One typed request, response, event, and tool language; provider quirks live in adapters, not in calling code.
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import { Effect } from "effect"
|
import { Effect } from "effect"
|
||||||
import { LLM, LLMClient } from "@opencode-ai/llm"
|
import { LLM, LLMClient } from "@opencode-ai/ai"
|
||||||
import { OpenAI } from "@opencode-ai/llm/providers"
|
import { OpenAI } from "@opencode-ai/ai/providers"
|
||||||
|
|
||||||
const model = OpenAI.configure({ apiKey: process.env.OPENAI_API_KEY }).responses("gpt-4o-mini")
|
const model = OpenAI.configure({ apiKey: process.env.OPENAI_API_KEY }).responses("gpt-4o-mini")
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ Normalized cache usage is read back into `response.usage.cacheReadInputTokens` a
|
|||||||
Provider facades configure endpoint/auth/deployment details first, then expose model selectors that take only a model or deployment id. The selected model carries the executable route value used at runtime.
|
Provider facades configure endpoint/auth/deployment details first, then expose model selectors that take only a model or deployment id. The selected model carries the executable route value used at runtime.
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import { OpenAI, CloudflareAIGateway } from "@opencode-ai/llm/providers"
|
import { OpenAI, CloudflareAIGateway } from "@opencode-ai/ai/providers"
|
||||||
|
|
||||||
const openai = OpenAI.configure({ apiKey: process.env.OPENAI_API_KEY }).responses("gpt-4o-mini")
|
const openai = OpenAI.configure({ apiKey: process.env.OPENAI_API_KEY }).responses("gpt-4o-mini")
|
||||||
const gateway = CloudflareAIGateway.configure({
|
const gateway = CloudflareAIGateway.configure({
|
||||||
@@ -108,10 +108,10 @@ Included providers: OpenAI, Anthropic, Google (Gemini), Google Vertex Gemini and
|
|||||||
|
|
||||||
### Package-like entrypoints
|
### Package-like entrypoints
|
||||||
|
|
||||||
Native catalog integrations load provider behavior through package-like entrypoints. These are export paths from the same `@opencode-ai/llm` npm package, not independently published packages. Each entrypoint exports the same `model(modelID, settings)` contract, and `settings` contains serializable provider configuration plus common `headers`, `body`, and `limits` overlays.
|
Native catalog integrations load provider behavior through package-like entrypoints. These are export paths from the same `@opencode-ai/ai` npm package, not independently published packages. Each entrypoint exports the same `model(modelID, settings)` contract, and `settings` contains serializable provider configuration plus common `headers`, `body`, and `limits` overlays.
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import { model } from "@opencode-ai/llm/providers/openai/responses"
|
import { model } from "@opencode-ai/ai/providers/openai/responses"
|
||||||
|
|
||||||
const selected = model("gpt-5", {
|
const selected = model("gpt-5", {
|
||||||
apiKey: process.env.OPENAI_API_KEY,
|
apiKey: process.env.OPENAI_API_KEY,
|
||||||
@@ -123,12 +123,12 @@ const selected = model("gpt-5", {
|
|||||||
|
|
||||||
OpenAI Chat and OpenAI Responses are separate semantic entrypoints:
|
OpenAI Chat and OpenAI Responses are separate semantic entrypoints:
|
||||||
|
|
||||||
- `@opencode-ai/llm/providers/openai/chat`
|
- `@opencode-ai/ai/providers/openai/chat`
|
||||||
- `@opencode-ai/llm/providers/openai/responses`
|
- `@opencode-ai/ai/providers/openai/responses`
|
||||||
- `@opencode-ai/llm/providers/openai-compatible/responses`
|
- `@opencode-ai/ai/providers/openai-compatible/responses`
|
||||||
- `@opencode-ai/llm/providers/anthropic-compatible`
|
- `@opencode-ai/ai/providers/anthropic-compatible`
|
||||||
- `@opencode-ai/llm/providers/google-vertex`
|
- `@opencode-ai/ai/providers/google-vertex`
|
||||||
- `@opencode-ai/llm/providers/google-vertex/anthropic`
|
- `@opencode-ai/ai/providers/google-vertex/anthropic`
|
||||||
|
|
||||||
Responses HTTP versus WebSocket is a scoped `transport` setting on the OpenAI Responses entrypoint, not another entrypoint. Azure follows the same Chat/Responses split at `providers/azure/chat` and `providers/azure/responses`. Generic OpenAI-compatible Chat remains at `providers/openai-compatible`; compatible Responses is separate at `providers/openai-compatible/responses`. Generic Anthropic Messages-compatible providers use `providers/anthropic-compatible`, which the named Anthropic provider composes. Google Gemini and Amazon Bedrock expose their single native API through their existing provider paths.
|
Responses HTTP versus WebSocket is a scoped `transport` setting on the OpenAI Responses entrypoint, not another entrypoint. Azure follows the same Chat/Responses split at `providers/azure/chat` and `providers/azure/responses`. Generic OpenAI-compatible Chat remains at `providers/openai-compatible`; compatible Responses is separate at `providers/openai-compatible/responses`. Generic Anthropic Messages-compatible providers use `providers/anthropic-compatible`, which the named Anthropic provider composes. Google Gemini and Amazon Bedrock expose their single native API through their existing provider paths.
|
||||||
|
|
||||||
@@ -137,13 +137,13 @@ Vertex Gemini and Vertex Anthropic are separate products with separate entrypoin
|
|||||||
Tuned Vertex Gemini deployments use model ids shaped like `endpoints/1234567890` and require OAuth or ADC; Vertex express-mode API keys support publisher models only.
|
Tuned Vertex Gemini deployments use model ids shaped like `endpoints/1234567890` and require OAuth or ADC; Vertex express-mode API keys support publisher models only.
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import { model } from "@opencode-ai/llm/providers/google-vertex"
|
import { model } from "@opencode-ai/ai/providers/google-vertex"
|
||||||
|
|
||||||
model("gemini-3.5-flash", { project: "my-project", location: "global" })
|
model("gemini-3.5-flash", { project: "my-project", location: "global" })
|
||||||
```
|
```
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import { model } from "@opencode-ai/llm/providers/google-vertex/anthropic"
|
import { model } from "@opencode-ai/ai/providers/google-vertex/anthropic"
|
||||||
|
|
||||||
model("claude-sonnet-4-6", { project: "my-project", location: "global" })
|
model("claude-sonnet-4-6", { project: "my-project", location: "global" })
|
||||||
```
|
```
|
||||||
@@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
Last reviewed: 2026-07-15
|
Last reviewed: 2026-07-15
|
||||||
|
|
||||||
This file tracks the gap between the native `@opencode-ai/llm` package and the AI SDK provider packages that opencode still depends on for many catalog/runtime paths.
|
This file tracks the gap between the native `@opencode-ai/ai` package and the AI SDK provider packages that opencode still depends on for many catalog/runtime paths.
|
||||||
|
|
||||||
## Existing Status Sources
|
## Existing Status Sources
|
||||||
|
|
||||||
| File | What it tracks | Limitation |
|
| File | What it tracks | Limitation |
|
||||||
| ------------------------------------ | -------------------------------------------------------------------------------- | ------------------------------------------------------- |
|
| ------------------------------------ | -------------------------------------------------------------------------------- | ------------------------------------------------------- |
|
||||||
| `packages/llm/DESIGN.md` | Future clean-break API proposal, currently named `@opencode-ai/ai` in the draft. | Not a provider parity tracker. |
|
| `packages/ai/DESIGN.md` | Future clean-break API proposal for `@opencode-ai/ai`. | Not a provider parity tracker. |
|
||||||
| `packages/llm/example/call-sites.md` | Route/value/provider-facade migration checklist and call-site sketches. | Architecture migration only; not AI SDK package parity. |
|
| `packages/ai/example/call-sites.md` | Route/value/provider-facade migration checklist and call-site sketches. | Architecture migration only; not AI SDK package parity. |
|
||||||
|
|
||||||
## Current Implementation Snapshot
|
## Current Implementation Snapshot
|
||||||
|
|
||||||
@@ -78,21 +78,21 @@ These are implementation/API slices, not separate npm packages.
|
|||||||
|
|
||||||
| API slice | Package-like entrypoint | Purpose |
|
| API slice | Package-like entrypoint | Purpose |
|
||||||
| ----------------------------- | -------------------------------------------------------- | ---------------------------------------------------------------------------- |
|
| ----------------------------- | -------------------------------------------------------- | ---------------------------------------------------------------------------- |
|
||||||
| OpenAI Chat | `@opencode-ai/llm/providers/openai/chat` | OpenAI `/chat/completions` semantics. |
|
| OpenAI Chat | `@opencode-ai/ai/providers/openai/chat` | OpenAI `/chat/completions` semantics. |
|
||||||
| OpenAI Responses | `@opencode-ai/llm/providers/openai/responses` | OpenAI `/responses` semantics with HTTP/WebSocket selected through settings. |
|
| OpenAI Responses | `@opencode-ai/ai/providers/openai/responses` | OpenAI `/responses` semantics with HTTP/WebSocket selected through settings. |
|
||||||
| OpenAI-compatible Chat | `@opencode-ai/llm/providers/openai-compatible` | Generic OpenAI-compatible `/chat/completions`. |
|
| OpenAI-compatible Chat | `@opencode-ai/ai/providers/openai-compatible` | Generic OpenAI-compatible `/chat/completions`. |
|
||||||
| OpenAI-compatible Responses | `@opencode-ai/llm/providers/openai-compatible/responses` | Generic OpenAI-compatible `/responses`. |
|
| OpenAI-compatible Responses | `@opencode-ai/ai/providers/openai-compatible/responses` | Generic OpenAI-compatible `/responses`. |
|
||||||
| Anthropic-compatible Messages | `@opencode-ai/llm/providers/anthropic-compatible` | Generic Anthropic-compatible `/messages`. |
|
| Anthropic-compatible Messages | `@opencode-ai/ai/providers/anthropic-compatible` | Generic Anthropic-compatible `/messages`. |
|
||||||
| Anthropic Messages | `@opencode-ai/llm/providers/anthropic` | Anthropic Messages API. |
|
| Anthropic Messages | `@opencode-ai/ai/providers/anthropic` | Anthropic Messages API. |
|
||||||
| Gemini Developer API | `@opencode-ai/llm/providers/google` | Google AI Studio Gemini API. |
|
| Gemini Developer API | `@opencode-ai/ai/providers/google` | Google AI Studio Gemini API. |
|
||||||
| Vertex Gemini | `@opencode-ai/llm/providers/google-vertex` | Vertex Gemini API. |
|
| Vertex Gemini | `@opencode-ai/ai/providers/google-vertex` | Vertex Gemini API. |
|
||||||
| Vertex Anthropic Messages | `@opencode-ai/llm/providers/google-vertex/anthropic` | Vertex-hosted Anthropic Messages API. |
|
| Vertex Anthropic Messages | `@opencode-ai/ai/providers/google-vertex/anthropic` | Vertex-hosted Anthropic Messages API. |
|
||||||
| Vertex MaaS | Missing | Vertex OpenAI-compatible MaaS APIs. |
|
| Vertex MaaS | Missing | Vertex OpenAI-compatible MaaS APIs. |
|
||||||
| Vertex xAI | Missing | Vertex-hosted xAI APIs. |
|
| Vertex xAI | Missing | Vertex-hosted xAI APIs. |
|
||||||
| Bedrock Converse | `@opencode-ai/llm/providers/amazon-bedrock` | AWS Bedrock Converse API. |
|
| Bedrock Converse | `@opencode-ai/ai/providers/amazon-bedrock` | AWS Bedrock Converse API. |
|
||||||
| Bedrock Mantle | Missing | AWS Bedrock Mantle OpenAI-compatible APIs. |
|
| Bedrock Mantle | Missing | AWS Bedrock Mantle OpenAI-compatible APIs. |
|
||||||
| Azure OpenAI Chat | `@opencode-ai/llm/providers/azure/chat` | Azure specialization of OpenAI Chat. |
|
| Azure OpenAI Chat | `@opencode-ai/ai/providers/azure/chat` | Azure specialization of OpenAI Chat. |
|
||||||
| Azure OpenAI Responses | `@opencode-ai/llm/providers/azure/responses` | Azure specialization of OpenAI Responses. |
|
| Azure OpenAI Responses | `@opencode-ai/ai/providers/azure/responses` | Azure specialization of OpenAI Responses. |
|
||||||
|
|
||||||
## Suggested Next Work Slices
|
## Suggested Next Work Slices
|
||||||
|
|
||||||
@@ -7,7 +7,7 @@ values directly.
|
|||||||
## Conversation Summary
|
## Conversation Summary
|
||||||
|
|
||||||
Kit and Aidan want provider-specific LLM behavior to move out of opencode's AI
|
Kit and Aidan want provider-specific LLM behavior to move out of opencode's AI
|
||||||
SDK transform path and into `packages/llm` where possible. The goal is not a big
|
SDK transform path and into `packages/ai` where possible. The goal is not a big
|
||||||
generic transform layer; the goal is small composable route definitions backed by
|
generic transform layer; the goal is small composable route definitions backed by
|
||||||
recorded golden tests.
|
recorded golden tests.
|
||||||
|
|
||||||
@@ -355,7 +355,7 @@ The package-like OpenAI Responses entrypoint instead keeps transport scoped to
|
|||||||
Responses settings while preserving the same `model(...)` contract:
|
Responses settings while preserving the same `model(...)` contract:
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import { model } from "@opencode-ai/llm/providers/openai/responses"
|
import { model } from "@opencode-ai/ai/providers/openai/responses"
|
||||||
|
|
||||||
model("gpt-4o", { apiKey, transport: "websocket" })
|
model("gpt-4o", { apiKey, transport: "websocket" })
|
||||||
```
|
```
|
||||||
@@ -364,13 +364,13 @@ Vertex keeps Gemini and Anthropic Messages as separate package-like entrypoints,
|
|||||||
while sharing project/location resolution and ADC authentication internally:
|
while sharing project/location resolution and ADC authentication internally:
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import { model } from "@opencode-ai/llm/providers/google-vertex"
|
import { model } from "@opencode-ai/ai/providers/google-vertex"
|
||||||
|
|
||||||
model("gemini-3.5-flash", { project, location: "global" })
|
model("gemini-3.5-flash", { project, location: "global" })
|
||||||
```
|
```
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import { model } from "@opencode-ai/llm/providers/google-vertex/anthropic"
|
import { model } from "@opencode-ai/ai/providers/google-vertex/anthropic"
|
||||||
|
|
||||||
model("claude-sonnet-4-6", { project, location: "global" })
|
model("claude-sonnet-4-6", { project, location: "global" })
|
||||||
```
|
```
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
import { Config, Effect, Formatter, Layer, Schema, Stream } from "effect"
|
import { Config, Effect, Formatter, Layer, Schema, Stream } from "effect"
|
||||||
import { LLM, LLMClient, Message, ProviderID, Tool, ToolRuntime } from "@opencode-ai/llm"
|
import { LLM, LLMClient, Message, ProviderID, Tool, ToolRuntime } from "@opencode-ai/ai"
|
||||||
import { Route, Auth, Endpoint, Framing, Protocol, RequestExecutor, WebSocketExecutor } from "@opencode-ai/llm/route"
|
import { Route, Auth, Endpoint, Framing, Protocol, RequestExecutor, WebSocketExecutor } from "@opencode-ai/ai/route"
|
||||||
import { OpenAI } from "@opencode-ai/llm/providers"
|
import { OpenAI } from "@opencode-ai/ai/providers"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A runnable walkthrough of the LLM package use-site API.
|
* A runnable walkthrough of the LLM package use-site API.
|
||||||
*
|
*
|
||||||
* Run from `packages/llm` with an OpenAI key in the environment:
|
* Run from `packages/ai` with an OpenAI key in the environment:
|
||||||
*
|
*
|
||||||
* OPENAI_API_KEY=... bun example/tutorial.ts
|
* OPENAI_API_KEY=... bun example/tutorial.ts
|
||||||
*
|
*
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://json.schemastore.org/package.json",
|
"$schema": "https://json.schemastore.org/package.json",
|
||||||
"version": "1.17.20",
|
"version": "1.17.20",
|
||||||
"name": "@opencode-ai/llm",
|
"name": "@opencode-ai/ai",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"private": true,
|
"private": true,
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { describe, expect, test } from "bun:test"
|
import { describe, expect, test } from "bun:test"
|
||||||
import { LLM, LLMClient, Provider } from "@opencode-ai/llm"
|
import { LLM, LLMClient, Provider } from "@opencode-ai/ai"
|
||||||
import { Route, Protocol } from "@opencode-ai/llm/route"
|
import { Route, Protocol } from "@opencode-ai/ai/route"
|
||||||
import { Provider as ProviderSubpath } from "@opencode-ai/llm/provider"
|
import { Provider as ProviderSubpath } from "@opencode-ai/ai/provider"
|
||||||
import {
|
import {
|
||||||
CloudflareAIGateway,
|
CloudflareAIGateway,
|
||||||
CloudflareWorkersAI,
|
CloudflareWorkersAI,
|
||||||
@@ -9,15 +9,15 @@ import {
|
|||||||
OpenAICompatible,
|
OpenAICompatible,
|
||||||
OpenRouter,
|
OpenRouter,
|
||||||
XAI,
|
XAI,
|
||||||
} from "@opencode-ai/llm/providers"
|
} from "@opencode-ai/ai/providers"
|
||||||
import * as GitHubCopilot from "@opencode-ai/llm/providers/github-copilot"
|
import * as GitHubCopilot from "@opencode-ai/ai/providers/github-copilot"
|
||||||
import {
|
import {
|
||||||
OpenAIChat,
|
OpenAIChat,
|
||||||
OpenAICompatibleChat,
|
OpenAICompatibleChat,
|
||||||
OpenAICompatibleResponses,
|
OpenAICompatibleResponses,
|
||||||
OpenAIResponses,
|
OpenAIResponses,
|
||||||
} from "@opencode-ai/llm/protocols"
|
} from "@opencode-ai/ai/protocols"
|
||||||
import * as AnthropicMessages from "@opencode-ai/llm/protocols/anthropic-messages"
|
import * as AnthropicMessages from "@opencode-ai/ai/protocols/anthropic-messages"
|
||||||
|
|
||||||
describe("public exports", () => {
|
describe("public exports", () => {
|
||||||
test("root exposes app-facing runtime APIs", () => {
|
test("root exposes app-facing runtime APIs", () => {
|
||||||
@@ -34,7 +34,7 @@ describe("public exports", () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test("provider barrels expose user-facing facades", async () => {
|
test("provider barrels expose user-facing facades", async () => {
|
||||||
const { OpenAICompatibleResponses } = await import("@opencode-ai/llm/providers")
|
const { OpenAICompatibleResponses } = await import("@opencode-ai/ai/providers")
|
||||||
|
|
||||||
expect(OpenAI.model).toBeFunction()
|
expect(OpenAI.model).toBeFunction()
|
||||||
expect(OpenAI.provider.responses).toBe(OpenAI.responses)
|
expect(OpenAI.provider.responses).toBe(OpenAI.responses)
|
||||||
Vendored
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user