@effect/ai-openrouter 4.0.0-beta.7 → 4.0.0-beta.70
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/dist/Generated.d.ts +171 -92
- package/dist/Generated.d.ts.map +1 -1
- package/dist/Generated.js +60 -31
- package/dist/Generated.js.map +1 -1
- package/dist/OpenRouterClient.d.ts +46 -13
- package/dist/OpenRouterClient.d.ts.map +1 -1
- package/dist/OpenRouterClient.js +8 -8
- package/dist/OpenRouterClient.js.map +1 -1
- package/dist/OpenRouterConfig.d.ts +47 -10
- package/dist/OpenRouterConfig.d.ts.map +1 -1
- package/dist/OpenRouterConfig.js +33 -7
- package/dist/OpenRouterConfig.js.map +1 -1
- package/dist/OpenRouterError.d.ts +166 -35
- package/dist/OpenRouterError.d.ts.map +1 -1
- package/dist/OpenRouterError.js +1 -1
- package/dist/OpenRouterLanguageModel.d.ts +272 -19
- package/dist/OpenRouterLanguageModel.d.ts.map +1 -1
- package/dist/OpenRouterLanguageModel.js +257 -240
- package/dist/OpenRouterLanguageModel.js.map +1 -1
- package/dist/index.d.ts +66 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +66 -6
- package/dist/index.js.map +1 -1
- package/dist/internal/errors.js +4 -4
- package/dist/internal/errors.js.map +1 -1
- package/dist/internal/utilities.js +0 -1
- package/dist/internal/utilities.js.map +1 -1
- package/package.json +3 -3
- package/src/Generated.ts +123 -53
- package/src/OpenRouterClient.ts +47 -14
- package/src/OpenRouterConfig.ts +56 -13
- package/src/OpenRouterError.ts +168 -35
- package/src/OpenRouterLanguageModel.ts +501 -245
- package/src/index.ts +66 -6
- package/src/internal/errors.ts +6 -4
- package/src/internal/utilities.ts +0 -1
package/dist/OpenRouterError.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import * as Context from "effect/Context";
|
|
1
2
|
import * as Effect from "effect/Effect";
|
|
2
3
|
import * as Layer from "effect/Layer";
|
|
3
|
-
import * as ServiceMap from "effect/ServiceMap";
|
|
4
4
|
import * as LanguageModel from "effect/unstable/ai/LanguageModel";
|
|
5
5
|
import * as AiModel from "effect/unstable/ai/Model";
|
|
6
6
|
import type * as Generated from "./Generated.ts";
|
|
7
7
|
import { OpenRouterClient } from "./OpenRouterClient.ts";
|
|
8
|
-
declare const Config_base:
|
|
8
|
+
declare const Config_base: Context.ServiceClass<Config, "@effect/ai-openrouter/OpenRouterLanguageModel/Config", {
|
|
9
9
|
readonly metadata?: {};
|
|
10
10
|
readonly max_tokens?: number | null;
|
|
11
11
|
readonly model?: string;
|
|
@@ -20,15 +20,12 @@ declare const Config_base: ServiceMap.ServiceClass<Config, "@effect/ai-openroute
|
|
|
20
20
|
readonly top_logprobs?: number | null;
|
|
21
21
|
readonly seed?: number | null;
|
|
22
22
|
readonly stop?: string | readonly string[] | null;
|
|
23
|
+
readonly parallel_tool_calls?: boolean | null;
|
|
23
24
|
readonly reasoning?: {
|
|
24
25
|
readonly effort?: "high" | "low" | "medium" | "none" | "xhigh" | "minimal" | null;
|
|
25
26
|
readonly summary?: "auto" | "concise" | "detailed" | null;
|
|
26
27
|
};
|
|
27
28
|
readonly provider?: {
|
|
28
|
-
readonly sort?: "price" | "throughput" | "latency" | {
|
|
29
|
-
readonly by?: "price" | "throughput" | "latency" | null;
|
|
30
|
-
readonly partition?: "none" | "model" | null;
|
|
31
|
-
} | null;
|
|
32
29
|
readonly allow_fallbacks?: boolean | null;
|
|
33
30
|
readonly require_parameters?: boolean | null;
|
|
34
31
|
readonly data_collection?: "deny" | "allow" | null;
|
|
@@ -38,12 +35,16 @@ declare const Config_base: ServiceMap.ServiceClass<Config, "@effect/ai-openroute
|
|
|
38
35
|
readonly only?: readonly string[] | null;
|
|
39
36
|
readonly ignore?: readonly string[] | null;
|
|
40
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;
|
|
41
42
|
readonly max_price?: {
|
|
42
|
-
readonly image?: unknown;
|
|
43
|
-
readonly request?: unknown;
|
|
44
|
-
readonly audio?: unknown;
|
|
45
43
|
readonly prompt?: unknown;
|
|
46
44
|
readonly completion?: unknown;
|
|
45
|
+
readonly image?: unknown;
|
|
46
|
+
readonly audio?: unknown;
|
|
47
|
+
readonly request?: unknown;
|
|
47
48
|
};
|
|
48
49
|
readonly preferred_min_throughput?: number | {
|
|
49
50
|
readonly p50?: number | null;
|
|
@@ -67,9 +68,9 @@ declare const Config_base: ServiceMap.ServiceClass<Config, "@effect/ai-openroute
|
|
|
67
68
|
} | {
|
|
68
69
|
readonly id: "web";
|
|
69
70
|
readonly enabled?: boolean;
|
|
70
|
-
readonly engine?: "native" | "exa";
|
|
71
71
|
readonly max_results?: number;
|
|
72
72
|
readonly search_prompt?: string;
|
|
73
|
+
readonly engine?: "native" | "exa";
|
|
73
74
|
} | {
|
|
74
75
|
readonly id: "file-parser";
|
|
75
76
|
readonly enabled?: boolean;
|
|
@@ -82,6 +83,13 @@ declare const Config_base: ServiceMap.ServiceClass<Config, "@effect/ai-openroute
|
|
|
82
83
|
})[];
|
|
83
84
|
readonly route?: "sort" | "fallback" | null;
|
|
84
85
|
readonly session_id?: string;
|
|
86
|
+
readonly trace?: {
|
|
87
|
+
readonly trace_id?: string;
|
|
88
|
+
readonly trace_name?: string;
|
|
89
|
+
readonly span_name?: string;
|
|
90
|
+
readonly generation_name?: string;
|
|
91
|
+
readonly parent_span_id?: string;
|
|
92
|
+
};
|
|
85
93
|
readonly models?: readonly string[];
|
|
86
94
|
readonly image_config?: {};
|
|
87
95
|
readonly modalities?: readonly ("text" | "image")[];
|
|
@@ -93,25 +101,45 @@ declare const Config_base: ServiceMap.ServiceClass<Config, "@effect/ai-openroute
|
|
|
93
101
|
/**
|
|
94
102
|
* Service definition for OpenRouter language model configuration.
|
|
95
103
|
*
|
|
96
|
-
* @since 1.0.0
|
|
97
104
|
* @category services
|
|
105
|
+
* @since 4.0.0
|
|
98
106
|
*/
|
|
99
107
|
export declare class Config extends Config_base {
|
|
100
108
|
}
|
|
101
109
|
/**
|
|
102
|
-
*
|
|
110
|
+
* OpenRouter assistant reasoning detail blocks preserved for multi-turn
|
|
111
|
+
* conversations.
|
|
112
|
+
*
|
|
103
113
|
* @category models
|
|
114
|
+
* @since 4.0.0
|
|
104
115
|
*/
|
|
105
116
|
export type ReasoningDetails = Exclude<typeof Generated.AssistantMessage.Encoded["reasoning_details"], undefined>;
|
|
106
117
|
/**
|
|
107
|
-
*
|
|
118
|
+
* File annotations emitted on OpenRouter assistant messages and exposed in
|
|
119
|
+
* finish metadata.
|
|
120
|
+
*
|
|
108
121
|
* @category models
|
|
122
|
+
* @since 4.0.0
|
|
109
123
|
*/
|
|
110
124
|
export type FileAnnotation = Extract<NonNullable<typeof Generated.AssistantMessage.fields.annotations.Type>[number], {
|
|
111
125
|
type: "file";
|
|
112
126
|
}>;
|
|
113
127
|
declare module "effect/unstable/ai/Prompt" {
|
|
128
|
+
/**
|
|
129
|
+
* OpenRouter-specific options for system messages.
|
|
130
|
+
*
|
|
131
|
+
* **Details**
|
|
132
|
+
*
|
|
133
|
+
* These options are used when translating system instructions into
|
|
134
|
+
* OpenRouter chat messages.
|
|
135
|
+
*
|
|
136
|
+
* @category request
|
|
137
|
+
* @since 4.0.0
|
|
138
|
+
*/
|
|
114
139
|
interface SystemMessageOptions extends ProviderOptions {
|
|
140
|
+
/**
|
|
141
|
+
* Provider-specific options sent to OpenRouter for the system message.
|
|
142
|
+
*/
|
|
115
143
|
readonly openrouter?: {
|
|
116
144
|
/**
|
|
117
145
|
* A breakpoint which marks the end of reusable content eligible for caching.
|
|
@@ -119,7 +147,21 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
119
147
|
readonly cacheControl?: typeof Generated.ChatMessageContentItemCacheControl.Encoded | null;
|
|
120
148
|
} | null;
|
|
121
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* OpenRouter-specific options for user messages.
|
|
152
|
+
*
|
|
153
|
+
* **Details**
|
|
154
|
+
*
|
|
155
|
+
* These options are used when translating user content into OpenRouter chat
|
|
156
|
+
* messages.
|
|
157
|
+
*
|
|
158
|
+
* @category request
|
|
159
|
+
* @since 4.0.0
|
|
160
|
+
*/
|
|
122
161
|
interface UserMessageOptions extends ProviderOptions {
|
|
162
|
+
/**
|
|
163
|
+
* Provider-specific options sent to OpenRouter for the user message.
|
|
164
|
+
*/
|
|
123
165
|
readonly openrouter?: {
|
|
124
166
|
/**
|
|
125
167
|
* A breakpoint which marks the end of reusable content eligible for caching.
|
|
@@ -127,7 +169,21 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
127
169
|
readonly cacheControl?: typeof Generated.ChatMessageContentItemCacheControl.Encoded | null;
|
|
128
170
|
} | null;
|
|
129
171
|
}
|
|
172
|
+
/**
|
|
173
|
+
* OpenRouter-specific options for assistant messages.
|
|
174
|
+
*
|
|
175
|
+
* **Details**
|
|
176
|
+
*
|
|
177
|
+
* Preserves reasoning metadata when assistant messages are replayed in later
|
|
178
|
+
* OpenRouter requests.
|
|
179
|
+
*
|
|
180
|
+
* @category request
|
|
181
|
+
* @since 4.0.0
|
|
182
|
+
*/
|
|
130
183
|
interface AssistantMessageOptions extends ProviderOptions {
|
|
184
|
+
/**
|
|
185
|
+
* Provider-specific options sent to OpenRouter for the assistant message.
|
|
186
|
+
*/
|
|
131
187
|
readonly openrouter?: {
|
|
132
188
|
/**
|
|
133
189
|
* A breakpoint which marks the end of reusable content eligible for caching.
|
|
@@ -139,7 +195,21 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
139
195
|
readonly reasoningDetails?: ReasoningDetails | null;
|
|
140
196
|
} | null;
|
|
141
197
|
}
|
|
198
|
+
/**
|
|
199
|
+
* OpenRouter-specific options for tool messages.
|
|
200
|
+
*
|
|
201
|
+
* **Details**
|
|
202
|
+
*
|
|
203
|
+
* These options are used when converting tool results into OpenRouter chat
|
|
204
|
+
* messages.
|
|
205
|
+
*
|
|
206
|
+
* @category request
|
|
207
|
+
* @since 4.0.0
|
|
208
|
+
*/
|
|
142
209
|
interface ToolMessageOptions extends ProviderOptions {
|
|
210
|
+
/**
|
|
211
|
+
* Provider-specific options sent to OpenRouter for the tool message.
|
|
212
|
+
*/
|
|
143
213
|
readonly openrouter?: {
|
|
144
214
|
/**
|
|
145
215
|
* A breakpoint which marks the end of reusable content eligible for caching.
|
|
@@ -147,7 +217,20 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
147
217
|
readonly cacheControl?: typeof Generated.ChatMessageContentItemCacheControl.Encoded | null;
|
|
148
218
|
} | null;
|
|
149
219
|
}
|
|
220
|
+
/**
|
|
221
|
+
* OpenRouter-specific options for text prompt parts.
|
|
222
|
+
*
|
|
223
|
+
* **When to use**
|
|
224
|
+
*
|
|
225
|
+
* Use these options to control how text content is sent to OpenRouter.
|
|
226
|
+
*
|
|
227
|
+
* @category request
|
|
228
|
+
* @since 4.0.0
|
|
229
|
+
*/
|
|
150
230
|
interface TextPartOptions extends ProviderOptions {
|
|
231
|
+
/**
|
|
232
|
+
* Provider-specific options sent to OpenRouter for the text part.
|
|
233
|
+
*/
|
|
151
234
|
readonly openrouter?: {
|
|
152
235
|
/**
|
|
153
236
|
* A breakpoint which marks the end of reusable content eligible for caching.
|
|
@@ -155,7 +238,21 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
155
238
|
readonly cacheControl?: typeof Generated.ChatMessageContentItemCacheControl.Encoded | null;
|
|
156
239
|
} | null;
|
|
157
240
|
}
|
|
241
|
+
/**
|
|
242
|
+
* OpenRouter-specific options for reasoning prompt parts.
|
|
243
|
+
*
|
|
244
|
+
* **Details**
|
|
245
|
+
*
|
|
246
|
+
* Preserves provider reasoning blocks so reasoning-aware conversations can
|
|
247
|
+
* continue across OpenRouter requests.
|
|
248
|
+
*
|
|
249
|
+
* @category request
|
|
250
|
+
* @since 4.0.0
|
|
251
|
+
*/
|
|
158
252
|
interface ReasoningPartOptions extends ProviderOptions {
|
|
253
|
+
/**
|
|
254
|
+
* Provider-specific options sent to OpenRouter for the reasoning part.
|
|
255
|
+
*/
|
|
159
256
|
readonly openrouter?: {
|
|
160
257
|
/**
|
|
161
258
|
* A breakpoint which marks the end of reusable content eligible for caching.
|
|
@@ -167,7 +264,20 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
167
264
|
readonly reasoningDetails?: ReasoningDetails | null;
|
|
168
265
|
} | null;
|
|
169
266
|
}
|
|
267
|
+
/**
|
|
268
|
+
* OpenRouter-specific options for file prompt parts.
|
|
269
|
+
*
|
|
270
|
+
* **Details**
|
|
271
|
+
*
|
|
272
|
+
* Controls file naming and prompt caching for files sent to OpenRouter.
|
|
273
|
+
*
|
|
274
|
+
* @category request
|
|
275
|
+
* @since 4.0.0
|
|
276
|
+
*/
|
|
170
277
|
interface FilePartOptions extends ProviderOptions {
|
|
278
|
+
/**
|
|
279
|
+
* Provider-specific options sent to OpenRouter for the file part.
|
|
280
|
+
*/
|
|
171
281
|
readonly openrouter?: {
|
|
172
282
|
/**
|
|
173
283
|
* The name to give to the file. Will be prioritized over the file name
|
|
@@ -180,7 +290,21 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
180
290
|
readonly cacheControl?: typeof Generated.ChatMessageContentItemCacheControl.Encoded | null;
|
|
181
291
|
} | null;
|
|
182
292
|
}
|
|
293
|
+
/**
|
|
294
|
+
* OpenRouter-specific options for tool call prompt parts.
|
|
295
|
+
*
|
|
296
|
+
* **Details**
|
|
297
|
+
*
|
|
298
|
+
* Preserves reasoning details associated with tool calls when a conversation
|
|
299
|
+
* is sent back to OpenRouter.
|
|
300
|
+
*
|
|
301
|
+
* @category request
|
|
302
|
+
* @since 4.0.0
|
|
303
|
+
*/
|
|
183
304
|
interface ToolCallPartOptions extends ProviderOptions {
|
|
305
|
+
/**
|
|
306
|
+
* Provider-specific options sent to OpenRouter for the tool call part.
|
|
307
|
+
*/
|
|
184
308
|
readonly openrouter?: {
|
|
185
309
|
/**
|
|
186
310
|
* Reasoning details associated with the tool call part.
|
|
@@ -188,7 +312,20 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
188
312
|
readonly reasoningDetails?: ReasoningDetails | null;
|
|
189
313
|
} | null;
|
|
190
314
|
}
|
|
315
|
+
/**
|
|
316
|
+
* OpenRouter-specific options for tool result prompt parts.
|
|
317
|
+
*
|
|
318
|
+
* **Details**
|
|
319
|
+
*
|
|
320
|
+
* Controls prompt caching for tool results sent to OpenRouter.
|
|
321
|
+
*
|
|
322
|
+
* @category request
|
|
323
|
+
* @since 4.0.0
|
|
324
|
+
*/
|
|
191
325
|
interface ToolResultPartOptions extends ProviderOptions {
|
|
326
|
+
/**
|
|
327
|
+
* Provider-specific options sent to OpenRouter for the tool result part.
|
|
328
|
+
*/
|
|
192
329
|
readonly openrouter?: {
|
|
193
330
|
/**
|
|
194
331
|
* A breakpoint which marks the end of reusable content eligible for caching.
|
|
@@ -198,52 +335,168 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
198
335
|
}
|
|
199
336
|
}
|
|
200
337
|
declare module "effect/unstable/ai/Response" {
|
|
338
|
+
/**
|
|
339
|
+
* OpenRouter metadata attached to completed reasoning response parts.
|
|
340
|
+
*
|
|
341
|
+
* **Details**
|
|
342
|
+
*
|
|
343
|
+
* Preserves provider reasoning details that can be sent back in later turns.
|
|
344
|
+
*
|
|
345
|
+
* @category response
|
|
346
|
+
* @since 4.0.0
|
|
347
|
+
*/
|
|
201
348
|
interface ReasoningPartMetadata extends ProviderMetadata {
|
|
349
|
+
/**
|
|
350
|
+
* Provider-specific metadata returned for the reasoning part.
|
|
351
|
+
*/
|
|
202
352
|
readonly openrouter?: {
|
|
353
|
+
/**
|
|
354
|
+
* Reasoning details emitted by the underlying provider for this part.
|
|
355
|
+
*/
|
|
203
356
|
readonly reasoningDetails?: ReasoningDetails | null;
|
|
204
357
|
} | null;
|
|
205
358
|
}
|
|
359
|
+
/**
|
|
360
|
+
* OpenRouter metadata emitted when a streamed reasoning part starts.
|
|
361
|
+
*
|
|
362
|
+
* **Details**
|
|
363
|
+
*
|
|
364
|
+
* Carries the first reasoning detail chunk when OpenRouter exposes one.
|
|
365
|
+
*
|
|
366
|
+
* @category response
|
|
367
|
+
* @since 4.0.0
|
|
368
|
+
*/
|
|
206
369
|
interface ReasoningStartPartMetadata extends ProviderMetadata {
|
|
370
|
+
/**
|
|
371
|
+
* Provider-specific metadata returned for the streamed reasoning start.
|
|
372
|
+
*/
|
|
207
373
|
readonly openrouter?: {
|
|
374
|
+
/**
|
|
375
|
+
* Reasoning details emitted by the underlying provider for this part.
|
|
376
|
+
*/
|
|
208
377
|
readonly reasoningDetails?: ReasoningDetails | null;
|
|
209
378
|
} | null;
|
|
210
379
|
}
|
|
380
|
+
/**
|
|
381
|
+
* OpenRouter metadata emitted for streamed reasoning deltas.
|
|
382
|
+
*
|
|
383
|
+
* **Details**
|
|
384
|
+
*
|
|
385
|
+
* Carries provider reasoning detail chunks as they arrive from OpenRouter.
|
|
386
|
+
*
|
|
387
|
+
* @category response
|
|
388
|
+
* @since 4.0.0
|
|
389
|
+
*/
|
|
211
390
|
interface ReasoningDeltaPartMetadata extends ProviderMetadata {
|
|
391
|
+
/**
|
|
392
|
+
* Provider-specific metadata returned for the streamed reasoning delta.
|
|
393
|
+
*/
|
|
212
394
|
readonly openrouter?: {
|
|
395
|
+
/**
|
|
396
|
+
* Reasoning details emitted by the underlying provider for this delta.
|
|
397
|
+
*/
|
|
213
398
|
readonly reasoningDetails?: ReasoningDetails | null;
|
|
214
399
|
} | null;
|
|
215
400
|
}
|
|
401
|
+
/**
|
|
402
|
+
* OpenRouter metadata attached to tool-call response parts.
|
|
403
|
+
*
|
|
404
|
+
* **Details**
|
|
405
|
+
*
|
|
406
|
+
* Associates tool calls with provider reasoning details when the model emits
|
|
407
|
+
* reasoning and tool calls together.
|
|
408
|
+
*
|
|
409
|
+
* @category response
|
|
410
|
+
* @since 4.0.0
|
|
411
|
+
*/
|
|
216
412
|
interface ToolCallPartMetadata extends ProviderMetadata {
|
|
413
|
+
/**
|
|
414
|
+
* Provider-specific metadata returned for the tool call.
|
|
415
|
+
*/
|
|
217
416
|
readonly openrouter?: {
|
|
417
|
+
/**
|
|
418
|
+
* Reasoning details associated with this tool call.
|
|
419
|
+
*/
|
|
218
420
|
readonly reasoningDetails?: ReasoningDetails | null;
|
|
219
421
|
} | null;
|
|
220
422
|
}
|
|
423
|
+
/**
|
|
424
|
+
* OpenRouter metadata attached to URL source citations.
|
|
425
|
+
*
|
|
426
|
+
* **Details**
|
|
427
|
+
*
|
|
428
|
+
* Includes citation text and offsets returned by providers that support URL
|
|
429
|
+
* annotations.
|
|
430
|
+
*
|
|
431
|
+
* @category response
|
|
432
|
+
* @since 4.0.0
|
|
433
|
+
*/
|
|
221
434
|
interface UrlSourcePartMetadata extends ProviderMetadata {
|
|
435
|
+
/**
|
|
436
|
+
* Provider-specific citation metadata returned for the URL source.
|
|
437
|
+
*/
|
|
222
438
|
readonly openrouter?: {
|
|
439
|
+
/**
|
|
440
|
+
* The cited source content returned by the provider.
|
|
441
|
+
*/
|
|
223
442
|
readonly content?: string | null;
|
|
443
|
+
/**
|
|
444
|
+
* The zero-based start index of the citation in the generated text.
|
|
445
|
+
*/
|
|
224
446
|
readonly startIndex?: number | null;
|
|
447
|
+
/**
|
|
448
|
+
* The zero-based end index of the citation in the generated text.
|
|
449
|
+
*/
|
|
225
450
|
readonly endIndex?: number | null;
|
|
226
451
|
} | null;
|
|
227
452
|
}
|
|
453
|
+
/**
|
|
454
|
+
* OpenRouter metadata attached to finish response parts.
|
|
455
|
+
*
|
|
456
|
+
* **Details**
|
|
457
|
+
*
|
|
458
|
+
* Exposes provider response details that are not represented by the common
|
|
459
|
+
* Effect AI finish part fields.
|
|
460
|
+
*
|
|
461
|
+
* @category response
|
|
462
|
+
* @since 4.0.0
|
|
463
|
+
*/
|
|
228
464
|
interface FinishPartMetadata extends ProviderMetadata {
|
|
465
|
+
/**
|
|
466
|
+
* Provider-specific metadata returned when the OpenRouter response finishes.
|
|
467
|
+
*/
|
|
229
468
|
readonly openrouter?: {
|
|
469
|
+
/**
|
|
470
|
+
* Provider fingerprint for the backend configuration that served the request.
|
|
471
|
+
*/
|
|
230
472
|
readonly systemFingerprint?: string | null;
|
|
473
|
+
/**
|
|
474
|
+
* Raw token usage reported by OpenRouter.
|
|
475
|
+
*/
|
|
231
476
|
readonly usage?: typeof Generated.ChatGenerationTokenUsage.Encoded | null;
|
|
477
|
+
/**
|
|
478
|
+
* File annotations returned by the provider.
|
|
479
|
+
*/
|
|
232
480
|
readonly annotations?: ReadonlyArray<FileAnnotation> | null;
|
|
481
|
+
/**
|
|
482
|
+
* The OpenRouter provider that served the request, when reported.
|
|
483
|
+
*/
|
|
233
484
|
readonly provider?: string | null;
|
|
234
485
|
} | null;
|
|
235
486
|
}
|
|
236
487
|
}
|
|
237
488
|
/**
|
|
238
|
-
*
|
|
489
|
+
* Creates an AI model descriptor for an OpenRouter language model.
|
|
490
|
+
*
|
|
239
491
|
* @category constructors
|
|
492
|
+
* @since 4.0.0
|
|
240
493
|
*/
|
|
241
494
|
export declare const model: (model: string, config?: Omit<typeof Config.Service, "model">) => AiModel.Model<"openai", LanguageModel.LanguageModel, OpenRouterClient>;
|
|
242
495
|
/**
|
|
243
496
|
* Creates an OpenRouter language model service.
|
|
244
497
|
*
|
|
245
|
-
* @since 1.0.0
|
|
246
498
|
* @category constructors
|
|
499
|
+
* @since 4.0.0
|
|
247
500
|
*/
|
|
248
501
|
export declare const make: (args_0: {
|
|
249
502
|
readonly model: string;
|
|
@@ -252,8 +505,8 @@ export declare const make: (args_0: {
|
|
|
252
505
|
/**
|
|
253
506
|
* Creates a layer for the OpenRouter language model.
|
|
254
507
|
*
|
|
255
|
-
* @since 1.0.0
|
|
256
508
|
* @category layers
|
|
509
|
+
* @since 4.0.0
|
|
257
510
|
*/
|
|
258
511
|
export declare const layer: (options: {
|
|
259
512
|
readonly model: string;
|
|
@@ -262,22 +515,22 @@ export declare const layer: (options: {
|
|
|
262
515
|
/**
|
|
263
516
|
* Provides config overrides for OpenRouter language model operations.
|
|
264
517
|
*
|
|
265
|
-
* @since 1.0.0
|
|
266
518
|
* @category configuration
|
|
519
|
+
* @since 4.0.0
|
|
267
520
|
*/
|
|
268
521
|
export declare const withConfigOverride: {
|
|
269
522
|
/**
|
|
270
523
|
* Provides config overrides for OpenRouter language model operations.
|
|
271
524
|
*
|
|
272
|
-
* @since 1.0.0
|
|
273
525
|
* @category configuration
|
|
526
|
+
* @since 4.0.0
|
|
274
527
|
*/
|
|
275
528
|
(overrides: typeof Config.Service): <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Config>>;
|
|
276
529
|
/**
|
|
277
530
|
* Provides config overrides for OpenRouter language model operations.
|
|
278
531
|
*
|
|
279
|
-
* @since 1.0.0
|
|
280
532
|
* @category configuration
|
|
533
|
+
* @since 4.0.0
|
|
281
534
|
*/
|
|
282
535
|
<A, E, R>(self: Effect.Effect<A, E, R>, overrides: typeof Config.Service): Effect.Effect<A, E, Exclude<R, Config>>;
|
|
283
536
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenRouterLanguageModel.d.ts","sourceRoot":"","sources":["../src/OpenRouterLanguageModel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OpenRouterLanguageModel.d.ts","sourceRoot":"","sources":["../src/OpenRouterLanguageModel.ts"],"names":[],"mappings":"AAyBA,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,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