@@ -19,26 +19,81 @@ import type { z } from 'zod/v4'
1919
2020export type AgentId = `${string } /${string } @${number } .${number } .${number } `
2121
22- export type OpenRouterProviderOptions = {
23- models ?: string [ ]
24-
22+ export type OpenRouterReasoningOptions = {
2523 /**
2624 * https://openrouter.ai/docs/use-cases/reasoning-tokens
2725 * One of `max_tokens` or `effort` is required.
2826 * If `exclude` is true, reasoning will be removed from the response. Default is false.
2927 */
30- reasoning ?: {
31- enabled ?: boolean
32- exclude ?: boolean
33- } & (
34- | {
35- max_tokens : number
36- }
37- | {
38- effort : 'high' | 'medium' | 'low'
39- }
40- )
28+ enabled ?: boolean
29+ exclude ?: boolean
30+ } & (
31+ | {
32+ max_tokens : number
33+ }
34+ | {
35+ effort : 'high' | 'medium' | 'low'
36+ }
37+ )
38+
39+ export type OpenRouterProviderRoutingOptions = {
40+ /**
41+ * List of provider slugs to try in order (e.g. ["anthropic", "openai"])
42+ */
43+ order ?: string [ ]
44+ /**
45+ * Whether to allow backup providers when primary is unavailable (default: true)
46+ */
47+ allow_fallbacks ?: boolean
48+ /**
49+ * Only use providers that support all parameters in your request (default: false)
50+ */
51+ require_parameters ?: boolean
52+ /**
53+ * Control whether to use providers that may store data
54+ */
55+ data_collection ?: 'allow' | 'deny'
56+ /**
57+ * List of provider slugs to allow for this request
58+ */
59+ only ?: string [ ]
60+ /**
61+ * List of provider slugs to skip for this request
62+ */
63+ ignore ?: string [ ]
64+ /**
65+ * List of quantization levels to filter by (e.g. ["int4", "int8"])
66+ */
67+ quantizations ?: Array <
68+ | 'int4'
69+ | 'int8'
70+ | 'fp4'
71+ | 'fp6'
72+ | 'fp8'
73+ | 'fp16'
74+ | 'bf16'
75+ | 'fp32'
76+ | 'unknown'
77+ >
78+ /**
79+ * Sort providers by price, throughput, or latency
80+ */
81+ sort ?: 'price' | 'throughput' | 'latency'
82+ /**
83+ * Maximum pricing you want to pay for this request
84+ */
85+ max_price ?: {
86+ prompt ?: number | string
87+ completion ?: number | string
88+ image ?: number | string
89+ audio ?: number | string
90+ request ?: number | string
91+ }
92+ }
4193
94+ export type OpenRouterProviderOptions = {
95+ models ?: string [ ]
96+ reasoning ?: OpenRouterReasoningOptions
4297 /**
4398 * A unique identifier representing your end-user, which can
4499 * help OpenRouter to monitor and detect abuse.
@@ -57,7 +112,8 @@ export type AgentTemplate<
57112 id : AgentTemplateType
58113 displayName : string
59114 model : Model
60- reasoningOptions ?: OpenRouterProviderOptions [ 'reasoning' ]
115+ reasoningOptions ?: OpenRouterReasoningOptions
116+ providerOptions ?: OpenRouterProviderRoutingOptions
61117
62118 mcpServers : Record < string , MCPConfig >
63119 toolNames : ( ToolName | ( string & { } ) ) [ ]
0 commit comments