@effect/ai-openrouter 4.0.0-beta.66 → 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.
- package/dist/Generated.d.ts +1 -1
- package/dist/Generated.js +1 -1
- package/dist/OpenRouterClient.d.ts +37 -8
- package/dist/OpenRouterClient.d.ts.map +1 -1
- package/dist/OpenRouterClient.js +4 -4
- package/dist/OpenRouterClient.js.map +1 -1
- package/dist/OpenRouterConfig.d.ts +45 -8
- package/dist/OpenRouterConfig.d.ts.map +1 -1
- package/dist/OpenRouterConfig.js +30 -4
- package/dist/OpenRouterConfig.js.map +1 -1
- package/dist/OpenRouterError.d.ts +124 -3
- package/dist/OpenRouterError.d.ts.map +1 -1
- package/dist/OpenRouterError.js +1 -1
- package/dist/OpenRouterLanguageModel.d.ts +179 -9
- package/dist/OpenRouterLanguageModel.d.ts.map +1 -1
- package/dist/OpenRouterLanguageModel.js +28 -6
- package/dist/OpenRouterLanguageModel.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.js +6 -6
- package/package.json +3 -3
- package/src/Generated.ts +1 -1
- package/src/OpenRouterClient.ts +37 -8
- package/src/OpenRouterConfig.ts +53 -10
- package/src/OpenRouterError.ts +124 -3
- package/src/OpenRouterLanguageModel.ts +202 -12
- package/src/index.ts +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @since
|
|
2
|
+
* @since 4.0.0
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
|
-
* @since
|
|
5
|
+
* @since 4.0.0
|
|
6
6
|
*/
|
|
7
7
|
export * as Generated from "./Generated.ts";
|
|
8
8
|
/**
|
|
9
|
-
* @since
|
|
9
|
+
* @since 4.0.0
|
|
10
10
|
*/
|
|
11
11
|
export * as OpenRouterClient from "./OpenRouterClient.ts";
|
|
12
12
|
/**
|
|
13
|
-
* @since
|
|
13
|
+
* @since 4.0.0
|
|
14
14
|
*/
|
|
15
15
|
export * as OpenRouterConfig from "./OpenRouterConfig.ts";
|
|
16
16
|
/**
|
|
@@ -19,11 +19,11 @@ export * as OpenRouterConfig from "./OpenRouterConfig.ts";
|
|
|
19
19
|
* Provides OpenRouter-specific metadata fields for AI error types through
|
|
20
20
|
* module augmentation, enabling typed access to OpenRouter error details.
|
|
21
21
|
*
|
|
22
|
-
* @since
|
|
22
|
+
* @since 4.0.0
|
|
23
23
|
*/
|
|
24
24
|
export * as OpenRouterError from "./OpenRouterError.ts";
|
|
25
25
|
/**
|
|
26
|
-
* @since
|
|
26
|
+
* @since 4.0.0
|
|
27
27
|
*/
|
|
28
28
|
export * as OpenRouterLanguageModel from "./OpenRouterLanguageModel.ts";
|
|
29
29
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @since
|
|
2
|
+
* @since 4.0.0
|
|
3
3
|
*/
|
|
4
4
|
// @barrel: Auto-generated exports. Do not edit manually.
|
|
5
5
|
/**
|
|
6
|
-
* @since
|
|
6
|
+
* @since 4.0.0
|
|
7
7
|
*/
|
|
8
8
|
export * as Generated from "./Generated.js";
|
|
9
9
|
/**
|
|
10
|
-
* @since
|
|
10
|
+
* @since 4.0.0
|
|
11
11
|
*/
|
|
12
12
|
export * as OpenRouterClient from "./OpenRouterClient.js";
|
|
13
13
|
/**
|
|
14
|
-
* @since
|
|
14
|
+
* @since 4.0.0
|
|
15
15
|
*/
|
|
16
16
|
export * as OpenRouterConfig from "./OpenRouterConfig.js";
|
|
17
17
|
/**
|
|
@@ -20,11 +20,11 @@ export * as OpenRouterConfig from "./OpenRouterConfig.js";
|
|
|
20
20
|
* Provides OpenRouter-specific metadata fields for AI error types through
|
|
21
21
|
* module augmentation, enabling typed access to OpenRouter error details.
|
|
22
22
|
*
|
|
23
|
-
* @since
|
|
23
|
+
* @since 4.0.0
|
|
24
24
|
*/
|
|
25
25
|
export * as OpenRouterError from "./OpenRouterError.js";
|
|
26
26
|
/**
|
|
27
|
-
* @since
|
|
27
|
+
* @since 4.0.0
|
|
28
28
|
*/
|
|
29
29
|
export * as OpenRouterLanguageModel from "./OpenRouterLanguageModel.js";
|
|
30
30
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect/ai-openrouter",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.67",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "An OpenRouter provider integration for Effect AI SDK",
|
|
@@ -43,10 +43,10 @@
|
|
|
43
43
|
"provenance": true
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"effect": "^4.0.0-beta.
|
|
46
|
+
"effect": "^4.0.0-beta.67"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"effect": "^4.0.0-beta.
|
|
49
|
+
"effect": "^4.0.0-beta.67"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"codegen": "effect-utils codegen",
|
package/src/Generated.ts
CHANGED
package/src/OpenRouterClient.ts
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* The `OpenRouterClient` module provides an Effect service for calling
|
|
3
|
+
* OpenRouter's chat completions API. It wraps the generated OpenRouter HTTP
|
|
4
|
+
* client with Effect-native constructors, layers, typed errors, and streaming
|
|
5
|
+
* support.
|
|
6
|
+
*
|
|
7
|
+
* **Common tasks**
|
|
8
|
+
*
|
|
9
|
+
* - Build a client from explicit options with {@link make}
|
|
10
|
+
* - Provide the client to an application with {@link layer} or {@link layerConfig}
|
|
11
|
+
* - Create non-streaming chat completions with {@link Service.createChatCompletion}
|
|
12
|
+
* - Create server-sent event chat completion streams with
|
|
13
|
+
* {@link Service.createChatCompletionStream}
|
|
14
|
+
* - Customize authentication, base URL, OpenRouter ranking headers, or the
|
|
15
|
+
* underlying HTTP client through {@link Options}
|
|
16
|
+
*
|
|
17
|
+
* **Gotchas**
|
|
18
|
+
*
|
|
19
|
+
* - Streaming requests are sent directly to `/chat/completions` with `stream`
|
|
20
|
+
* and `stream_options.include_usage` enabled by this module.
|
|
21
|
+
* - OpenRouter API failures, HTTP client failures, and schema decoding failures
|
|
22
|
+
* are mapped into `AiError` values for the exported service methods.
|
|
23
|
+
*
|
|
24
|
+
* @since 4.0.0
|
|
3
25
|
*/
|
|
4
26
|
import type * as Config from "effect/Config"
|
|
5
27
|
import * as Context from "effect/Context"
|
|
@@ -30,8 +52,8 @@ import { OpenRouterConfig } from "./OpenRouterConfig.ts"
|
|
|
30
52
|
* Provides methods for interacting with OpenRouter's Chat Completions API,
|
|
31
53
|
* including both synchronous and streaming message creation.
|
|
32
54
|
*
|
|
33
|
-
* @since 1.0.0
|
|
34
55
|
* @category models
|
|
56
|
+
* @since 4.0.0
|
|
35
57
|
*/
|
|
36
58
|
export interface Service {
|
|
37
59
|
readonly client: Generated.OpenRouterClient
|
|
@@ -55,8 +77,15 @@ export interface Service {
|
|
|
55
77
|
}
|
|
56
78
|
|
|
57
79
|
/**
|
|
58
|
-
*
|
|
80
|
+
* Decoded `data` payload from an OpenRouter chat completion streaming chunk.
|
|
81
|
+
*
|
|
82
|
+
* **Details**
|
|
83
|
+
*
|
|
84
|
+
* The payload contains streamed choices, model metadata, optional usage, and may
|
|
85
|
+
* include an OpenRouter error object for a streamed response.
|
|
86
|
+
*
|
|
59
87
|
* @category Models
|
|
88
|
+
* @since 4.0.0
|
|
60
89
|
*/
|
|
61
90
|
export type ChatStreamingResponseChunkData = typeof Generated.ChatStreamingResponseChunk.fields.data.Type
|
|
62
91
|
|
|
@@ -67,8 +96,8 @@ export type ChatStreamingResponseChunkData = typeof Generated.ChatStreamingRespo
|
|
|
67
96
|
/**
|
|
68
97
|
* Service identifier for the OpenRouter client.
|
|
69
98
|
*
|
|
70
|
-
* @since 1.0.0
|
|
71
99
|
* @category service
|
|
100
|
+
* @since 4.0.0
|
|
72
101
|
*/
|
|
73
102
|
export class OpenRouterClient extends Context.Service<
|
|
74
103
|
OpenRouterClient,
|
|
@@ -82,8 +111,8 @@ export class OpenRouterClient extends Context.Service<
|
|
|
82
111
|
/**
|
|
83
112
|
* Configuration options for creating an OpenRouter client.
|
|
84
113
|
*
|
|
85
|
-
* @since 1.0.0
|
|
86
114
|
* @category models
|
|
115
|
+
* @since 4.0.0
|
|
87
116
|
*/
|
|
88
117
|
export type Options = {
|
|
89
118
|
readonly apiKey?: Redacted.Redacted<string> | undefined
|
|
@@ -115,8 +144,8 @@ export type Options = {
|
|
|
115
144
|
/**
|
|
116
145
|
* Creates an OpenRouter client service with the given options.
|
|
117
146
|
*
|
|
118
|
-
* @since 1.0.0
|
|
119
147
|
* @category constructors
|
|
148
|
+
* @since 4.0.0
|
|
120
149
|
*/
|
|
121
150
|
export const make = Effect.fnUntraced(
|
|
122
151
|
function*(options: Options): Effect.fn.Return<Service, never, HttpClient.HttpClient> {
|
|
@@ -212,8 +241,8 @@ export const make = Effect.fnUntraced(
|
|
|
212
241
|
/**
|
|
213
242
|
* Creates a layer for the OpenRouter client with the given options.
|
|
214
243
|
*
|
|
215
|
-
* @since 1.0.0
|
|
216
244
|
* @category layers
|
|
245
|
+
* @since 4.0.0
|
|
217
246
|
*/
|
|
218
247
|
export const layer = (options: Options): Layer.Layer<OpenRouterClient, never, HttpClient.HttpClient> =>
|
|
219
248
|
Layer.effect(OpenRouterClient, make(options))
|
|
@@ -222,8 +251,8 @@ export const layer = (options: Options): Layer.Layer<OpenRouterClient, never, Ht
|
|
|
222
251
|
* Creates a layer for the OpenRouter client, loading the requisite
|
|
223
252
|
* configuration via Effect's `Config` module.
|
|
224
253
|
*
|
|
225
|
-
* @since 1.0.0
|
|
226
254
|
* @category layers
|
|
255
|
+
* @since 4.0.0
|
|
227
256
|
*/
|
|
228
257
|
export const layerConfig = (options?: {
|
|
229
258
|
/**
|
package/src/OpenRouterConfig.ts
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* The `OpenRouterConfig` module provides contextual configuration for the
|
|
3
|
+
* OpenRouter provider integration. It is used to customize the HTTP client that
|
|
4
|
+
* backs OpenRouter requests without rebuilding the provider layer itself.
|
|
5
|
+
*
|
|
6
|
+
* Use {@link withClientTransform} when a single effect, workflow, or scoped
|
|
7
|
+
* portion of an application needs to add cross-cutting HTTP client behavior
|
|
8
|
+
* such as request logging, retries, proxy routing, additional headers, or test
|
|
9
|
+
* doubles. The configuration is read from the current Effect context, so the
|
|
10
|
+
* transform only applies where the returned effect is run with that context.
|
|
11
|
+
*
|
|
12
|
+
* **Gotchas**
|
|
13
|
+
*
|
|
14
|
+
* - Each call to {@link withClientTransform} replaces the current client
|
|
15
|
+
* transform for the provided effect; compose transforms manually when both
|
|
16
|
+
* behaviors should apply.
|
|
17
|
+
* - The transform receives and returns an `HttpClient`, so it should preserve
|
|
18
|
+
* the OpenRouter client contract while adding behavior around it.
|
|
19
|
+
*
|
|
20
|
+
* @since 4.0.0
|
|
3
21
|
*/
|
|
4
22
|
import * as Context from "effect/Context"
|
|
5
23
|
import * as Effect from "effect/Effect"
|
|
@@ -7,15 +25,20 @@ import { dual } from "effect/Function"
|
|
|
7
25
|
import type { HttpClient } from "effect/unstable/http/HttpClient"
|
|
8
26
|
|
|
9
27
|
/**
|
|
10
|
-
*
|
|
28
|
+
* Context service carrying scoped OpenRouter provider configuration for client
|
|
29
|
+
* operations.
|
|
30
|
+
*
|
|
11
31
|
* @category services
|
|
32
|
+
* @since 4.0.0
|
|
12
33
|
*/
|
|
13
34
|
export class OpenRouterConfig extends Context.Service<
|
|
14
35
|
OpenRouterConfig,
|
|
15
36
|
OpenRouterConfig.Service
|
|
16
37
|
>()("@effect/ai-openrouter/OpenRouterConfig") {
|
|
17
38
|
/**
|
|
18
|
-
*
|
|
39
|
+
* Gets the configured OpenRouter service from the current context when present.
|
|
40
|
+
*
|
|
41
|
+
* @since 4.0.0
|
|
19
42
|
*/
|
|
20
43
|
static readonly getOrUndefined: Effect.Effect<typeof OpenRouterConfig.Service | undefined> = Effect.map(
|
|
21
44
|
Effect.context<never>(),
|
|
@@ -24,12 +47,17 @@ export class OpenRouterConfig extends Context.Service<
|
|
|
24
47
|
}
|
|
25
48
|
|
|
26
49
|
/**
|
|
27
|
-
*
|
|
50
|
+
* Types associated with the `OpenRouterConfig` context service.
|
|
51
|
+
*
|
|
52
|
+
* @since 4.0.0
|
|
28
53
|
*/
|
|
29
54
|
export declare namespace OpenRouterConfig {
|
|
30
55
|
/**
|
|
31
|
-
*
|
|
56
|
+
* Configuration values read by OpenRouter provider operations when resolving
|
|
57
|
+
* the generated HTTP client.
|
|
58
|
+
*
|
|
32
59
|
* @category models
|
|
60
|
+
* @since 4.0.0
|
|
33
61
|
*/
|
|
34
62
|
export interface Service {
|
|
35
63
|
readonly transformClient?: ((client: HttpClient) => HttpClient) | undefined
|
|
@@ -37,18 +65,27 @@ export declare namespace OpenRouterConfig {
|
|
|
37
65
|
}
|
|
38
66
|
|
|
39
67
|
/**
|
|
40
|
-
*
|
|
68
|
+
* Provides a scoped transform for the OpenRouter HTTP client used by provider
|
|
69
|
+
* operations.
|
|
70
|
+
*
|
|
41
71
|
* @category configuration
|
|
72
|
+
* @since 4.0.0
|
|
42
73
|
*/
|
|
43
74
|
export const withClientTransform: {
|
|
44
75
|
/**
|
|
45
|
-
*
|
|
76
|
+
* Provides a scoped transform for the OpenRouter HTTP client used by provider
|
|
77
|
+
* operations.
|
|
78
|
+
*
|
|
46
79
|
* @category configuration
|
|
80
|
+
* @since 4.0.0
|
|
47
81
|
*/
|
|
48
82
|
(transform: (client: HttpClient) => HttpClient): <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
|
|
49
83
|
/**
|
|
50
|
-
*
|
|
84
|
+
* Provides a scoped transform for the OpenRouter HTTP client used by provider
|
|
85
|
+
* operations.
|
|
86
|
+
*
|
|
51
87
|
* @category configuration
|
|
88
|
+
* @since 4.0.0
|
|
52
89
|
*/
|
|
53
90
|
<A, E, R>(
|
|
54
91
|
self: Effect.Effect<A, E, R>,
|
|
@@ -56,13 +93,19 @@ export const withClientTransform: {
|
|
|
56
93
|
): Effect.Effect<A, E, R>
|
|
57
94
|
} = dual<
|
|
58
95
|
/**
|
|
59
|
-
*
|
|
96
|
+
* Provides a scoped transform for the OpenRouter HTTP client used by provider
|
|
97
|
+
* operations.
|
|
98
|
+
*
|
|
60
99
|
* @category configuration
|
|
100
|
+
* @since 4.0.0
|
|
61
101
|
*/
|
|
62
102
|
(transform: (client: HttpClient) => HttpClient) => <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>,
|
|
63
103
|
/**
|
|
64
|
-
*
|
|
104
|
+
* Provides a scoped transform for the OpenRouter HTTP client used by provider
|
|
105
|
+
* operations.
|
|
106
|
+
*
|
|
65
107
|
* @category configuration
|
|
108
|
+
* @since 4.0.0
|
|
66
109
|
*/
|
|
67
110
|
<A, E, R>(
|
|
68
111
|
self: Effect.Effect<A, E, R>,
|
package/src/OpenRouterError.ts
CHANGED
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
* Provides OpenRouter-specific metadata fields for AI error types through
|
|
5
5
|
* module augmentation, enabling typed access to OpenRouter error details.
|
|
6
6
|
*
|
|
7
|
-
* @since
|
|
7
|
+
* @since 4.0.0
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* OpenRouter-specific error metadata fields.
|
|
12
12
|
*
|
|
13
|
-
* @since 1.0.0
|
|
14
13
|
* @category models
|
|
14
|
+
* @since 4.0.0
|
|
15
15
|
*/
|
|
16
16
|
export type OpenRouterErrorMetadata = {
|
|
17
17
|
/**
|
|
@@ -31,8 +31,8 @@ export type OpenRouterErrorMetadata = {
|
|
|
31
31
|
/**
|
|
32
32
|
* OpenRouter-specific rate limit metadata fields.
|
|
33
33
|
*
|
|
34
|
-
* @since 1.0.0
|
|
35
34
|
* @category models
|
|
35
|
+
* @since 4.0.0
|
|
36
36
|
*/
|
|
37
37
|
export type OpenRouterRateLimitMetadata = OpenRouterErrorMetadata & {
|
|
38
38
|
readonly limit: string | null
|
|
@@ -42,43 +42,164 @@ export type OpenRouterRateLimitMetadata = OpenRouterErrorMetadata & {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
declare module "effect/unstable/ai/AiError" {
|
|
45
|
+
/**
|
|
46
|
+
* OpenRouter metadata attached to `RateLimitError` values.
|
|
47
|
+
*
|
|
48
|
+
* Captures OpenRouter error details together with rate limit header
|
|
49
|
+
* information from responses where the provider rejected the request because
|
|
50
|
+
* a limit was reached.
|
|
51
|
+
*
|
|
52
|
+
* @category provider options
|
|
53
|
+
* @since 4.0.0
|
|
54
|
+
*/
|
|
45
55
|
export interface RateLimitErrorMetadata {
|
|
56
|
+
/**
|
|
57
|
+
* OpenRouter-specific details for the rate limit response.
|
|
58
|
+
*/
|
|
46
59
|
readonly openrouter?: OpenRouterRateLimitMetadata | null
|
|
47
60
|
}
|
|
48
61
|
|
|
62
|
+
/**
|
|
63
|
+
* OpenRouter metadata attached to `QuotaExhaustedError` values.
|
|
64
|
+
*
|
|
65
|
+
* Preserves provider error details for failures caused by exhausted account,
|
|
66
|
+
* billing, or usage quota.
|
|
67
|
+
*
|
|
68
|
+
* @category provider options
|
|
69
|
+
* @since 4.0.0
|
|
70
|
+
*/
|
|
49
71
|
export interface QuotaExhaustedErrorMetadata {
|
|
72
|
+
/**
|
|
73
|
+
* OpenRouter-specific details for the quota exhaustion response.
|
|
74
|
+
*/
|
|
50
75
|
readonly openrouter?: OpenRouterErrorMetadata | null
|
|
51
76
|
}
|
|
52
77
|
|
|
78
|
+
/**
|
|
79
|
+
* OpenRouter metadata attached to `AuthenticationError` values.
|
|
80
|
+
*
|
|
81
|
+
* Preserves provider error details for failed API key, authorization, or
|
|
82
|
+
* permission checks.
|
|
83
|
+
*
|
|
84
|
+
* @category provider options
|
|
85
|
+
* @since 4.0.0
|
|
86
|
+
*/
|
|
53
87
|
export interface AuthenticationErrorMetadata {
|
|
88
|
+
/**
|
|
89
|
+
* OpenRouter-specific details for the authentication failure.
|
|
90
|
+
*/
|
|
54
91
|
readonly openrouter?: OpenRouterErrorMetadata | null
|
|
55
92
|
}
|
|
56
93
|
|
|
94
|
+
/**
|
|
95
|
+
* OpenRouter metadata attached to `ContentPolicyError` values.
|
|
96
|
+
*
|
|
97
|
+
* Preserves provider error details when OpenRouter rejects input or output
|
|
98
|
+
* because it violates a content policy.
|
|
99
|
+
*
|
|
100
|
+
* @category provider options
|
|
101
|
+
* @since 4.0.0
|
|
102
|
+
*/
|
|
57
103
|
export interface ContentPolicyErrorMetadata {
|
|
104
|
+
/**
|
|
105
|
+
* OpenRouter-specific details for the content policy response.
|
|
106
|
+
*/
|
|
58
107
|
readonly openrouter?: OpenRouterErrorMetadata | null
|
|
59
108
|
}
|
|
60
109
|
|
|
110
|
+
/**
|
|
111
|
+
* OpenRouter metadata attached to `InvalidRequestError` values.
|
|
112
|
+
*
|
|
113
|
+
* Preserves provider error details for malformed requests, unsupported
|
|
114
|
+
* parameters, or other request validation failures reported by OpenRouter.
|
|
115
|
+
*
|
|
116
|
+
* @category provider options
|
|
117
|
+
* @since 4.0.0
|
|
118
|
+
*/
|
|
61
119
|
export interface InvalidRequestErrorMetadata {
|
|
120
|
+
/**
|
|
121
|
+
* OpenRouter-specific details for the invalid request response.
|
|
122
|
+
*/
|
|
62
123
|
readonly openrouter?: OpenRouterErrorMetadata | null
|
|
63
124
|
}
|
|
64
125
|
|
|
126
|
+
/**
|
|
127
|
+
* OpenRouter metadata attached to `InternalProviderError` values.
|
|
128
|
+
*
|
|
129
|
+
* Preserves provider error details for OpenRouter-side failures such as
|
|
130
|
+
* transient server errors or overload responses.
|
|
131
|
+
*
|
|
132
|
+
* @category provider options
|
|
133
|
+
* @since 4.0.0
|
|
134
|
+
*/
|
|
65
135
|
export interface InternalProviderErrorMetadata {
|
|
136
|
+
/**
|
|
137
|
+
* OpenRouter-specific details for the internal provider response.
|
|
138
|
+
*/
|
|
66
139
|
readonly openrouter?: OpenRouterErrorMetadata | null
|
|
67
140
|
}
|
|
68
141
|
|
|
142
|
+
/**
|
|
143
|
+
* OpenRouter metadata attached to `InvalidOutputError` values.
|
|
144
|
+
*
|
|
145
|
+
* Preserves provider error details when an OpenRouter response cannot be
|
|
146
|
+
* parsed or validated as the expected output.
|
|
147
|
+
*
|
|
148
|
+
* @category provider options
|
|
149
|
+
* @since 4.0.0
|
|
150
|
+
*/
|
|
69
151
|
export interface InvalidOutputErrorMetadata {
|
|
152
|
+
/**
|
|
153
|
+
* OpenRouter-specific details for the invalid output response.
|
|
154
|
+
*/
|
|
70
155
|
readonly openrouter?: OpenRouterErrorMetadata | null
|
|
71
156
|
}
|
|
72
157
|
|
|
158
|
+
/**
|
|
159
|
+
* OpenRouter metadata attached to `StructuredOutputError` values.
|
|
160
|
+
*
|
|
161
|
+
* Preserves provider error details when OpenRouter returns content that does
|
|
162
|
+
* not satisfy the requested structured output schema.
|
|
163
|
+
*
|
|
164
|
+
* @category provider options
|
|
165
|
+
* @since 4.0.0
|
|
166
|
+
*/
|
|
73
167
|
export interface StructuredOutputErrorMetadata {
|
|
168
|
+
/**
|
|
169
|
+
* OpenRouter-specific details for the structured output failure.
|
|
170
|
+
*/
|
|
74
171
|
readonly openrouter?: OpenRouterErrorMetadata | null
|
|
75
172
|
}
|
|
76
173
|
|
|
174
|
+
/**
|
|
175
|
+
* OpenRouter metadata attached to `UnsupportedSchemaError` values.
|
|
176
|
+
*
|
|
177
|
+
* Preserves provider error details when an unsupported schema failure is
|
|
178
|
+
* associated with an OpenRouter response.
|
|
179
|
+
*
|
|
180
|
+
* @category provider options
|
|
181
|
+
* @since 4.0.0
|
|
182
|
+
*/
|
|
77
183
|
export interface UnsupportedSchemaErrorMetadata {
|
|
184
|
+
/**
|
|
185
|
+
* OpenRouter-specific details for the unsupported schema failure.
|
|
186
|
+
*/
|
|
78
187
|
readonly openrouter?: OpenRouterErrorMetadata | null
|
|
79
188
|
}
|
|
80
189
|
|
|
190
|
+
/**
|
|
191
|
+
* OpenRouter metadata attached to `UnknownError` values.
|
|
192
|
+
*
|
|
193
|
+
* Preserves provider error details for OpenRouter failures that do not map
|
|
194
|
+
* cleanly to a more specific AI error category.
|
|
195
|
+
*
|
|
196
|
+
* @category provider options
|
|
197
|
+
* @since 4.0.0
|
|
198
|
+
*/
|
|
81
199
|
export interface UnknownErrorMetadata {
|
|
200
|
+
/**
|
|
201
|
+
* OpenRouter-specific details for the unclassified provider failure.
|
|
202
|
+
*/
|
|
82
203
|
readonly openrouter?: OpenRouterErrorMetadata | null
|
|
83
204
|
}
|
|
84
205
|
}
|