@opencode-ai/ai 0.0.0-next-16420 → 0.0.0-next-16473

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -196,7 +196,6 @@ The hosted result is represented as a provider-executed tool call and tool resul
196
196
  - **`LLM.generate` / `LLM.stream`** — re-exported from `LLMClient` for one-import use.
197
197
  - **`Message.user(...)` / `Message.assistant(...)` / `Message.tool(...)`** — message constructors from the canonical schema model.
198
198
  - **`Model.make(...)` / `ToolCallPart.make(...)` / `ToolResultPart.make(...)` / `ToolDefinition.make(...)`** — model and tool-related constructors from the canonical schema model.
199
- - **`LLMClient.prepare(request)`** — compile a request through protocol body construction, validation, and HTTP preparation without sending. Useful for inspection and testing.
200
199
  - **`LLMEvent.is.*`** — typed guards (`is.textDelta`, `is.toolCall`, `is.finish`, …) for filtering streams.
201
200
  - **`Image.generate({...})`** — generate images through a provider-neutral image request and response model.
202
201
  - **`ImageClient`** — Effect service and layer for image execution, parallel to `LLMClient`.
package/dist/llm.d.ts CHANGED
@@ -1,21 +1,22 @@
1
1
  import { Effect, JsonSchema, Schema } from "effect";
2
- import { GenerationOptions, HttpOptions, LLMError, LLMRequest, LLMResponse, Message, SystemPart, ToolChoice, ToolDefinition, type ContentPart } from "./schema";
2
+ import { GenerationOptions, HttpOptions, LLMError, LLMRequest, LLMResponse, Message, Model, SystemPart, ToolChoice, ToolDefinition, type ContentPart, type ModelProviderOptions } from "./schema";
3
3
  import { type ToolSchema } from "./tool";
4
4
  /** Input accepted by `LLM.request`, normalized into the canonical `LLMRequest` class. */
5
- export type RequestInput = Omit<ConstructorParameters<typeof LLMRequest>[0], "system" | "messages" | "tools" | "toolChoice" | "generation" | "http" | "providerOptions"> & {
5
+ export type RequestInput<SelectedModel extends Model = Model> = Omit<ConstructorParameters<typeof LLMRequest>[0], "model" | "system" | "messages" | "tools" | "toolChoice" | "generation" | "http" | "providerOptions"> & {
6
+ readonly model: SelectedModel;
6
7
  readonly system?: string | SystemPart | ReadonlyArray<SystemPart>;
7
8
  readonly prompt?: string | ContentPart | ReadonlyArray<ContentPart>;
8
9
  readonly messages?: ReadonlyArray<Message | Message.Input>;
9
10
  readonly tools?: ReadonlyArray<ToolDefinition.Input>;
10
11
  readonly toolChoice?: ToolChoice.Input;
11
12
  readonly generation?: GenerationOptions.Input;
12
- readonly providerOptions?: ConstructorParameters<typeof LLMRequest>[0]["providerOptions"];
13
+ readonly providerOptions?: NoInfer<ModelProviderOptions<SelectedModel>>;
13
14
  readonly http?: HttpOptions.Input;
14
15
  };
15
16
  export declare const generate: typeof import("./route/client").generate;
16
17
  export declare const stream: typeof import("./route/client").stream;
17
- export declare const request: (input: RequestInput) => LLMRequest;
18
- type GenerateObjectBase = Omit<RequestInput, "tools" | "toolChoice">;
18
+ export declare const request: <const SelectedModel extends Model>(input: RequestInput<SelectedModel>) => LLMRequest;
19
+ type GenerateObjectBase<SelectedModel extends Model = Model> = Omit<RequestInput<SelectedModel>, "tools" | "toolChoice">;
19
20
  export declare class GenerateObjectResponse<T> {
20
21
  readonly object: T;
21
22
  readonly response: LLMResponse;
@@ -204,10 +205,10 @@ export declare class GenerateObjectResponse<T> {
204
205
  })[];
205
206
  get usage(): import("./schema").Usage | undefined;
206
207
  }
