@effect/ai-openrouter 4.0.0-beta.4 → 4.0.0-beta.40
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 +1233 -1154
- package/dist/Generated.d.ts.map +1 -1
- package/dist/Generated.js +61 -32
- package/dist/Generated.js.map +1 -1
- package/dist/OpenRouterClient.d.ts +1 -1
- package/dist/OpenRouterClient.d.ts.map +1 -1
- package/dist/OpenRouterError.d.ts +22 -32
- package/dist/OpenRouterError.d.ts.map +1 -1
- package/dist/OpenRouterLanguageModel.d.ts +8 -0
- package/dist/OpenRouterLanguageModel.d.ts.map +1 -1
- package/dist/OpenRouterLanguageModel.js +229 -234
- package/dist/OpenRouterLanguageModel.js.map +1 -1
- package/dist/internal/errors.js +4 -4
- package/dist/internal/errors.js.map +1 -1
- package/package.json +3 -3
- package/src/Generated.ts +124 -54
- package/src/OpenRouterClient.ts +1 -1
- package/src/OpenRouterError.ts +24 -32
- package/src/OpenRouterLanguageModel.ts +224 -233
- package/src/internal/errors.ts +6 -4
package/src/Generated.ts
CHANGED
|
@@ -678,6 +678,7 @@ export type ProviderName =
|
|
|
678
678
|
| "Inceptron"
|
|
679
679
|
| "InferenceNet"
|
|
680
680
|
| "Infermatic"
|
|
681
|
+
| "Io Net"
|
|
681
682
|
| "Inflection"
|
|
682
683
|
| "Liquid"
|
|
683
684
|
| "Mara"
|
|
@@ -751,6 +752,7 @@ export const ProviderName = Schema.Literals([
|
|
|
751
752
|
"Inceptron",
|
|
752
753
|
"InferenceNet",
|
|
753
754
|
"Infermatic",
|
|
755
|
+
"Io Net",
|
|
754
756
|
"Inflection",
|
|
755
757
|
"Liquid",
|
|
756
758
|
"Mara",
|
|
@@ -2583,6 +2585,7 @@ export type __schema5 = ReadonlyArray<
|
|
|
2583
2585
|
| "Inceptron"
|
|
2584
2586
|
| "InferenceNet"
|
|
2585
2587
|
| "Infermatic"
|
|
2588
|
+
| "Io Net"
|
|
2586
2589
|
| "Inflection"
|
|
2587
2590
|
| "Liquid"
|
|
2588
2591
|
| "Mara"
|
|
@@ -2660,6 +2663,7 @@ export const __schema5 = Schema.Array(
|
|
|
2660
2663
|
"Inceptron",
|
|
2661
2664
|
"InferenceNet",
|
|
2662
2665
|
"Infermatic",
|
|
2666
|
+
"Io Net",
|
|
2663
2667
|
"Inflection",
|
|
2664
2668
|
"Liquid",
|
|
2665
2669
|
"Mara",
|
|
@@ -2705,9 +2709,9 @@ export type __schema11 = number
|
|
|
2705
2709
|
export const __schema11 = Schema.Number.check(Schema.isFinite())
|
|
2706
2710
|
export type __schema13 = unknown
|
|
2707
2711
|
export const __schema13 = Schema.Unknown
|
|
2708
|
-
export type
|
|
2709
|
-
export const
|
|
2710
|
-
export type
|
|
2712
|
+
export type __schema21 = string | null
|
|
2713
|
+
export const __schema21 = Schema.Union([Schema.String, Schema.Null])
|
|
2714
|
+
export type __schema22 =
|
|
2711
2715
|
| "unknown"
|
|
2712
2716
|
| "openai-responses-v1"
|
|
2713
2717
|
| "azure-openai-responses-v1"
|
|
@@ -2715,7 +2719,7 @@ export type __schema21 =
|
|
|
2715
2719
|
| "anthropic-claude-v1"
|
|
2716
2720
|
| "google-gemini-v1"
|
|
2717
2721
|
| null
|
|
2718
|
-
export const
|
|
2722
|
+
export const __schema22 = Schema.Union([
|
|
2719
2723
|
Schema.Literals([
|
|
2720
2724
|
"unknown",
|
|
2721
2725
|
"openai-responses-v1",
|
|
@@ -2850,24 +2854,6 @@ export const ChatMessageContentItemCacheControl = Schema.Struct({
|
|
|
2850
2854
|
"type": Schema.Literal("ephemeral"),
|
|
2851
2855
|
"ttl": Schema.optionalKey(Schema.Literals(["5m", "1h"]))
|
|
2852
2856
|
})
|
|
2853
|
-
export type ToolDefinitionJson = {
|
|
2854
|
-
readonly "type": "function"
|
|
2855
|
-
readonly "function": {
|
|
2856
|
-
readonly "name": string
|
|
2857
|
-
readonly "description"?: string
|
|
2858
|
-
readonly "parameters"?: {}
|
|
2859
|
-
readonly "strict"?: boolean | null
|
|
2860
|
-
}
|
|
2861
|
-
}
|
|
2862
|
-
export const ToolDefinitionJson = Schema.Struct({
|
|
2863
|
-
"type": Schema.Literal("function"),
|
|
2864
|
-
"function": Schema.Struct({
|
|
2865
|
-
"name": Schema.String.check(Schema.isMaxLength(64)),
|
|
2866
|
-
"description": Schema.optionalKey(Schema.String),
|
|
2867
|
-
"parameters": Schema.optionalKey(Schema.Struct({}).check(Schema.isPropertyNames(Schema.String))),
|
|
2868
|
-
"strict": Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null]))
|
|
2869
|
-
})
|
|
2870
|
-
})
|
|
2871
2857
|
export type NamedToolChoice = { readonly "type": "function"; readonly "function": { readonly "name": string } }
|
|
2872
2858
|
export const NamedToolChoice = Schema.Struct({
|
|
2873
2859
|
"type": Schema.Literal("function"),
|
|
@@ -2877,16 +2863,19 @@ export type ChatStreamOptions = { readonly "include_usage"?: boolean }
|
|
|
2877
2863
|
export const ChatStreamOptions = Schema.Struct({ "include_usage": Schema.optionalKey(Schema.Boolean) })
|
|
2878
2864
|
export type ChatStreamingMessageToolCall = {
|
|
2879
2865
|
readonly "index": number
|
|
2880
|
-
readonly "id"?: string
|
|
2881
|
-
readonly "type"?: "function"
|
|
2882
|
-
readonly "function"?: { readonly "name"?: string; readonly "arguments"?: string }
|
|
2866
|
+
readonly "id"?: string | null
|
|
2867
|
+
readonly "type"?: "function" | null
|
|
2868
|
+
readonly "function"?: { readonly "name"?: string | null; readonly "arguments"?: string }
|
|
2883
2869
|
}
|
|
2884
2870
|
export const ChatStreamingMessageToolCall = Schema.Struct({
|
|
2885
2871
|
"index": Schema.Number.check(Schema.isFinite()),
|
|
2886
|
-
"id": Schema.optionalKey(Schema.String),
|
|
2887
|
-
"type": Schema.optionalKey(Schema.Literal("function")),
|
|
2872
|
+
"id": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
|
|
2873
|
+
"type": Schema.optionalKey(Schema.Union([Schema.Literal("function"), Schema.Null])),
|
|
2888
2874
|
"function": Schema.optionalKey(
|
|
2889
|
-
Schema.Struct({
|
|
2875
|
+
Schema.Struct({
|
|
2876
|
+
"name": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
|
|
2877
|
+
"arguments": Schema.optionalKey(Schema.String)
|
|
2878
|
+
})
|
|
2890
2879
|
)
|
|
2891
2880
|
})
|
|
2892
2881
|
export type ChatError = {
|
|
@@ -3551,47 +3540,47 @@ export const PublicEndpoint = Schema.Struct({
|
|
|
3551
3540
|
"Throughput percentiles in tokens per second over the last 30 minutes. Throughput measures output token generation speed. Only visible when authenticated with an API key or cookie; returns null for unauthenticated requests."
|
|
3552
3541
|
})
|
|
3553
3542
|
}).annotate({ "description": "Information about a specific model endpoint" })
|
|
3554
|
-
export type
|
|
3543
|
+
export type __schema20 = {
|
|
3555
3544
|
readonly "type": "reasoning.summary"
|
|
3556
3545
|
readonly "summary": string
|
|
3557
|
-
readonly "id"?:
|
|
3558
|
-
readonly "format"?:
|
|
3546
|
+
readonly "id"?: __schema21
|
|
3547
|
+
readonly "format"?: __schema22
|
|
3559
3548
|
readonly "index"?: __schema11
|
|
3560
3549
|
} | {
|
|
3561
3550
|
readonly "type": "reasoning.encrypted"
|
|
3562
3551
|
readonly "data": string
|
|
3563
|
-
readonly "id"?:
|
|
3564
|
-
readonly "format"?:
|
|
3552
|
+
readonly "id"?: __schema21
|
|
3553
|
+
readonly "format"?: __schema22
|
|
3565
3554
|
readonly "index"?: __schema11
|
|
3566
3555
|
} | {
|
|
3567
3556
|
readonly "type": "reasoning.text"
|
|
3568
3557
|
readonly "text"?: string | null
|
|
3569
3558
|
readonly "signature"?: string | null
|
|
3570
|
-
readonly "id"?:
|
|
3571
|
-
readonly "format"?:
|
|
3559
|
+
readonly "id"?: __schema21
|
|
3560
|
+
readonly "format"?: __schema22
|
|
3572
3561
|
readonly "index"?: __schema11
|
|
3573
3562
|
}
|
|
3574
|
-
export const
|
|
3563
|
+
export const __schema20 = Schema.Union([
|
|
3575
3564
|
Schema.Struct({
|
|
3576
3565
|
"type": Schema.Literal("reasoning.summary"),
|
|
3577
3566
|
"summary": Schema.String,
|
|
3578
|
-
"id": Schema.optionalKey(
|
|
3579
|
-
"format": Schema.optionalKey(
|
|
3567
|
+
"id": Schema.optionalKey(__schema21),
|
|
3568
|
+
"format": Schema.optionalKey(__schema22),
|
|
3580
3569
|
"index": Schema.optionalKey(__schema11)
|
|
3581
3570
|
}),
|
|
3582
3571
|
Schema.Struct({
|
|
3583
3572
|
"type": Schema.Literal("reasoning.encrypted"),
|
|
3584
3573
|
"data": Schema.String,
|
|
3585
|
-
"id": Schema.optionalKey(
|
|
3586
|
-
"format": Schema.optionalKey(
|
|
3574
|
+
"id": Schema.optionalKey(__schema21),
|
|
3575
|
+
"format": Schema.optionalKey(__schema22),
|
|
3587
3576
|
"index": Schema.optionalKey(__schema11)
|
|
3588
3577
|
}),
|
|
3589
3578
|
Schema.Struct({
|
|
3590
3579
|
"type": Schema.Literal("reasoning.text"),
|
|
3591
3580
|
"text": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
|
|
3592
3581
|
"signature": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
|
|
3593
|
-
"id": Schema.optionalKey(
|
|
3594
|
-
"format": Schema.optionalKey(
|
|
3582
|
+
"id": Schema.optionalKey(__schema21),
|
|
3583
|
+
"format": Schema.optionalKey(__schema22),
|
|
3595
3584
|
"index": Schema.optionalKey(__schema11)
|
|
3596
3585
|
})
|
|
3597
3586
|
], { mode: "oneOf" })
|
|
@@ -3605,8 +3594,8 @@ export const ChatMessageTokenLogprobs = Schema.Struct({
|
|
|
3605
3594
|
"content": Schema.Union([Schema.Array(ChatMessageTokenLogprob), Schema.Null]),
|
|
3606
3595
|
"refusal": Schema.Union([Schema.Array(ChatMessageTokenLogprob), Schema.Null])
|
|
3607
3596
|
})
|
|
3608
|
-
export type
|
|
3609
|
-
export const
|
|
3597
|
+
export type __schema26 = ChatCompletionFinishReason | null
|
|
3598
|
+
export const __schema26 = Schema.Union([ChatCompletionFinishReason, Schema.Null])
|
|
3610
3599
|
export type ResponseFormatJSONSchema = { readonly "type": "json_schema"; readonly "json_schema": JSONSchemaConfig }
|
|
3611
3600
|
export const ResponseFormatJSONSchema = Schema.Struct({
|
|
3612
3601
|
"type": Schema.Literal("json_schema"),
|
|
@@ -3622,6 +3611,26 @@ export const ChatMessageContentItemText = Schema.Struct({
|
|
|
3622
3611
|
"text": Schema.String,
|
|
3623
3612
|
"cache_control": Schema.optionalKey(ChatMessageContentItemCacheControl)
|
|
3624
3613
|
})
|
|
3614
|
+
export type ToolDefinitionJson = {
|
|
3615
|
+
readonly "type": "function"
|
|
3616
|
+
readonly "function": {
|
|
3617
|
+
readonly "name": string
|
|
3618
|
+
readonly "description"?: string
|
|
3619
|
+
readonly "parameters"?: {}
|
|
3620
|
+
readonly "strict"?: boolean | null
|
|
3621
|
+
}
|
|
3622
|
+
readonly "cache_control"?: ChatMessageContentItemCacheControl
|
|
3623
|
+
}
|
|
3624
|
+
export const ToolDefinitionJson = Schema.Struct({
|
|
3625
|
+
"type": Schema.Literal("function"),
|
|
3626
|
+
"function": Schema.Struct({
|
|
3627
|
+
"name": Schema.String.check(Schema.isMaxLength(64)),
|
|
3628
|
+
"description": Schema.optionalKey(Schema.String),
|
|
3629
|
+
"parameters": Schema.optionalKey(Schema.Struct({}).check(Schema.isPropertyNames(Schema.String))),
|
|
3630
|
+
"strict": Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null]))
|
|
3631
|
+
}),
|
|
3632
|
+
"cache_control": Schema.optionalKey(ChatMessageContentItemCacheControl)
|
|
3633
|
+
})
|
|
3625
3634
|
export type ToolChoiceOption = "none" | "auto" | "required" | NamedToolChoice
|
|
3626
3635
|
export const ToolChoiceOption = Schema.Union([
|
|
3627
3636
|
Schema.Literal("none"),
|
|
@@ -3970,6 +3979,13 @@ export type AnthropicMessagesRequest = {
|
|
|
3970
3979
|
readonly "route"?: "fallback" | "sort"
|
|
3971
3980
|
readonly "user"?: string
|
|
3972
3981
|
readonly "session_id"?: string
|
|
3982
|
+
readonly "trace"?: {
|
|
3983
|
+
readonly "trace_id"?: string
|
|
3984
|
+
readonly "trace_name"?: string
|
|
3985
|
+
readonly "span_name"?: string
|
|
3986
|
+
readonly "generation_name"?: string
|
|
3987
|
+
readonly "parent_span_id"?: string
|
|
3988
|
+
}
|
|
3973
3989
|
readonly "models"?: ReadonlyArray<string>
|
|
3974
3990
|
readonly "output_config"?: AnthropicOutputConfig
|
|
3975
3991
|
}
|
|
@@ -4257,6 +4273,18 @@ export const AnthropicMessagesRequest = Schema.Struct({
|
|
|
4257
4273
|
"A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters."
|
|
4258
4274
|
}).check(Schema.isMaxLength(128))
|
|
4259
4275
|
),
|
|
4276
|
+
"trace": Schema.optionalKey(
|
|
4277
|
+
Schema.Struct({
|
|
4278
|
+
"trace_id": Schema.optionalKey(Schema.String),
|
|
4279
|
+
"trace_name": Schema.optionalKey(Schema.String),
|
|
4280
|
+
"span_name": Schema.optionalKey(Schema.String),
|
|
4281
|
+
"generation_name": Schema.optionalKey(Schema.String),
|
|
4282
|
+
"parent_span_id": Schema.optionalKey(Schema.String)
|
|
4283
|
+
}).annotate({
|
|
4284
|
+
"description":
|
|
4285
|
+
"Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations."
|
|
4286
|
+
})
|
|
4287
|
+
),
|
|
4260
4288
|
"models": Schema.optionalKey(Schema.Array(Schema.String)),
|
|
4261
4289
|
"output_config": Schema.optionalKey(AnthropicOutputConfig)
|
|
4262
4290
|
}).annotate({ "description": "Request schema for Anthropic Messages API endpoint" })
|
|
@@ -4440,7 +4468,7 @@ export type ChatStreamingMessageChunk = {
|
|
|
4440
4468
|
readonly "reasoning"?: string | null
|
|
4441
4469
|
readonly "refusal"?: string | null
|
|
4442
4470
|
readonly "tool_calls"?: ReadonlyArray<ChatStreamingMessageToolCall>
|
|
4443
|
-
readonly "reasoning_details"?: ReadonlyArray<
|
|
4471
|
+
readonly "reasoning_details"?: ReadonlyArray<__schema20>
|
|
4444
4472
|
readonly "images"?:
|
|
4445
4473
|
| ReadonlyArray<{ readonly "type": "image_url"; readonly "image_url": { readonly "url": string } }>
|
|
4446
4474
|
| null
|
|
@@ -4475,7 +4503,7 @@ export const ChatStreamingMessageChunk = Schema.Struct({
|
|
|
4475
4503
|
"reasoning": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
|
|
4476
4504
|
"refusal": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
|
|
4477
4505
|
"tool_calls": Schema.optionalKey(Schema.Array(ChatStreamingMessageToolCall)),
|
|
4478
|
-
"reasoning_details": Schema.optionalKey(Schema.Array(
|
|
4506
|
+
"reasoning_details": Schema.optionalKey(Schema.Array(__schema20)),
|
|
4479
4507
|
"images": Schema.optionalKey(
|
|
4480
4508
|
Schema.Union([
|
|
4481
4509
|
Schema.Array(
|
|
@@ -4609,13 +4637,13 @@ export type ModelsListResponseData = ReadonlyArray<Model>
|
|
|
4609
4637
|
export const ModelsListResponseData = Schema.Array(Model).annotate({ "description": "List of available models" })
|
|
4610
4638
|
export type ChatStreamingChoice = {
|
|
4611
4639
|
readonly "delta": ChatStreamingMessageChunk
|
|
4612
|
-
readonly "finish_reason"
|
|
4640
|
+
readonly "finish_reason"?: __schema26
|
|
4613
4641
|
readonly "index": number
|
|
4614
4642
|
readonly "logprobs"?: ChatMessageTokenLogprobs | null
|
|
4615
4643
|
}
|
|
4616
4644
|
export const ChatStreamingChoice = Schema.Struct({
|
|
4617
4645
|
"delta": ChatStreamingMessageChunk,
|
|
4618
|
-
"finish_reason":
|
|
4646
|
+
"finish_reason": Schema.optionalKey(__schema26),
|
|
4619
4647
|
"index": Schema.Number.check(Schema.isFinite()),
|
|
4620
4648
|
"logprobs": Schema.optionalKey(Schema.Union([ChatMessageTokenLogprobs, Schema.Null]))
|
|
4621
4649
|
})
|
|
@@ -4636,7 +4664,7 @@ export type AssistantMessage = {
|
|
|
4636
4664
|
readonly "tool_calls"?: ReadonlyArray<ChatMessageToolCall>
|
|
4637
4665
|
readonly "refusal"?: string | null
|
|
4638
4666
|
readonly "reasoning"?: string | null
|
|
4639
|
-
readonly "reasoning_details"?: ReadonlyArray<
|
|
4667
|
+
readonly "reasoning_details"?: ReadonlyArray<__schema20>
|
|
4640
4668
|
readonly "images"?:
|
|
4641
4669
|
| ReadonlyArray<{ readonly "type": "image_url"; readonly "image_url": { readonly "url": string } }>
|
|
4642
4670
|
| null
|
|
@@ -4674,7 +4702,7 @@ export const AssistantMessage = Schema.Struct({
|
|
|
4674
4702
|
"tool_calls": Schema.optionalKey(Schema.Array(ChatMessageToolCall)),
|
|
4675
4703
|
"refusal": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
|
|
4676
4704
|
"reasoning": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
|
|
4677
|
-
"reasoning_details": Schema.optionalKey(Schema.Array(
|
|
4705
|
+
"reasoning_details": Schema.optionalKey(Schema.Array(__schema20)),
|
|
4678
4706
|
"images": Schema.optionalKey(
|
|
4679
4707
|
Schema.Union([
|
|
4680
4708
|
Schema.Array(
|
|
@@ -4915,13 +4943,13 @@ export const ChatStreamingResponseChunk = Schema.Struct({
|
|
|
4915
4943
|
})
|
|
4916
4944
|
})
|
|
4917
4945
|
export type ChatResponseChoice = {
|
|
4918
|
-
readonly "finish_reason":
|
|
4946
|
+
readonly "finish_reason": __schema26
|
|
4919
4947
|
readonly "index": number
|
|
4920
4948
|
readonly "message": AssistantMessage
|
|
4921
4949
|
readonly "logprobs"?: ChatMessageTokenLogprobs | null
|
|
4922
4950
|
}
|
|
4923
4951
|
export const ChatResponseChoice = Schema.Struct({
|
|
4924
|
-
"finish_reason":
|
|
4952
|
+
"finish_reason": __schema26,
|
|
4925
4953
|
"index": Schema.Number.check(Schema.isFinite()),
|
|
4926
4954
|
"message": AssistantMessage,
|
|
4927
4955
|
"logprobs": Schema.optionalKey(Schema.Union([ChatMessageTokenLogprobs, Schema.Null]))
|
|
@@ -6299,6 +6327,13 @@ export type OpenResponsesRequest = {
|
|
|
6299
6327
|
readonly "route"?: "fallback" | "sort"
|
|
6300
6328
|
readonly "user"?: string
|
|
6301
6329
|
readonly "session_id"?: string
|
|
6330
|
+
readonly "trace"?: {
|
|
6331
|
+
readonly "trace_id"?: string
|
|
6332
|
+
readonly "trace_name"?: string
|
|
6333
|
+
readonly "span_name"?: string
|
|
6334
|
+
readonly "generation_name"?: string
|
|
6335
|
+
readonly "parent_span_id"?: string
|
|
6336
|
+
}
|
|
6302
6337
|
}
|
|
6303
6338
|
export const OpenResponsesRequest = Schema.Struct({
|
|
6304
6339
|
"input": Schema.optionalKey(OpenResponsesInput),
|
|
@@ -6504,6 +6539,18 @@ export const OpenResponsesRequest = Schema.Struct({
|
|
|
6504
6539
|
"description":
|
|
6505
6540
|
"A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters."
|
|
6506
6541
|
}).check(Schema.isMaxLength(128))
|
|
6542
|
+
),
|
|
6543
|
+
"trace": Schema.optionalKey(
|
|
6544
|
+
Schema.Struct({
|
|
6545
|
+
"trace_id": Schema.optionalKey(Schema.String),
|
|
6546
|
+
"trace_name": Schema.optionalKey(Schema.String),
|
|
6547
|
+
"span_name": Schema.optionalKey(Schema.String),
|
|
6548
|
+
"generation_name": Schema.optionalKey(Schema.String),
|
|
6549
|
+
"parent_span_id": Schema.optionalKey(Schema.String)
|
|
6550
|
+
}).annotate({
|
|
6551
|
+
"description":
|
|
6552
|
+
"Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations."
|
|
6553
|
+
})
|
|
6507
6554
|
)
|
|
6508
6555
|
}).annotate({ "description": "Request schema for Responses endpoint" })
|
|
6509
6556
|
export type ChatGenerationParams = {
|
|
@@ -6560,6 +6607,13 @@ export type ChatGenerationParams = {
|
|
|
6560
6607
|
readonly "route"?: "fallback" | "sort" | null
|
|
6561
6608
|
readonly "user"?: string
|
|
6562
6609
|
readonly "session_id"?: string
|
|
6610
|
+
readonly "trace"?: {
|
|
6611
|
+
readonly "trace_id"?: string
|
|
6612
|
+
readonly "trace_name"?: string
|
|
6613
|
+
readonly "span_name"?: string
|
|
6614
|
+
readonly "generation_name"?: string
|
|
6615
|
+
readonly "parent_span_id"?: string
|
|
6616
|
+
}
|
|
6563
6617
|
readonly "messages": ReadonlyArray<Message>
|
|
6564
6618
|
readonly "model"?: ModelName
|
|
6565
6619
|
readonly "models"?: ReadonlyArray<ModelName>
|
|
@@ -6586,6 +6640,7 @@ export type ChatGenerationParams = {
|
|
|
6586
6640
|
readonly "stream"?: boolean
|
|
6587
6641
|
readonly "stream_options"?: ChatStreamOptions | null
|
|
6588
6642
|
readonly "temperature"?: number | null
|
|
6643
|
+
readonly "parallel_tool_calls"?: boolean | null
|
|
6589
6644
|
readonly "tool_choice"?: ToolChoiceOption
|
|
6590
6645
|
readonly "tools"?: ReadonlyArray<ToolDefinitionJson>
|
|
6591
6646
|
readonly "top_p"?: number | null
|
|
@@ -6734,6 +6789,18 @@ export const ChatGenerationParams = Schema.Struct({
|
|
|
6734
6789
|
"A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters."
|
|
6735
6790
|
}).check(Schema.isMaxLength(128))
|
|
6736
6791
|
),
|
|
6792
|
+
"trace": Schema.optionalKey(
|
|
6793
|
+
Schema.Struct({
|
|
6794
|
+
"trace_id": Schema.optionalKey(Schema.String),
|
|
6795
|
+
"trace_name": Schema.optionalKey(Schema.String),
|
|
6796
|
+
"span_name": Schema.optionalKey(Schema.String),
|
|
6797
|
+
"generation_name": Schema.optionalKey(Schema.String),
|
|
6798
|
+
"parent_span_id": Schema.optionalKey(Schema.String)
|
|
6799
|
+
}).annotate({
|
|
6800
|
+
"description":
|
|
6801
|
+
"Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations."
|
|
6802
|
+
})
|
|
6803
|
+
),
|
|
6737
6804
|
"messages": Schema.Array(Message).check(Schema.isMinLength(1)),
|
|
6738
6805
|
"model": Schema.optionalKey(ModelName),
|
|
6739
6806
|
"models": Schema.optionalKey(Schema.Array(ModelName)),
|
|
@@ -6810,6 +6877,7 @@ export const ChatGenerationParams = Schema.Struct({
|
|
|
6810
6877
|
Schema.Null
|
|
6811
6878
|
])
|
|
6812
6879
|
),
|
|
6880
|
+
"parallel_tool_calls": Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])),
|
|
6813
6881
|
"tool_choice": Schema.optionalKey(ToolChoiceOption),
|
|
6814
6882
|
"tools": Schema.optionalKey(Schema.Array(ToolDefinitionJson)),
|
|
6815
6883
|
"top_p": Schema.optionalKey(
|
|
@@ -7342,6 +7410,7 @@ export type GetGeneration200 = {
|
|
|
7342
7410
|
| "Inceptron"
|
|
7343
7411
|
| "InferenceNet"
|
|
7344
7412
|
| "Infermatic"
|
|
7413
|
+
| "Io Net"
|
|
7345
7414
|
| "Inflection"
|
|
7346
7415
|
| "Liquid"
|
|
7347
7416
|
| "Mara"
|
|
@@ -7522,6 +7591,7 @@ export const GetGeneration200 = Schema.Struct({
|
|
|
7522
7591
|
"Inceptron",
|
|
7523
7592
|
"InferenceNet",
|
|
7524
7593
|
"Infermatic",
|
|
7594
|
+
"Io Net",
|
|
7525
7595
|
"Inflection",
|
|
7526
7596
|
"Liquid",
|
|
7527
7597
|
"Mara",
|
|
@@ -9103,7 +9173,7 @@ export const make = (
|
|
|
9103
9173
|
}))
|
|
9104
9174
|
),
|
|
9105
9175
|
"deleteKeys": (hash, options) =>
|
|
9106
|
-
HttpClientRequest.
|
|
9176
|
+
HttpClientRequest.delete(`/keys/${hash}`).pipe(
|
|
9107
9177
|
withResponse(options?.config)(HttpClientResponse.matchStatus({
|
|
9108
9178
|
"2xx": decodeSuccess(DeleteKeys200),
|
|
9109
9179
|
"401": decodeError("DeleteKeys401", DeleteKeys401),
|
|
@@ -9161,7 +9231,7 @@ export const make = (
|
|
|
9161
9231
|
}))
|
|
9162
9232
|
),
|
|
9163
9233
|
"deleteGuardrail": (id, options) =>
|
|
9164
|
-
HttpClientRequest.
|
|
9234
|
+
HttpClientRequest.delete(`/guardrails/${id}`).pipe(
|
|
9165
9235
|
withResponse(options?.config)(HttpClientResponse.matchStatus({
|
|
9166
9236
|
"2xx": decodeSuccess(DeleteGuardrail200),
|
|
9167
9237
|
"401": decodeError("DeleteGuardrail401", DeleteGuardrail401),
|
package/src/OpenRouterClient.ts
CHANGED
|
@@ -229,7 +229,7 @@ export const layerConfig = (options?: {
|
|
|
229
229
|
/**
|
|
230
230
|
* The config value to load for the API key.
|
|
231
231
|
*/
|
|
232
|
-
readonly apiKey?: Config.Config<Redacted.Redacted<string
|
|
232
|
+
readonly apiKey?: Config.Config<Redacted.Redacted<string> | undefined> | undefined
|
|
233
233
|
|
|
234
234
|
/**
|
|
235
235
|
* The config value to load for the API URL.
|
package/src/OpenRouterError.ts
CHANGED
|
@@ -42,51 +42,43 @@ export type OpenRouterRateLimitMetadata = OpenRouterErrorMetadata & {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
declare module "effect/unstable/ai/AiError" {
|
|
45
|
-
export interface
|
|
46
|
-
readonly
|
|
47
|
-
readonly openrouter?: OpenRouterRateLimitMetadata | null
|
|
48
|
-
}
|
|
45
|
+
export interface RateLimitErrorMetadata {
|
|
46
|
+
readonly openrouter?: OpenRouterRateLimitMetadata | null
|
|
49
47
|
}
|
|
50
48
|
|
|
51
|
-
export interface
|
|
52
|
-
readonly
|
|
53
|
-
readonly openrouter?: OpenRouterErrorMetadata | null
|
|
54
|
-
}
|
|
49
|
+
export interface QuotaExhaustedErrorMetadata {
|
|
50
|
+
readonly openrouter?: OpenRouterErrorMetadata | null
|
|
55
51
|
}
|
|
56
52
|
|
|
57
|
-
export interface
|
|
58
|
-
readonly
|
|
59
|
-
readonly openrouter?: OpenRouterErrorMetadata | null
|
|
60
|
-
}
|
|
53
|
+
export interface AuthenticationErrorMetadata {
|
|
54
|
+
readonly openrouter?: OpenRouterErrorMetadata | null
|
|
61
55
|
}
|
|
62
56
|
|
|
63
|
-
export interface
|
|
64
|
-
readonly
|
|
65
|
-
readonly openrouter?: OpenRouterErrorMetadata | null
|
|
66
|
-
}
|
|
57
|
+
export interface ContentPolicyErrorMetadata {
|
|
58
|
+
readonly openrouter?: OpenRouterErrorMetadata | null
|
|
67
59
|
}
|
|
68
60
|
|
|
69
|
-
export interface
|
|
70
|
-
readonly
|
|
71
|
-
readonly openrouter?: OpenRouterErrorMetadata | null
|
|
72
|
-
}
|
|
61
|
+
export interface InvalidRequestErrorMetadata {
|
|
62
|
+
readonly openrouter?: OpenRouterErrorMetadata | null
|
|
73
63
|
}
|
|
74
64
|
|
|
75
|
-
export interface
|
|
76
|
-
readonly
|
|
77
|
-
readonly openrouter?: OpenRouterErrorMetadata | null
|
|
78
|
-
}
|
|
65
|
+
export interface InternalProviderErrorMetadata {
|
|
66
|
+
readonly openrouter?: OpenRouterErrorMetadata | null
|
|
79
67
|
}
|
|
80
68
|
|
|
81
|
-
export interface
|
|
82
|
-
readonly
|
|
83
|
-
readonly openrouter?: OpenRouterErrorMetadata | null
|
|
84
|
-
}
|
|
69
|
+
export interface InvalidOutputErrorMetadata {
|
|
70
|
+
readonly openrouter?: OpenRouterErrorMetadata | null
|
|
85
71
|
}
|
|
86
72
|
|
|
87
|
-
export interface
|
|
88
|
-
readonly
|
|
89
|
-
|
|
90
|
-
|
|
73
|
+
export interface StructuredOutputErrorMetadata {
|
|
74
|
+
readonly openrouter?: OpenRouterErrorMetadata | null
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface UnsupportedSchemaErrorMetadata {
|
|
78
|
+
readonly openrouter?: OpenRouterErrorMetadata | null
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface UnknownErrorMetadata {
|
|
82
|
+
readonly openrouter?: OpenRouterErrorMetadata | null
|
|
91
83
|
}
|
|
92
84
|
}
|