@effect/ai-openrouter 4.0.0-beta.65 → 4.0.0-beta.67

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.
@@ -26,10 +26,6 @@ declare const Config_base: Context.ServiceClass<Config, "@effect/ai-openrouter/O
26
26
  readonly summary?: "auto" | "concise" | "detailed" | null;
27
27
  };
28
28
  readonly provider?: {
29
- readonly sort?: "price" | "throughput" | "latency" | {
30
- readonly by?: "price" | "throughput" | "latency" | null;
31
- readonly partition?: "none" | "model" | null;
32
- } | null;
33
29
  readonly allow_fallbacks?: boolean | null;
34
30
  readonly require_parameters?: boolean | null;
35
31
  readonly data_collection?: "deny" | "allow" | null;
@@ -39,12 +35,16 @@ declare const Config_base: Context.ServiceClass<Config, "@effect/ai-openrouter/O
39
35
  readonly only?: readonly string[] | null;
40
36
  readonly ignore?: readonly string[] | null;
41
37
  readonly quantizations?: readonly ("int4" | "int8" | "fp4" | "fp6" | "fp8" | "fp16" | "bf16" | "fp32" | "unknown")[] | null;
38
+ readonly sort?: "price" | "throughput" | "latency" | {
39
+ readonly by?: "price" | "throughput" | "latency" | null;
40
+ readonly partition?: "none" | "model" | null;
41
+ } | null;
42
42
  readonly max_price?: {
43
- readonly image?: unknown;
44
- readonly request?: unknown;
45
- readonly audio?: unknown;
46
43
  readonly prompt?: unknown;
47
44
  readonly completion?: unknown;
45
+ readonly image?: unknown;
46
+ readonly audio?: unknown;
47
+ readonly request?: unknown;
48
48
  };
49
49
  readonly preferred_min_throughput?: number | {
50
50
  readonly p50?: number | null;
@@ -68,9 +68,9 @@ declare const Config_base: Context.ServiceClass<Config, "@effect/ai-openrouter/O
68
68
  } | {
69
69
  readonly id: "web";
70
70
  readonly enabled?: boolean;
71
- readonly engine?: "native" | "exa";
72
71
  readonly max_results?: number;
73
72
  readonly search_prompt?: string;
73
+ readonly engine?: "native" | "exa";
74
74
  } | {
75
75
  readonly id: "file-parser";
76
76
  readonly enabled?: boolean;
@@ -101,25 +101,40 @@ declare const Config_base: Context.ServiceClass<Config, "@effect/ai-openrouter/O
101
101
  /**
102
102
  * Service definition for OpenRouter language model configuration.
103
103
  *
104
- * @since 1.0.0
105
104
  * @category services
105
+ * @since 4.0.0
106
106
  */
107
107
  export declare class Config extends Config_base {
108
108
  }
109
109
  /**
110
- * @since 1.0.0
110
+ * OpenRouter assistant reasoning detail blocks preserved for multi-turn
111
+ * conversations.
112
+ *
111
113
  * @category models
114
+ * @since 4.0.0
112
115
  */
113
116
  export type ReasoningDetails = Exclude<typeof Generated.AssistantMessage.Encoded["reasoning_details"], undefined>;
114
117
  /**
115
- * @since 1.0.0
118
+ * File annotations emitted on OpenRouter assistant messages and exposed in
119
+ * finish metadata.
120
+ *
116
121
  * @category models
122
+ * @since 4.0.0
117
123
  */
118
124
  export type FileAnnotation = Extract<NonNullable<typeof Generated.AssistantMessage.fields.annotations.Type>[number], {
119
125
  type: "file";
120
126
  }>;
121
127
  declare module "effect/unstable/ai/Prompt" {
128
+ /**
129
+ * OpenRouter-specific options for system messages.
130
+ *
131
+ * These options are used when translating system instructions into
132
+ * OpenRouter chat messages.
133
+ */
122
134
  interface SystemMessageOptions extends ProviderOptions {
135
+ /**
136
+ * Provider-specific options sent to OpenRouter for the system message.
137
+ */
123
138
  readonly openrouter?: {
124
139
  /**
125
140
  * A breakpoint which marks the end of reusable content eligible for caching.
@@ -127,7 +142,16 @@ declare module "effect/unstable/ai/Prompt" {
127
142
  readonly cacheControl?: typeof Generated.ChatMessageContentItemCacheControl.Encoded | null;
128
143
  } | null;
129
144
  }
145
+ /**
146
+ * OpenRouter-specific options for user messages.
147
+ *
148
+ * These options are used when translating user content into OpenRouter chat
149
+ * messages.
150
+ */
130
151
  interface UserMessageOptions extends ProviderOptions {
152
+ /**
153
+ * Provider-specific options sent to OpenRouter for the user message.
154
+ */
131
155
  readonly openrouter?: {
132
156
  /**
133
157
  * A breakpoint which marks the end of reusable content eligible for caching.
@@ -135,7 +159,16 @@ declare module "effect/unstable/ai/Prompt" {
135
159
  readonly cacheControl?: typeof Generated.ChatMessageContentItemCacheControl.Encoded | null;
136
160
  } | null;
137
161
  }
162
+ /**
163
+ * OpenRouter-specific options for assistant messages.
164
+ *
165
+ * Preserves reasoning metadata when assistant messages are replayed in later
166
+ * OpenRouter requests.
167
+ */
138
168
  interface AssistantMessageOptions extends ProviderOptions {
169
+ /**
170
+ * Provider-specific options sent to OpenRouter for the assistant message.
171
+ */
139
172
  readonly openrouter?: {
140
173
  /**
141
174
  * A breakpoint which marks the end of reusable content eligible for caching.
@@ -147,7 +180,16 @@ declare module "effect/unstable/ai/Prompt" {
147
180
  readonly reasoningDetails?: ReasoningDetails | null;
148
181
  } | null;
149
182
  }
183
+ /**
184
+ * OpenRouter-specific options for tool messages.
185
+ *
186
+ * These options are used when converting tool results into OpenRouter chat
187
+ * messages.
188
+ */
150
189
  interface ToolMessageOptions extends ProviderOptions {
190
+ /**
191
+ * Provider-specific options sent to OpenRouter for the tool message.
192
+ */
151
193
  readonly openrouter?: {
152
194
  /**
153
195
  * A breakpoint which marks the end of reusable content eligible for caching.
@@ -155,7 +197,15 @@ declare module "effect/unstable/ai/Prompt" {
155
197
  readonly cacheControl?: typeof Generated.ChatMessageContentItemCacheControl.Encoded | null;
156
198
  } | null;
157
199
  }
200
+ /**
201
+ * OpenRouter-specific options for text prompt parts.
202
+ *
203
+ * Use these options to control how text content is sent to OpenRouter.
204
+ */
158
205
  interface TextPartOptions extends ProviderOptions {
206
+ /**
207
+ * Provider-specific options sent to OpenRouter for the text part.
208
+ */
159
209
  readonly openrouter?: {
160
210
  /**
161
211
  * A breakpoint which marks the end of reusable content eligible for caching.
@@ -163,7 +213,16 @@ declare module "effect/unstable/ai/Prompt" {
163
213
  readonly cacheControl?: typeof Generated.ChatMessageContentItemCacheControl.Encoded | null;
164
214
  } | null;
165
215
  }
216
+ /**
217
+ * OpenRouter-specific options for reasoning prompt parts.
218
+ *
219
+ * Preserves provider reasoning blocks so reasoning-aware conversations can
220
+ * continue across OpenRouter requests.
221
+ */
166
222
  interface ReasoningPartOptions extends ProviderOptions {
223
+ /**
224
+ * Provider-specific options sent to OpenRouter for the reasoning part.
225
+ */
167
226
  readonly openrouter?: {
168
227
  /**
169
228
  * A breakpoint which marks the end of reusable content eligible for caching.
@@ -175,7 +234,15 @@ declare module "effect/unstable/ai/Prompt" {
175
234
  readonly reasoningDetails?: ReasoningDetails | null;
176
235
  } | null;
177
236
  }
237
+ /**
238
+ * OpenRouter-specific options for file prompt parts.
239
+ *
240
+ * Controls file naming and prompt caching for files sent to OpenRouter.
241
+ */
178
242
  interface FilePartOptions extends ProviderOptions {
243
+ /**
244
+ * Provider-specific options sent to OpenRouter for the file part.
245
+ */
179
246
  readonly openrouter?: {
180
247
  /**
181
248
  * The name to give to the file. Will be prioritized over the file name
@@ -188,7 +255,16 @@ declare module "effect/unstable/ai/Prompt" {
188
255
  readonly cacheControl?: typeof Generated.ChatMessageContentItemCacheControl.Encoded | null;
189
256
  } | null;
190
257
  }
258
+ /**
259
+ * OpenRouter-specific options for tool call prompt parts.
260
+ *
261
+ * Preserves reasoning details associated with tool calls when a conversation
262
+ * is sent back to OpenRouter.
263
+ */
191
264
  interface ToolCallPartOptions extends ProviderOptions {
265
+ /**
266
+ * Provider-specific options sent to OpenRouter for the tool call part.
267
+ */
192
268
  readonly openrouter?: {
193
269
  /**
194
270
  * Reasoning details associated with the tool call part.
@@ -196,7 +272,15 @@ declare module "effect/unstable/ai/Prompt" {
196
272
  readonly reasoningDetails?: ReasoningDetails | null;
197
273
  } | null;
198
274
  }
275
+ /**
276
+ * OpenRouter-specific options for tool result prompt parts.
277
+ *
278
+ * Controls prompt caching for tool results sent to OpenRouter.
279
+ */
199
280
  interface ToolResultPartOptions extends ProviderOptions {
281
+ /**
282
+ * Provider-specific options sent to OpenRouter for the tool result part.
283
+ */
200
284
  readonly openrouter?: {
201
285
  /**
202
286
  * A breakpoint which marks the end of reusable content eligible for caching.
@@ -206,52 +290,138 @@ declare module "effect/unstable/ai/Prompt" {
206
290
  }
207
291
  }
208
292
  declare module "effect/unstable/ai/Response" {
293
+ /**
294
+ * OpenRouter metadata attached to completed reasoning response parts.
295
+ *
296
+ * Preserves provider reasoning details that can be sent back in later turns.
297
+ */
209
298
  interface ReasoningPartMetadata extends ProviderMetadata {
299
+ /**
300
+ * Provider-specific metadata returned for the reasoning part.
301
+ */
210
302
  readonly openrouter?: {
303
+ /**
304
+ * Reasoning details emitted by the underlying provider for this part.
305
+ */
211
306
  readonly reasoningDetails?: ReasoningDetails | null;
212
307
  } | null;
213
308
  }
309
+ /**
310
+ * OpenRouter metadata emitted when a streamed reasoning part starts.
311
+ *
312
+ * Carries the first reasoning detail chunk when OpenRouter exposes one.
313
+ */
214
314
  interface ReasoningStartPartMetadata extends ProviderMetadata {
315
+ /**
316
+ * Provider-specific metadata returned for the streamed reasoning start.
317
+ */
215
318
  readonly openrouter?: {
319
+ /**
320
+ * Reasoning details emitted by the underlying provider for this part.
321
+ */
216
322
  readonly reasoningDetails?: ReasoningDetails | null;
217
323
  } | null;
218
324
  }
325
+ /**
326
+ * OpenRouter metadata emitted for streamed reasoning deltas.
327
+ *
328
+ * Carries provider reasoning detail chunks as they arrive from OpenRouter.
329
+ */
219
330
  interface ReasoningDeltaPartMetadata extends ProviderMetadata {
331
+ /**
332
+ * Provider-specific metadata returned for the streamed reasoning delta.
333
+ */
220
334
  readonly openrouter?: {
335
+ /**
336
+ * Reasoning details emitted by the underlying provider for this delta.
337
+ */
221
338
  readonly reasoningDetails?: ReasoningDetails | null;
222
339
  } | null;
223
340
  }
341
+ /**
342
+ * OpenRouter metadata attached to tool-call response parts.
343
+ *
344
+ * Associates tool calls with provider reasoning details when the model emits
345
+ * reasoning and tool calls together.
346
+ */
224
347
  interface ToolCallPartMetadata extends ProviderMetadata {
348
+ /**
349
+ * Provider-specific metadata returned for the tool call.
350
+ */
225
351
  readonly openrouter?: {
352
+ /**
353
+ * Reasoning details associated with this tool call.
354
+ */
226
355
  readonly reasoningDetails?: ReasoningDetails | null;
227
356
  } | null;
228
357
  }
358
+ /**
359
+ * OpenRouter metadata attached to URL source citations.
360
+ *
361
+ * Includes citation text and offsets returned by providers that support URL
362
+ * annotations.
363
+ */
229
364
  interface UrlSourcePartMetadata extends ProviderMetadata {
365
+ /**
366
+ * Provider-specific citation metadata returned for the URL source.
367
+ */
230
368
  readonly openrouter?: {
369
+ /**
370
+ * The cited source content returned by the provider.
371
+ */
231
372
  readonly content?: string | null;
373
+ /**
374
+ * The zero-based start index of the citation in the generated text.
375
+ */
232
376
  readonly startIndex?: number | null;
377
+ /**
378
+ * The zero-based end index of the citation in the generated text.
379
+ */
233
380
  readonly endIndex?: number | null;
234
381
  } | null;
235
382
  }
383
+ /**
384
+ * OpenRouter metadata attached to finish response parts.
385
+ *
386
+ * Exposes provider response details that are not represented by the common
387
+ * Effect AI finish part fields.
388
+ */
236
389
  interface FinishPartMetadata extends ProviderMetadata {
390
+ /**
391
+ * Provider-specific metadata returned when the OpenRouter response finishes.
392
+ */
237
393
  readonly openrouter?: {
394
+ /**
395
+ * Provider fingerprint for the backend configuration that served the request.
396
+ */
238
397
  readonly systemFingerprint?: string | null;
398
+ /**
399
+ * Raw token usage reported by OpenRouter.
400
+ */
239
401
  readonly usage?: typeof Generated.ChatGenerationTokenUsage.Encoded | null;
402
+ /**
403
+ * File annotations returned by the provider.
404
+ */
240
405
  readonly annotations?: ReadonlyArray<FileAnnotation> | null;
406
+ /**
407
+ * The OpenRouter provider that served the request, when reported.
408
+ */
241
409
  readonly provider?: string | null;
242
410
  } | null;
243
411
  }
244
412
  }
245
413
  /**
246
- * @since 1.0.0
414
+ * Creates an AI model descriptor for an OpenRouter language model.
415
+ *
247
416
  * @category constructors
417
+ * @since 4.0.0
248
418
  */
249
419
  export declare const model: (model: string, config?: Omit<typeof Config.Service, "model">) => AiModel.Model<"openai", LanguageModel.LanguageModel, OpenRouterClient>;
250
420
  /**
251
421
  * Creates an OpenRouter language model service.
252
422
  *
253
- * @since 1.0.0
254
423
  * @category constructors
424
+ * @since 4.0.0
255
425
  */
256
426
  export declare const make: (args_0: {
257
427
  readonly model: string;
@@ -260,8 +430,8 @@ export declare const make: (args_0: {
260
430
  /**
261
431
  * Creates a layer for the OpenRouter language model.
262
432
  *
263
- * @since 1.0.0
264
433
  * @category layers
434
+ * @since 4.0.0
265
435
  */
266
436
  export declare const layer: (options: {
267
437
  readonly model: string;
@@ -270,22 +440,22 @@ export declare const layer: (options: {
270
440
  /**
271
441
  * Provides config overrides for OpenRouter language model operations.
272
442
  *
273
- * @since 1.0.0
274
443
  * @category configuration
444
+ * @since 4.0.0
275
445
  */
276
446
  export declare const withConfigOverride: {
277
447
  /**
278
448
  * Provides config overrides for OpenRouter language model operations.
279
449
  *
280
- * @since 1.0.0
281
450
  * @category configuration
451
+ * @since 4.0.0
282
452
  */
283
453
  (overrides: typeof Config.Service): <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Config>>;
284
454
  /**
285
455
  * Provides config overrides for OpenRouter language model operations.
286
456
  *
287
- * @since 1.0.0
288
457
  * @category configuration
458
+ * @since 4.0.0
289
459
  */
290
460
  <A, E, R>(self: Effect.Effect<A, E, R>, overrides: typeof Config.Service): Effect.Effect<A, E, Exclude<R, Config>>;
291
461
  };
@@ -1 +1 @@
1
- {"version":3,"file":"OpenRouterLanguageModel.d.ts","sourceRoot":"","sources":["../src/OpenRouterLanguageModel.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AAEzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAGvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAYrC,OAAO,KAAK,aAAa,MAAM,kCAAkC,CAAA;AACjE,OAAO,KAAK,OAAO,MAAM,0BAA0B,CAAA;AAQnD,OAAO,KAAK,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAEhD,OAAO,EAAuC,gBAAgB,EAAE,MAA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BAAkB,EAAE;IAC/B;;;;;OAKG;IACH,CAAC,SAAS,EAAE,OAAO,MAAM,CAAC,OAAO,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAA;IACtH;;;;;OAKG;IACH,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAA;CAwBhH,CAAA"}
@@ -1,5 +1,25 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * The `OpenRouterLanguageModel` module provides constructors for using
3
+ * OpenRouter chat completion models through the Effect AI `LanguageModel`
4
+ * interface. It adapts Effect prompts, tools, structured output schemas, file
5
+ * parts, reasoning details, cache-control hints, and telemetry annotations into
6
+ * the OpenRouter request and response formats.
7
+ *
8
+ * Use this module when an application wants to select an OpenRouter model by
9
+ * name while keeping the rest of its AI workflow provider-agnostic. The
10
+ * exported layer and model constructors install a `LanguageModel` service backed
11
+ * by `OpenRouterClient`, and `withConfigOverride` can scope per-request
12
+ * OpenRouter options such as sampling, routing, tool use, or JSON schema
13
+ * behavior.
14
+ *
15
+ * OpenRouter routes requests to many underlying providers, so model support for
16
+ * images, files, tools, structured outputs, caching, and reasoning metadata can
17
+ * vary. Provider-specific prompt and response metadata is preserved under the
18
+ * `openrouter` option namespace so multi-turn conversations can round-trip
19
+ * details such as reasoning blocks and file annotations when the selected model
20
+ * supports them.
21
+ *
22
+ * @since 4.0.0
3
23
  */
4
24
  /** @effect-diagnostics preferSchemaOverJson:skip-file */
5
25
  import * as Arr from "effect/Array";
@@ -30,16 +50,18 @@ import { OpenRouterClient } from "./OpenRouterClient.js";
30
50
  /**
31
51
  * Service definition for OpenRouter language model configuration.
32
52
  *
33
- * @since 1.0.0
34
53
  * @category services
54
+ * @since 4.0.0
35
55
  */
36
56
  export class Config extends /*#__PURE__*/Context.Service()("@effect/ai-openrouter/OpenRouterLanguageModel/Config") {}
37
57
  // =============================================================================
38
58
  // Language Model
39
59
  // =============================================================================
40
60
  /**
41
- * @since 1.0.0
61
+ * Creates an AI model descriptor for an OpenRouter language model.
62
+ *
42
63
  * @category constructors
64
+ * @since 4.0.0
43
65
  */
44
66
  export const model = (model, config) => AiModel.make("openai", model, layer({
45
67
  model,
@@ -48,8 +70,8 @@ export const model = (model, config) => AiModel.make("openai", model, layer({
48
70
  /**
49
71
  * Creates an OpenRouter language model service.
50
72
  *
51
- * @since 1.0.0
52
73
  * @category constructors
74
+ * @since 4.0.0
53
75
  */
54
76
  export const make = /*#__PURE__*/Effect.fnUntraced(function* ({
55
77
  model,
@@ -136,15 +158,15 @@ export const make = /*#__PURE__*/Effect.fnUntraced(function* ({
136
158
  /**
137
159
  * Creates a layer for the OpenRouter language model.
138
160
  *
139
- * @since 1.0.0
140
161
  * @category layers
162
+ * @since 4.0.0
141
163
  */
142
164
  export const layer = options => Layer.effect(LanguageModel.LanguageModel, make(options));
143
165
  /**
144
166
  * Provides config overrides for OpenRouter language model operations.
145
167
  *
146
- * @since 1.0.0
147
168
  * @category configuration
169
+ * @since 4.0.0
148
170
  */
149
171
  export const withConfigOverride = /*#__PURE__*/dual(2, (self, overrides) => Effect.flatMap(Effect.serviceOption(Config), config => Effect.provideService(self, Config, {
150
172
  ...(config._tag === "Some" ? config.value : {}),