207
- export interface GenerateObjectOptions<S extends ToolSchema<any>> extends GenerateObjectBase {
208
+ export interface GenerateObjectOptions<S extends ToolSchema<any>, SelectedModel extends Model = Model> extends GenerateObjectBase<SelectedModel> {
208
209
  readonly schema: S;
209
210
  }
210
- export interface GenerateObjectDynamicOptions extends GenerateObjectBase {
211
+ export interface GenerateObjectDynamicOptions<SelectedModel extends Model = Model> extends GenerateObjectBase<SelectedModel> {
211
212
  /** Raw JSON Schema object describing the expected output shape. */
212
213
  readonly jsonSchema: JsonSchema.JsonSchema;
213
214
  }
@@ -223,6 +224,6 @@ export interface GenerateObjectDynamicOptions extends GenerateObjectBase {
223
224
  * 2. `jsonSchema: JsonSchema.JsonSchema` — `.object` is `unknown`. Use when
224
225
  * the schema is only available at runtime (MCP, plugin manifests). Caller validates.
225
226
  */
226
- export declare function generateObject<S extends ToolSchema<any>>(options: GenerateObjectOptions<S>): Effect.Effect<GenerateObjectResponse<Schema.Schema.Type<S>>, LLMError>;
227
- export declare function generateObject(options: GenerateObjectDynamicOptions): Effect.Effect<GenerateObjectResponse<unknown>, LLMError>;
227
+ export declare function generateObject<const SelectedModel extends Model, S extends ToolSchema<any>>(options: GenerateObjectOptions<S, SelectedModel>): Effect.Effect<GenerateObjectResponse<Schema.Schema.Type<S>>, LLMError>;
228
+ export declare function generateObject<const SelectedModel extends Model>(options: GenerateObjectDynamicOptions<SelectedModel>): Effect.Effect<GenerateObjectResponse<unknown>, LLMError>;
228
229
  export {};
package/dist/llm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Effect, JsonSchema, Schema } from "effect";
2
2
  import { LLMClient } from "./route/client";
3
- import { GenerationOptions, HttpOptions, InvalidProviderOutputReason, LLMError, LLMEvent, LLMRequest, LLMResponse, Message, SystemPart, ToolChoice, ToolDefinition, } from "./schema";
3
+ import { GenerationOptions, HttpOptions, InvalidProviderOutputReason, LLMError, LLMEvent, LLMRequest, LLMResponse, Message, Model, SystemPart, ToolChoice, ToolDefinition, } from "./schema";
4
4
  import { make as makeTool, toDefinitions } from "./tool";
5
5
  export const generate = LLMClient.generate;
6
6
  export const stream = LLMClient.stream;
@@ -1,4 +1,4 @@
1
- import type { Model } from "./schema";
1
+ import type { Model, ProviderOptions } from "./schema";
2
2
  export interface Settings extends Readonly<Record<string, unknown>> {
3
3
  readonly headers?: Readonly<Record<string, string>>;
4
4
  readonly body?: Readonly<Record<string, unknown>>;
@@ -7,7 +7,7 @@ export interface Settings extends Readonly<Record<string, unknown>> {
7
7
  readonly output: number;
8
8
  };
9
9
  }
10
- export interface Definition<ProviderSettings extends Settings = Settings> {
11
- readonly model: (modelID: string, settings: ProviderSettings) => Model;
10
+ export interface Definition<ProviderSettings extends Settings = Settings, Options extends ProviderOptions = ProviderOptions> {
11
+ readonly model: (modelID: string, settings: ProviderSettings) => Model<Options>;
12
12
  }
13
13
  export * as ProviderPackage from "./provider-package";
@@ -145,15 +145,27 @@ export declare const routes: import("../route").Route<{
145
145
  }, import("../route/transport/http").HttpPrepared<object>>[];
146
146
  export declare const configure: (input?: Config) => {
147
147
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
148
- model: (modelID: string | ModelID) => import("..").Model;
148
+ model: (modelID: string | ModelID) => import("..").Model<{
149
+ readonly [x: string]: {
150
+ readonly [x: string]: unknown;
151
+ };
152
+ }>;
149
153
  configure: (input?: Config) => /*elided*/ any;
150
154
  };
151
155
  export declare const provider: {
152
156
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
153
- model: (modelID: string | ModelID) => import("..").Model;
157
+ model: (modelID: string | ModelID) => import("..").Model<{
158
+ readonly [x: string]: {
159
+ readonly [x: string]: unknown;
160
+ };
161
+ }>;
154
162
  configure: (input?: Config) => {
155
163
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
156
- model: (modelID: string | ModelID) => import("..").Model;
164
+ model: (modelID: string | ModelID) => import("..").Model<{
165
+ readonly [x: string]: {
166
+ readonly [x: string]: unknown;
167
+ };
168
+ }>;
157
169
  configure: /*elided*/ any;
158
170
  };
159
171
  };
@@ -203,16 +203,16 @@ export declare const routes: import("../route").Route<{
203
203
  }, import("../route/transport/http").HttpPrepared<string>>[];
204
204
  export declare const configure: (input: Config) => {
205
205
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
206
- model: (modelID: string | ModelID) => import("..").Model;
206
+ model: (modelID: string | ModelID) => import("..").Model<AnthropicMessages.ProviderOptionsInput>;
207
207
  configure: (input: Config) => /*elided*/ any;
208
208
  };
209
209
  export declare const provider: {
210
210
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
211
211
  configure: (input: Config) => {
212
212
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
213
- model: (modelID: string | ModelID) => import("..").Model;
213
+ model: (modelID: string | ModelID) => import("..").Model<AnthropicMessages.ProviderOptionsInput>;
214
214
  configure: /*elided*/ any;
215
215
  };
216
216
  };
217
- export declare const model: ProviderPackage.Definition<Settings>["model"];
217
+ export declare const model: ProviderPackage.Definition<Settings, AnthropicMessages.ProviderOptionsInput>["model"];
218
218
  export * as AnthropicCompatible from "./anthropic-compatible";
@@ -201,16 +201,16 @@ export type Settings = ProviderPackage.Settings & ({
201
201
  };
202
202
  export declare const configure: (input?: Config) => {
203
203
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
204
- model: (modelID: string | ModelID) => import("..").Model;
204
+ model: (modelID: string | ModelID) => import("..").Model<AnthropicMessages.ProviderOptionsInput>;
205
205
  configure: (input?: Config) => /*elided*/ any;
206
206
  };
207
207
  export declare const provider: {
208
208
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
209
- model: (modelID: string | ModelID) => import("..").Model;
209
+ model: (modelID: string | ModelID) => import("..").Model<AnthropicMessages.ProviderOptionsInput>;
210
210
  configure: (input?: Config) => {
211
211
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
212
- model: (modelID: string | ModelID) => import("..").Model;
212
+ model: (modelID: string | ModelID) => import("..").Model<AnthropicMessages.ProviderOptionsInput>;
213
213
  configure: /*elided*/ any;
214
214
  };
215
215
  };
216
- export declare const model: ProviderPackage.Definition<Settings>["model"];
216
+ export declare const model: ProviderPackage.Definition<Settings, AnthropicMessages.ProviderOptionsInput>["model"];
@@ -196,22 +196,22 @@ export declare const routes: (RouteDef<{
196
196
  }, import("../route/transport/http").HttpPrepared<string>>)[];
197
197
  export declare const configure: (input: Config) => {
198
198
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
199
- model: (modelID: string | ModelID) => import("..").Model;
200
- responses: (modelID: string | ModelID) => import("..").Model;
201
- chat: (modelID: string | ModelID) => import("..").Model;
199
+ model: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
200
+ responses: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
201
+ chat: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
202
202
  configure: (input: Config) => /*elided*/ any;
203
203
  };
204
204
  export declare const provider: {
205
205
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
206
206
  configure: (input: Config) => {
207
207
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
208
- model: (modelID: string | ModelID) => import("..").Model;
209
- responses: (modelID: string | ModelID) => import("..").Model;
210
- chat: (modelID: string | ModelID) => import("..").Model;
208
+ model: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
209
+ responses: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
210
+ chat: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
211
211
  configure: /*elided*/ any;
212
212
  };
213
213
  };
214
- export declare const responsesModel: ProviderPackage.Definition<Settings>["model"];
215
- export declare const chatModel: ProviderPackage.Definition<Settings>["model"];
216
- export declare const model: (modelID: string, settings: Settings) => import("..").Model;
214
+ export declare const responsesModel: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
215
+ export declare const chatModel: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
216
+ export declare const model: (modelID: string, settings: Settings) => import("..").Model<OpenAIProviderOptionsInput>;
217
217
  export {};
@@ -54,8 +54,12 @@ export const configure = (input) => {
54
54
  const configuredResponsesRoute = configuredRoute(responsesRoute, input);
55
55
  const configuredChatRoute = configuredRoute(chatRoute, input);
56
56
  const modelDefaults = defaults(input);
57
- const responses = (modelID) => configuredResponsesRoute.with(withOpenAIOptions(modelID, modelDefaults)).model({ id: modelID });
58
- const chat = (modelID) => configuredChatRoute.with(withOpenAIOptions(modelID, modelDefaults)).model({ id: modelID });
57
+ const responses = (modelID) => configuredResponsesRoute
58
+ .with(withOpenAIOptions(modelID, modelDefaults))
59
+ .model({ id: modelID });
60
+ const chat = (modelID) => configuredChatRoute
61
+ .with(withOpenAIOptions(modelID, modelDefaults))
62
+ .model({ id: modelID });
59
63
  return {
60
64
  id,
61
65
  model: (modelID) => (input.useCompletionUrls === true ? chat(modelID) : responses(modelID)),
@@ -2,6 +2,7 @@ import type { Config, Redacted } from "effect";
2
2
  import { type AtLeastOne, type ProviderAuthOption } from "../route/auth-options";
3
3
  import type { RouteDefaultsInput } from "../route/client";
4
4
  import { type ModelID } from "../schema";
5
+ import type { OpenAIProviderOptionsInput } from "./openai-options";
5
6
  export declare const aiGatewayID: string & import("effect/Brand").Brand<"LLM.ProviderID">;
6
7
  export declare const workersAIID: string & import("effect/Brand").Brand<"LLM.ProviderID">;
7
8
  export declare const aiGatewayAuthEnvVars: readonly ["CLOUDFLARE_API_TOKEN", "CF_AIG_TOKEN"];
@@ -13,15 +14,18 @@ type GatewayURL = AtLeastOne<{
13
14
  }> & {
14
15
  readonly gatewayId?: string;
15
16
  };
16
- export type AIGatewayOptions = GatewayURL & RouteDefaultsInput & ProviderAuthOption<"optional"> & {
17
+ export type AIGatewayOptions = GatewayURL & Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthOption<"optional"> & {
17
18
  /** Cloudflare AI Gateway authentication token. Sent as `cf-aig-authorization`. */
18
19
  readonly gatewayApiKey?: CloudflareSecret;
20
+ readonly providerOptions?: OpenAIProviderOptionsInput;
19
21
  };
20
22
  type WorkersAIURL = AtLeastOne<{
21
23
  readonly accountId: string;
22
24
  readonly baseURL: string;
23
25
  }>;
24
- export type WorkersAIOptions = WorkersAIURL & RouteDefaultsInput & ProviderAuthOption<"optional">;
26
+ export type WorkersAIOptions = WorkersAIURL & Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthOption<"optional"> & {
27
+ readonly providerOptions?: OpenAIProviderOptionsInput;
28
+ };
25
29
  export declare const aiGatewayBaseURL: (input: GatewayURL) => string;
26
30
  export declare const workersAIBaseURL: (input: WorkersAIURL) => string;
27
31
  export declare const aiGatewayRoute: import("../route").Route<{
@@ -229,7 +233,7 @@ export declare const CloudflareAIGateway: {
229
233
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
230
234
  configure: (options: AIGatewayOptions) => {
231
235
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
232
- model: (modelID: string | ModelID) => import("..").Model;
236
+ model: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
233
237
  configure: /*elided*/ any;
234
238
  };
235
239
  };
@@ -237,7 +241,7 @@ export declare const CloudflareWorkersAI: {
237
241
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
238
242
  configure: (options: WorkersAIOptions) => {
239
243
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
240
- model: (modelID: string | ModelID) => import("..").Model;
244
+ model: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
241
245
  configure: /*elided*/ any;
242
246
  };
243
247
  };
@@ -184,18 +184,18 @@ export declare const routes: (import("../route").Route<{
184
184
  }, import("../route/transport/http").HttpPrepared<string>>)[];
185
185
  export declare const configure: (options: ModelOptions) => {
186
186
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
187
- model: (modelID: string | ModelID) => import("..").Model;
188
- responses: (modelID: string | ModelID) => import("..").Model;
189
- chat: (modelID: string | ModelID) => import("..").Model;
187
+ model: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
188
+ responses: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
189
+ chat: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
190
190
  configure: (options: ModelOptions) => /*elided*/ any;
191
191
  };
192
192
  export declare const provider: {
193
193
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
194
194
  configure: (options: ModelOptions) => {
195
195
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
196
- model: (modelID: string | ModelID) => import("..").Model;
197
- responses: (modelID: string | ModelID) => import("..").Model;
198
- chat: (modelID: string | ModelID) => import("..").Model;
196
+ model: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
197
+ responses: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
198
+ chat: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
199
199
  configure: /*elided*/ any;
200
200
  };
201
201
  };
@@ -31,7 +31,9 @@ const configuredChatRoute = (options) => chatRoute.with({
31
31
  export const configure = (options) => {
32
32
  const responsesRoute = configuredResponsesRoute(options);
33
33
  const chatRoute = configuredChatRoute(options);
34
- const responses = (modelID) => responsesRoute.with(withOpenAIOptions(modelID, defaults(options))).model({ id: modelID });
34
+ const responses = (modelID) => responsesRoute
35
+ .with(withOpenAIOptions(modelID, defaults(options)))
36
+ .model({ id: modelID });
35
37
  const chat = (modelID) => chatRoute.with(withOpenAIOptions(modelID, defaults(options))).model({ id: modelID });
36
38
  return {
37
39
  id,
@@ -1,12 +1,14 @@
1
1
  import type { ProviderPackage } from "../provider-package";
2
2
  import type { RouteDefaultsInput } from "../route/client";
3
- import { type ModelID, type ProviderOptions } from "../schema";
3
+ import { type ModelID } from "../schema";
4
4
  import { GoogleVertexShared } from "./google-vertex-shared";
5
+ import type { OpenAIProviderOptionsInput } from "./openai-options";
5
6
  export declare const id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
6
7
  export type Config = RouteDefaultsInput & GoogleVertexShared.OAuthOptions & {
7
8
  readonly baseURL?: string;
8
9
  readonly location?: string;
9
10
  readonly project?: string;
11
+ readonly providerOptions?: OpenAIProviderOptionsInput;
10
12
  };
11
13
  export interface Settings extends ProviderPackage.Settings {
12
14
  readonly accessToken?: string;
@@ -14,7 +16,7 @@ export interface Settings extends ProviderPackage.Settings {
14
16
  readonly baseURL?: string;
15
17
  readonly location?: string;
16
18
  readonly project?: string;
17
- readonly providerOptions?: ProviderOptions;
19
+ readonly providerOptions?: OpenAIProviderOptionsInput;
18
20
  }
19
21
  export declare const routes: import("../route").Route<{
20
22
  readonly model: string;
@@ -85,15 +87,15 @@ export declare const routes: import("../route").Route<{
85
87
  }, import("../route/transport/http").HttpPrepared<string>>[];
86
88
  export declare const configure: (input?: Config) => {
87
89
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
88
- model: (modelID: string | ModelID) => import("..").Model;
90
+ model: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
89
91
  configure: (input?: Config) => /*elided*/ any;
90
92
  };
91
93
  export declare const provider: {
92
94
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
93
95
  configure: (input?: Config) => {
94
96
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
95
- model: (modelID: string | ModelID) => import("..").Model;
97
+ model: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
96
98
  configure: /*elided*/ any;
97
99
  };
98
100
  };
99
- export declare const model: ProviderPackage.Definition<Settings>["model"];
101
+ export declare const model: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
@@ -201,15 +201,15 @@ export declare const routes: Route<{
201
201
  }, import("../route/transport/http").HttpPrepared<string>>[];
202
202
  export declare const configure: (input?: Config) => {
203
203
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
204
- model: (modelID: string | ModelID) => import("..").Model;
204
+ model: (modelID: string | ModelID) => import("..").Model<AnthropicMessages.ProviderOptionsInput>;
205
205
  configure: (input?: Config) => /*elided*/ any;
206
206
  };
207
207
  export declare const provider: {
208
208
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
209
209
  configure: (input?: Config) => {
210
210
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
211
- model: (modelID: string | ModelID) => import("..").Model;
211
+ model: (modelID: string | ModelID) => import("..").Model<AnthropicMessages.ProviderOptionsInput>;
212
212
  configure: /*elided*/ any;
213
213
  };
214
214
  };
215
- export declare const model: ProviderPackage.Definition<Settings>["model"];
215
+ export declare const model: ProviderPackage.Definition<Settings, AnthropicMessages.ProviderOptionsInput>["model"];
@@ -1,12 +1,14 @@
1
1
  import type { ProviderPackage } from "../provider-package";
2
2
  import type { RouteDefaultsInput } from "../route/client";
3
- import { type ModelID, type ProviderOptions } from "../schema";
3
+ import { type ModelID } from "../schema";
4
4
  import { GoogleVertexShared } from "./google-vertex-shared";
5
+ import type { OpenResponsesProviderOptionsInput } from "./open-responses-options";
5
6
  export declare const id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
6
7
  export type Config = RouteDefaultsInput & GoogleVertexShared.OAuthOptions & {
7
8
  readonly baseURL?: string;
8
9
  readonly location?: string;
9
10
  readonly project?: string;
11
+ readonly providerOptions?: OpenResponsesProviderOptionsInput;
10
12
  };
11
13
  export interface Settings extends ProviderPackage.Settings {
12
14
  readonly accessToken?: string;
@@ -14,7 +16,7 @@ export interface Settings extends ProviderPackage.Settings {
14
16
  readonly baseURL?: string;
15
17
  readonly location?: string;
16
18
  readonly project?: string;
17
- readonly providerOptions?: ProviderOptions;
19
+ readonly providerOptions?: OpenResponsesProviderOptionsInput;
18
20
  }
19
21
  export declare const routes: import("../route").Route<{
20
22
  readonly input: readonly ({
@@ -106,15 +108,15 @@ export declare const routes: import("../route").Route<{
106
108
  }, import("../route/transport/http").HttpPrepared<string>>[];
107
109
  export declare const configure: (input?: Config) => {
108
110
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
109
- model: (modelID: string | ModelID) => import("..").Model;
111
+ model: (modelID: string | ModelID) => import("..").Model<OpenResponsesProviderOptionsInput>;
110
112
  configure: (input?: Config) => /*elided*/ any;
111
113
  };
112
114
  export declare const provider: {
113
115
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
114
116
  configure: (input?: Config) => {
115
117
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
116
- model: (modelID: string | ModelID) => import("..").Model;
118
+ model: (modelID: string | ModelID) => import("..").Model<OpenResponsesProviderOptionsInput>;
117
119
  configure: /*elided*/ any;
118
120
  };
119
121
  };
120
- export declare const model: ProviderPackage.Definition<Settings>["model"];
122
+ export declare const model: ProviderPackage.Definition<Settings, OpenResponsesProviderOptionsInput>["model"];
@@ -91,15 +91,15 @@ export declare const routes: Route<{
91
91
  }, import("../route/transport/http").HttpPrepared<string>>[];
92
92
  export declare const configure: (input?: Config) => {
93
93
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
94
- model: (modelID: string | ModelID) => import("..").Model;
94
+ model: (modelID: string | ModelID) => import("..").Model<Gemini.ProviderOptionsInput>;
95
95
  configure: (input?: Config) => /*elided*/ any;
96
96
  };
97
97
  export declare const provider: {
98
98
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
99
99
  configure: (input?: Config) => {
100
100
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
101
- model: (modelID: string | ModelID) => import("..").Model;
101
+ model: (modelID: string | ModelID) => import("..").Model<Gemini.ProviderOptionsInput>;
102
102
  configure: /*elided*/ any;
103
103
  };
104
104
  };
105
- export declare const model: ProviderPackage.Definition<Settings>["model"];
105
+ export declare const model: ProviderPackage.Definition<Settings, Gemini.ProviderOptionsInput>["model"];
@@ -83,20 +83,20 @@ export interface Settings extends ProviderPackage.Settings {
83
83
  }
84
84
  export declare const configure: (input?: Config) => {
85
85
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
86
- model: (modelID: string | ModelID) => import("..").Model;
86
+ model: (modelID: string | ModelID) => import("..").Model<Gemini.ProviderOptionsInput>;
87
87
  image: (modelID: string | ModelID) => import("..").ImageModel<import("./google").GoogleImageOptions>;
88
88
  configure: (input?: Config) => /*elided*/ any;
89
89
  };
90
90
  export declare const provider: {
91
91
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
92
- model: (modelID: string | ModelID) => import("..").Model;
92
+ model: (modelID: string | ModelID) => import("..").Model<Gemini.ProviderOptionsInput>;
93
93
  image: (modelID: string | ModelID) => import("..").ImageModel<import("./google").GoogleImageOptions>;
94
94
  configure: (input?: Config) => {
95
95
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
96
- model: (modelID: string | ModelID) => import("..").Model;
96
+ model: (modelID: string | ModelID) => import("..").Model<Gemini.ProviderOptionsInput>;
97
97
  image: (modelID: string | ModelID) => import("..").ImageModel<import("./google").GoogleImageOptions>;
98
98
  configure: /*elided*/ any;
99
99
  };
100
100
  };
101
- export declare const model: ProviderPackage.Definition<Settings>["model"];
101
+ export declare const model: ProviderPackage.Definition<Settings, Gemini.ProviderOptionsInput>["model"];
102
102
  export declare const image: (modelID: string | ModelID) => import("..").ImageModel<import("./google").GoogleImageOptions>;
@@ -106,15 +106,15 @@ export declare const routes: import("../route").Route<{
106
106
  }, import("../route/transport/http").HttpPrepared<string>>[];
107
107
  export declare const configure: (input: Config) => {
108
108
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
109
- model: (modelID: string | ModelID) => import("..").Model;
109
+ model: (modelID: string | ModelID) => import("..").Model<OpenResponsesProviderOptionsInput>;
110
110
  configure: (input: Config) => /*elided*/ any;
111
111
  };
112
112
  export declare const provider: {
113
113
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
114
114
  configure: (input: Config) => {
115
115
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
116
- model: (modelID: string | ModelID) => import("..").Model;
116
+ model: (modelID: string | ModelID) => import("..").Model<OpenResponsesProviderOptionsInput>;
117
117
  configure: /*elided*/ any;
118
118
  };
119
119
  };
120
- export declare const model: ProviderPackage.Definition<Settings>["model"];
120
+ export declare const model: ProviderPackage.Definition<Settings, OpenResponsesProviderOptionsInput>["model"];
@@ -2,18 +2,21 @@ import { type ModelID } from "../schema";
2
2
  import type { RouteDefaultsInput } from "../route/client";
3
3
  import { type ProviderAuthOption } from "../route/auth-options";
4
4
  import type { ProviderPackage } from "../provider-package";
5
+ import type { OpenAIProviderOptionsInput } from "./openai-options";
5
6
  export declare const id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
6
- type GenericModelOptions = RouteDefaultsInput & ProviderAuthOption<"optional"> & {
7
+ type GenericModelOptions = Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthOption<"optional"> & {
7
8
  readonly provider?: string;
8
9
  readonly baseURL: string;
10
+ readonly providerOptions?: OpenAIProviderOptionsInput;
9
11
  };
10
12
  export interface Settings extends ProviderPackage.Settings {
11
13
  readonly apiKey?: string;
12
14
  readonly baseURL: string;
13
15
  readonly provider?: string;
14
16
  }
15
- export type FamilyModelOptions = RouteDefaultsInput & ProviderAuthOption<"optional"> & {
17
+ export type FamilyModelOptions = Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthOption<"optional"> & {
16
18
  readonly baseURL?: string;
19
+ readonly providerOptions?: OpenAIProviderOptionsInput;
17
20
  };
18
21
  export declare const routes: import("../route").Route<{
19
22
  readonly model: string;
@@ -84,51 +87,51 @@ export declare const routes: import("../route").Route<{
84
87
  }, import("../route/transport/http").HttpPrepared<string>>[];
85
88
  export declare const configure: (input: GenericModelOptions) => {
86
89
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
87
- model: (modelID: string | ModelID) => import("..").Model;
90
+ model: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
88
91
  configure: (input: GenericModelOptions) => /*elided*/ any;
89
92
  };
90
93
  export declare const provider: {
91
94
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
92
95
  configure: (input: GenericModelOptions) => {
93
96
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
94
- model: (modelID: string | ModelID) => import("..").Model;
97
+ model: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
95
98
  configure: /*elided*/ any;
96
99
  };
97
100
  };
98
- export declare const model: ProviderPackage.Definition<Settings>["model"];
101
+ export declare const model: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
99
102
  export declare const baseten: {
100
103
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
101
- model: (modelID: string | ModelID) => import("..").Model;
104
+ model: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
102
105
  configure: (input?: FamilyModelOptions) => /*elided*/ any;
103
106
  };
104
107
  export declare const cerebras: {
105
108
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
106
- model: (modelID: string | ModelID) => import("..").Model;
109
+ model: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
107
110
  configure: (input?: FamilyModelOptions) => /*elided*/ any;
108
111
  };
109
112
  export declare const deepinfra: {
110
113
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
111
- model: (modelID: string | ModelID) => import("..").Model;
114
+ model: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
112
115
  configure: (input?: FamilyModelOptions) => /*elided*/ any;
113
116
  };
114
117
  export declare const deepseek: {
115
118
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
116
- model: (modelID: string | ModelID) => import("..").Model;
119
+ model: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
117
120
  configure: (input?: FamilyModelOptions) => /*elided*/ any;
118
121
  };
119
122
  export declare const fireworks: {
120
123
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
121
- model: (modelID: string | ModelID) => import("..").Model;
124
+ model: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
122
125
  configure: (input?: FamilyModelOptions) => /*elided*/ any;
123
126
  };
124
127
  export declare const groq: {
125
128
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
126
- model: (modelID: string | ModelID) => import("..").Model;
129
+ model: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
127
130
  configure: (input?: FamilyModelOptions) => /*elided*/ any;
128
131
  };
129
132
  export declare const togetherai: {
130
133
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
131
- model: (modelID: string | ModelID) => import("..").Model;
134
+ model: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
132
135
  configure: (input?: FamilyModelOptions) => /*elided*/ any;
133
136
  };
134
137
  export {};
@@ -313,33 +313,33 @@ export interface Settings extends ProviderPackage.Settings {
313
313
  }
314
314
  export declare const configure: (input?: Config) => {
315
315
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
316
- model: (id: string | ModelID) => import("..").Model;
317
- responses: (id: string | ModelID) => import("..").Model;
318
- responsesWebSocket: (id: string | ModelID) => import("..").Model;
319
- chat: (id: string | ModelID) => import("..").Model;
316
+ model: (id: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
317
+ responses: (id: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
318
+ responsesWebSocket: (id: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
319
+ chat: (id: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
320
320
  image: (modelID: string | ModelID) => import("..").ImageModel<import("./openai").OpenAIImageOptions>;
321
321
  configure: (input?: Config) => /*elided*/ any;
322
322
  };
323
323
  export declare const provider: {
324
324
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
325
- model: (id: string | ModelID) => import("..").Model;
326
- responses: (id: string | ModelID) => import("..").Model;
327
- responsesWebSocket: (id: string | ModelID) => import("..").Model;
328
- chat: (id: string | ModelID) => import("..").Model;
325
+ model: (id: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
326
+ responses: (id: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
327
+ responsesWebSocket: (id: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
328
+ chat: (id: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
329
329
  image: (modelID: string | ModelID) => import("..").ImageModel<import("./openai").OpenAIImageOptions>;
330
330
  configure: (input?: Config) => {
331
331
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
332
- model: (id: string | ModelID) => import("..").Model;
333
- responses: (id: string | ModelID) => import("..").Model;
334
- responsesWebSocket: (id: string | ModelID) => import("..").Model;
335
- chat: (id: string | ModelID) => import("..").Model;
332
+ model: (id: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
333
+ responses: (id: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
334
+ responsesWebSocket: (id: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
335
+ chat: (id: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
336
336
  image: (modelID: string | ModelID) => import("..").ImageModel<import("./openai").OpenAIImageOptions>;
337
337
  configure: /*elided*/ any;
338
338
  };
339
339
  };
340
- export declare const model: ProviderPackage.Definition<Settings>["model"];
341
- export declare const chatModel: ProviderPackage.Definition<Settings>["model"];
342
- export declare const responses: (id: string | ModelID) => import("..").Model;
343
- export declare const responsesWebSocket: (id: string | ModelID) => import("..").Model;
344
- export declare const chat: (id: string | ModelID) => import("..").Model;
340
+ export declare const model: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
341
+ export declare const chatModel: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
342
+ export declare const responses: (id: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
343
+ export declare const responsesWebSocket: (id: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
344
+ export declare const chat: (id: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
345
345
  export declare const image: (modelID: string | ModelID) => import("..").ImageModel<import("./openai").OpenAIImageOptions>;
@@ -38,8 +38,12 @@ export const configure = (input = {}) => {
38
38
  const responsesWebSocketRoute = configuredRoute(OpenAIResponses.webSocketRoute, input);
39
39
  const chatRoute = configuredRoute(OpenAIChat.route, input);
40
40
  const modelDefaults = defaults(input);
41
- const responses = (id) => responsesRoute.with(withOpenAIOptions(id, modelDefaults, { textVerbosity: true })).model({ id });
42
- const responsesWebSocket = (id) => responsesWebSocketRoute.with(withOpenAIOptions(id, modelDefaults, { textVerbosity: true })).model({ id });
41
+ const responses = (id) => responsesRoute
42
+ .with(withOpenAIOptions(id, modelDefaults, { textVerbosity: true }))
43
+ .model({ id });
44
+ const responsesWebSocket = (id) => responsesWebSocketRoute
45
+ .with(withOpenAIOptions(id, modelDefaults, { textVerbosity: true }))
46
+ .model({ id });
43
47
  const chat = (id) => chatRoute.with(withOpenAIOptions(id, modelDefaults)).model({ id });
44
48
  const image = (modelID) => OpenAIImages.model({
45
49
  id: modelID,
@@ -330,17 +330,17 @@ export declare const routes: Route<{
330
330
  }, import("../route/transport/http").HttpPrepared<string>>[];
331
331
  export declare const configure: (input?: ModelOptions) => {
332
332
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
333
- model: (modelID: string | ModelID) => import("..").Model;
333
+ model: (modelID: string | ModelID) => import("..").Model<OpenRouterProviderOptionsInput>;
334
334
  configure: (input?: ModelOptions) => /*elided*/ any;
335
335
  };
336
336
  export declare const provider: {
337
337
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
338
- model: (modelID: string | ModelID) => import("..").Model;
338
+ model: (modelID: string | ModelID) => import("..").Model<OpenRouterProviderOptionsInput>;
339
339
  configure: (input?: ModelOptions) => {
340
340
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
341
- model: (modelID: string | ModelID) => import("..").Model;
341
+ model: (modelID: string | ModelID) => import("..").Model<OpenRouterProviderOptionsInput>;
342
342
  configure: /*elided*/ any;
343
343
  };
344
344
  };
345
- export declare const model: (modelID: string | ModelID) => import("..").Model;
345
+ export declare const model: (modelID: string | ModelID) => import("..").Model<OpenRouterProviderOptionsInput>;
346
346
  export {};
@@ -1,9 +1,11 @@
1
1
  import { type ProviderAuthOption } from "../route/auth-options";
2
2
  import type { RouteDefaultsInput } from "../route/client";
3
3
  import { type ModelID } from "../schema";
4
+ import type { OpenAIProviderOptionsInput } from "./openai-options";
4
5
  export declare const id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
5
- export type ModelOptions = RouteDefaultsInput & ProviderAuthOption<"optional"> & {
6
+ export type ModelOptions = Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthOption<"optional"> & {
6
7
  readonly baseURL?: string;
8
+ readonly providerOptions?: OpenAIProviderOptionsInput;
7
9
  };
8
10
  export type { XAIImageOptions } from "../protocols/xai-images";
9
11
  export declare const routes: (import("../route").Route<{
@@ -181,28 +183,28 @@ export declare const routes: (import("../route").Route<{
181
183
  }, import("../route/transport/http").HttpPrepared<string>>)[];
182
184
  export declare const configure: (input?: ModelOptions) => {
183
185
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
184
- model: (modelID: string | ModelID) => import("..").Model;
185
- responses: (modelID: string | ModelID) => import("..").Model;
186
- chat: (modelID: string | ModelID) => import("..").Model;
186
+ model: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
187
+ responses: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
188
+ chat: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
187
189
  image: (modelID: string | ModelID) => import("..").ImageModel<import("./xai").XAIImageOptions>;
188
190
  configure: (input?: ModelOptions) => /*elided*/ any;
189
191
  };
190
192
  export declare const provider: {
191
193
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
192
- model: (modelID: string | ModelID) => import("..").Model;
193
- responses: (modelID: string | ModelID) => import("..").Model;
194
- chat: (modelID: string | ModelID) => import("..").Model;
194
+ model: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
195
+ responses: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
196
+ chat: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
195
197
  image: (modelID: string | ModelID) => import("..").ImageModel<import("./xai").XAIImageOptions>;
196
198
  configure: (input?: ModelOptions) => {
197
199
  id: string & import("effect/Brand").Brand<"LLM.ProviderID">;
198
- model: (modelID: string | ModelID) => import("..").Model;
199
- responses: (modelID: string | ModelID) => import("..").Model;
200
- chat: (modelID: string | ModelID) => import("..").Model;
200
+ model: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
201
+ responses: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
202
+ chat: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
201
203
  image: (modelID: string | ModelID) => import("..").ImageModel<import("./xai").XAIImageOptions>;
202
204
  configure: /*elided*/ any;
203
205
  };
204
206
  };
205
- export declare const model: (modelID: string | ModelID) => import("..").Model;
206
- export declare const responses: (modelID: string | ModelID) => import("..").Model;
207
- export declare const chat: (modelID: string | ModelID) => import("..").Model;
207
+ export declare const model: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
208
+ export declare const responses: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
209
+ export declare const chat: (modelID: string | ModelID) => import("..").Model<OpenAIProviderOptionsInput>;
208
210
  export declare const image: (modelID: string | ModelID) => import("..").ImageModel<import("./xai").XAIImageOptions>;
@@ -6,7 +6,7 @@ import { Framing } from "./framing";
6
6
  import { HttpTransport } from "./transport";
7
7
  import type { Transport, TransportRuntime } from "./transport";
8
8
  import type { Protocol } from "./protocol";
9
- import type { LLMError, PreparedRequestOf, ProtocolID, ProviderOptions } from "../schema";
9
+ import type { LLMError, ProtocolID, ProviderOptions } from "../schema";
10
10
  import { GenerationOptions, HttpOptions, LLMRequest, LLMResponse, Model, ModelLimits, LLMEvent, ProviderID } from "../schema";
11
11
  export interface RouteBody<Body> {
12
12
  /** Schema for the validated provider-native body sent as the JSON request. */
@@ -26,7 +26,7 @@ export interface Route<Body, Prepared = unknown> {
26
26
  readonly defaults: RouteDefaults;
27
27
  readonly body: RouteBody<Body>;
28
28
  readonly with: (patch: RoutePatch<Body, Prepared>) => Route<Body, Prepared>;
29
- readonly model: (input: RouteMappedModelInput) => Model;
29
+ readonly model: <Options extends ProviderOptions = ProviderOptions>(input: RouteMappedModelInput) => Model<Options>;
30
30
  readonly prepareTransport: (body: Body, request: LLMRequest) => Effect.Effect<Prepared, LLMError>;
31
31
  readonly streamPrepared: (prepared: Prepared, request: LLMRequest, runtime: TransportRuntime) => Stream.Stream<LLMEvent, LLMError>;
32
32
  }
@@ -59,17 +59,6 @@ type RouteMappedModelInput = RouteModelInput | RouteRoutedModelInput;
59
59
  export declare const generationOptions: (input: GenerationOptions.Input | undefined) => GenerationOptions | undefined;
60
60
  export declare const httpOptions: (input: HttpOptionsInput | undefined) => HttpOptions | undefined;
61
61
  export interface Interface {
62
- /**
63
- * Compile a request through protocol body construction, validation, and HTTP
64
- * preparation without sending it. Returns the prepared request including the
65
- * provider-native body.
66
- *
67
- * Pass a `Body` type argument to statically expose the route's body
68
- * shape (e.g. `prepare<OpenAIChatBody>(...)`) — the runtime body is
69
- * identical, so this is a type-level assertion the caller makes about which
70
- * route the request will resolve to.
71
- */
72
- readonly prepare: <Body = unknown>(request: LLMRequest) => Effect.Effect<PreparedRequestOf<Body>, LLMError>;
73
62
  readonly stream: StreamMethod;
74
63
  readonly generate: GenerateMethod;
75
64
  }
@@ -143,7 +132,21 @@ export declare function make<Body, Prepared, Frame, Event, State>(input: MakeTra
143
132
  * the public surface preemptively.
144
133
  */
145
134
  export declare function make<Body, Frame, Event, State>(input: MakeInput<Body, Frame, Event, State>): Route<Body, HttpTransport.HttpPrepared<Frame>>;
146
- export declare const prepare: <Body = unknown>(request: LLMRequest) => Effect.Effect<PreparedRequestOf<Body>, LLMError>;
135
+ /** @internal Test-only projection of the execution compiler; not exported from package barrels. */
136
+ export declare const compileRequest: (request: LLMRequest) => Effect.Effect<{
137
+ id: string;
138
+ route: string;
139
+ protocol: string;
140
+ model: Model<{
141
+ readonly [x: string]: {
142
+ readonly [x: string]: unknown;
143
+ };
144
+ }>;
145
+ body: any;
146
+ metadata: {
147
+ transport: string;
148
+ };
149
+ }, LLMError, never>;
147
150
  export declare function stream(request: LLMRequest): Stream.Stream<LLMEvent, LLMError>;
148
151
  export declare function generate(request: LLMRequest): Effect.Effect<LLMResponse, LLMError>;
149
152
  export declare const streamRequest: (request: LLMRequest) => Stream.Stream<{
@@ -335,7 +338,6 @@ export declare const Route: {
335
338
  export declare const LLMClient: {
336
339
  readonly Service: typeof Service;
337
340
  readonly layer: Layer.Layer<Service, never, RequestExecutor.Service>;
338
- readonly prepare: <Body = unknown>(request: LLMRequest) => Effect.Effect<PreparedRequestOf<Body>, LLMError>;
339
341
  readonly stream: typeof stream;
340
342
  readonly generate: typeof generate;
341
343
  };
@@ -8,7 +8,7 @@ import { HttpTransport } from "./transport";
8
8
  import { WebSocketExecutor } from "./transport";
9
9
  import { applyCachePolicy } from "../cache-policy";
10
10
  import * as ProviderShared from "../protocols/shared";
11
- import { GenerationOptions, HttpOptions, LLMRequest, LLMResponse, Model, ModelLimits, LLMError as LLMErrorClass, LLMEvent, PreparedRequest, ProviderID, mergeGenerationOptions, mergeHttpOptions, mergeProviderOptions, } from "../schema";
11
+ import { GenerationOptions, HttpOptions, LLMRequest, LLMResponse, Model, ModelLimits, LLMError as LLMErrorClass, LLMEvent, ProviderID, mergeGenerationOptions, mergeHttpOptions, mergeProviderOptions, } from "../schema";
12
12
  const makeRouteModel = (route, mapped) => {
13
13
  const provider = route.provider ?? ("provider" in mapped ? mapped.provider : undefined);
14
14
  if (!provider)
@@ -141,9 +141,6 @@ export function make(input) {
141
141
  defaults: input.defaults,
142
142
  });
143
143
  }
144
- // `compile` is the important boundary: it turns a common `LLMRequest` into a
145
- // validated provider body plus transport-private prepared data, but does not
146
- // execute transport.
147
144
  const compile = Effect.fn("LLM.compile")(function* (request) {
148
145
  const resolved = applyCachePolicy(resolveRequestOptions(request));
149
146
  const route = resolved.model.route;
@@ -158,16 +155,17 @@ const compile = Effect.fn("LLM.compile")(function* (request) {
158
155
  prepared,
159
156
  };
160
157
  });
161
- const prepareWith = Effect.fn("LLMClient.prepare")(function* (request) {
158
+ /** @internal Test-only projection of the execution compiler; not exported from package barrels. */
159
+ export const compileRequest = Effect.fn("LLM.compileRequest")(function* (request) {
162
160
  const compiled = yield* compile(request);
163
- return new PreparedRequest({
161
+ return {
164
162
  id: compiled.request.id ?? "request",
165
163
  route: compiled.route.id,
166
164
  protocol: compiled.route.protocol,
167
165
  model: compiled.request.model,
168
166
  body: compiled.body,
169
167
  metadata: { transport: compiled.route.transport.id },
170
- });
168
+ };
171
169
  });
172
170
  const streamRequestWith = (runtime) => (request) => Stream.unwrap(Effect.gen(function* () {
173
171
  const compiled = yield* compile(request);
@@ -180,7 +178,6 @@ const generateWith = (stream) => Effect.fn("LLM.generate")(function* (request) {
180
178
  return response;
181
179
  return yield* ProviderShared.eventError(`${request.model.provider}/${request.model.route.id}`, "Provider stream ended without a terminal finish event");
182
180
  });
183
- export const prepare = (request) => prepareWith(request);
184
181
  export function stream(request) {
185
182
  return Stream.unwrap(Effect.gen(function* () {
186
183
  return (yield* Service).stream(request);
@@ -199,13 +196,12 @@ export const layer = Layer.effect(Service, Effect.gen(function* () {
199
196
  http: yield* RequestExecutor.Service,
200
197
  webSocket: Option.getOrUndefined(yield* Effect.serviceOption(WebSocketExecutor.Service)),
201
198
  });
202
- return Service.of({ prepare: prepareWith, stream, generate: generateWith(stream) });
199
+ return Service.of({ stream, generate: generateWith(stream) });
203
200
  }));
204
201
  export const Route = { make };
205
202
  export const LLMClient = {
206
203
  Service,
207
204
  layer,
208
- prepare,
209
205
  stream,
210
206
  generate,
211
207
  };
@@ -2446,29 +2446,6 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.Struct<{
2446
2446
  };
2447
2447
  };
2448
2448
  export type LLMEvent = Schema.Schema.Type<typeof llmEventTagged>;
2449
- declare const PreparedRequest_base: Schema.Class<PreparedRequest, Schema.Struct<{
2450
- readonly id: Schema.String;
2451
- readonly route: Schema.String;
2452
- readonly protocol: Schema.String;
2453
- readonly model: Schema.declare<import("./options").Model, import("./options").Model>;
2454
- readonly body: Schema.Unknown;
2455
- readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
2456
- }>, {}>;
2457
- export declare class PreparedRequest extends PreparedRequest_base {
2458
- }
2459
- /**
2460
- * A `PreparedRequest` whose `body` is typed as `Body`. Use with the generic
2461
- * on `LLMClient.prepare<Body>(...)` when the caller knows which route their
2462
- * request will resolve to and wants its native shape statically exposed
2463
- * (debug UIs, request previews, plan rendering).
2464
- *
2465
- * The runtime body is identical — the route still emits `body: unknown` — so
2466
- * this is a type-level assertion the caller makes about what they expect to
2467
- * find. The prepare runtime does not validate the assertion.
2468
- */
2469
- export type PreparedRequestOf<Body> = Omit<PreparedRequest, "body"> & {
2470
- readonly body: Body;
2471
- };
2472
2449
  interface ContentAssembly {
2473
2450
  readonly contentIndex: number;
2474
2451
  readonly text: string;
@@ -1,6 +1,5 @@
1
1
  import { Schema } from "effect";
2
- import { ContentBlockID, FinishReason, ProtocolID, ProviderMetadata, RouteID, ToolCallID } from "./ids";
3
- import { ModelSchema } from "./options";
2
+ import { ContentBlockID, FinishReason, ProviderMetadata, ToolCallID } from "./ids";
4
3
  import { Message, ToolCallPart, ToolOutput, ToolResultPart, ToolResultValue } from "./messages";
5
4
  import { ProviderFailureClassification } from "./errors";
6
5
  /**
@@ -255,15 +254,6 @@ export const LLMEvent = Object.assign(llmEventTagged, {
255
254
  providerError: llmEventTagged.guards["provider-error"],
256
255
  },
257
256
  });
258
- export class PreparedRequest extends Schema.Class("LLM.PreparedRequest")({
259
- id: Schema.String,
260
- route: RouteID,
261
- protocol: ProtocolID,
262
- model: ModelSchema,
263
- body: Schema.Unknown,
264
- metadata: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),
265
- }) {
266
- }
267
257
  const responseText = (events) => events
268
258
  .filter(LLMEvent.is.textDelta)
269
259
  .map((event) => event.text)
@@ -330,7 +330,15 @@ export declare namespace ToolChoice {
330
330
  }
331
331
  declare const LLMRequest_base: Schema.Class<LLMRequest, Schema.Struct<{
332
332
  readonly id: Schema.optional<Schema.String>;
333
- readonly model: Schema.declare<import("./options").Model, import("./options").Model>;
333
+ readonly model: Schema.declare<import("./options").Model<{
334
+ readonly [x: string]: {
335
+ readonly [x: string]: unknown;
336
+ };
337
+ }>, import("./options").Model<{
338
+ readonly [x: string]: {
339
+ readonly [x: string]: unknown;
340
+ };
341
+ }>>;
334
342
  readonly system: Schema.$Array<Schema.Struct<{
335
343
  readonly type: Schema.Literal<"text">;
336
344
  readonly text: Schema.String;
@@ -89,16 +89,17 @@ export declare namespace ModelCompatibility {
89
89
  /** Normalize model/upstream compatibility metadata without projecting requests. */
90
90
  const make: (input: Input) => ModelCompatibility;
91
91
  }
92
- export declare class Model {
92
+ export declare class Model<Options extends ProviderOptions = ProviderOptions> {
93
+ protected readonly _ProviderOptions: Options;
93
94
  readonly id: ModelID;
94
95
  readonly provider: ProviderID;
95
96
  readonly route: AnyRoute;
96
97
  readonly defaults?: ModelDefaults;
97
98
  readonly compatibility?: ModelCompatibility;
98
99
  constructor(input: Model.ConstructorInput);
99
- static make(input: Model.Input): Model;
100
- static input(model: Model): Model.ConstructorInput;
101
- static update(model: Model, patch: Partial<Model.Input>): Model;
100
+ static make<Options extends ProviderOptions = ProviderOptions>(input: Model.Input): Model<Options>;
101
+ static input<Options extends ProviderOptions>(model: Model<Options>): Model.ConstructorInput;
102
+ static update<Options extends ProviderOptions>(model: Model<Options>, patch: Partial<Model.Input>): Model<Options>;
102
103
  }
103
104
  export declare namespace Model {
104
105
  type ConstructorInput = {
@@ -116,7 +117,16 @@ export declare namespace Model {
116
117
  };
117
118
  }
118
119
  export type ModelInput = Model.Input;
119
- export declare const ModelSchema: Schema.declare<Model, Model>;
120
+ export type ModelProviderOptions<SelectedModel> = SelectedModel extends Model<infer Options> ? Options : never;
121
+ export declare const ModelSchema: Schema.declare<Model<{
122
+ readonly [x: string]: {
123
+ readonly [x: string]: unknown;
124
+ };
125
+ }>, Model<{
126
+ readonly [x: string]: {
127
+ readonly [x: string]: unknown;
128
+ };
129
+ }>>;
120
130
  declare const CacheHint_base: Schema.Class<CacheHint, Schema.Struct<{
121
131
  readonly type: Schema.Literals<readonly ["ephemeral", "persistent"]>;
122
132
  readonly ttlSeconds: Schema.optional<Schema.Number>;
package/dist/testing.js CHANGED
@@ -45,7 +45,6 @@ export const layer = (options = {}) => Layer.effect(Service, Effect.gen(function
45
45
  return Stream.unwrap(Queue.offer(gate.started, undefined).pipe(Effect.andThen(gate.release.await), Effect.as(streamed)));
46
46
  });
47
47
  const client = LLMClient.Service.of({
48
- prepare: () => Effect.die("TestLLM does not prepare provider-native requests"),
49
48
  stream,
50
49
  generate: (request) => stream(request).pipe(Stream.runFold(LLMResponse.empty, LLMResponse.reduce), Effect.flatMap((state) => {
51
50
  const response = LLMResponse.complete(state);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
- "version": "0.0.0-next-16420",
3
+ "version": "0.0.0-next-16473",
4
4
  "name": "@opencode-ai/ai",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -30,7 +30,7 @@
30
30
  "devDependencies": {
31
31
  "@clack/prompts": "1.0.0-alpha.1",
32
32
  "@effect/platform-node": "4.0.0-beta.101",
33
- "@opencode-ai/http-recorder": "0.0.0-next-16420",
33
+ "@opencode-ai/http-recorder": "0.0.0-next-16473",
34
34
  "@tsconfig/bun": "1.0.9",
35
35
  "@types/bun": "1.3.13",
36
36
  "@typescript/native-preview": "7.0.0-dev.20251207.1",
@@ -39,7 +39,7 @@
39
39
  "dependencies": {
40
40
  "@smithy/eventstream-codec": "4.2.14",
41
41
  "@smithy/util-utf8": "4.2.2",
42
- "@opencode-ai/schema": "0.0.0-next-16420",
42
+ "@opencode-ai/schema": "0.0.0-next-16473",
43
43
  "aws4fetch": "1.0.20",
44
44
  "effect": "4.0.0-beta.101",
45
45
  "google-auth-library": "10.5.0"