@absolutejs/ai 0.0.52 → 0.0.53

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.
@@ -0,0 +1,37 @@
1
+ // @bun
2
+ var __require = import.meta.require;
3
+
4
+ // src/ai/providers/openrouterSDK.ts
5
+ import {
6
+ OpenRouter as OfficialOpenRouterSDK
7
+ } from "@openrouter/sdk";
8
+ var createOpenRouterSDK = (config = {}) => {
9
+ if (config.appCategories && config.appCategories.length > 2)
10
+ throw new Error("createOpenRouterSDK() appCategories supports at most 2 entries");
11
+ if (!config.apiKey && !config.tokenSource)
12
+ throw new Error("createOpenRouterSDK() requires either apiKey or tokenSource");
13
+ const {
14
+ apiKey,
15
+ appCategories,
16
+ appName,
17
+ appUrl,
18
+ baseUrl,
19
+ tokenSource,
20
+ ...options
21
+ } = config;
22
+ return new OfficialOpenRouterSDK({
23
+ ...options,
24
+ apiKey: tokenSource ? async () => Promise.resolve(tokenSource()) : apiKey,
25
+ appCategories: appCategories?.join(","),
26
+ appTitle: appName,
27
+ httpReferer: appUrl,
28
+ serverURL: baseUrl
29
+ });
30
+ };
31
+ export {
32
+ createOpenRouterSDK,
33
+ OfficialOpenRouterSDK as OpenRouterSDK
34
+ };
35
+
36
+ //# debugId=7959A7816069F74364756E2164756E21
37
+ //# sourceMappingURL=openrouterSDK.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/ai/providers/openrouterSDK.ts"],
4
+ "sourcesContent": [
5
+ "import {\n OpenRouter as OfficialOpenRouterSDK,\n type SDKOptions,\n} from \"@openrouter/sdk\";\n\nexport type OpenRouterSDKConfig = Omit<\n SDKOptions,\n \"apiKey\" | \"appCategories\" | \"appTitle\" | \"httpReferer\" | \"serverURL\"\n> & {\n apiKey?: string;\n /** Comma-separated marketplace categories are produced from this list. */\n appCategories?: readonly string[];\n appName?: string;\n appUrl?: string;\n baseUrl?: string;\n tokenSource?: () => Promise<string> | string;\n};\n\n/**\n * Create OpenRouter's generated SDK with AbsoluteJS-style configuration.\n *\n * Use this for the complete REST surface: API keys, BYOK, guardrails,\n * observability, organizations, SCIM, datasets, benchmarks, and future\n * OpenAPI-generated additions. Use `openrouter()` for policy-aware inference.\n */\nexport const createOpenRouterSDK = (config: OpenRouterSDKConfig = {}) => {\n if (config.appCategories && config.appCategories.length > 2)\n throw new Error(\n \"createOpenRouterSDK() appCategories supports at most 2 entries\",\n );\n if (!config.apiKey && !config.tokenSource)\n throw new Error(\n \"createOpenRouterSDK() requires either apiKey or tokenSource\",\n );\n const {\n apiKey,\n appCategories,\n appName,\n appUrl,\n baseUrl,\n tokenSource,\n ...options\n } = config;\n return new OfficialOpenRouterSDK({\n ...options,\n apiKey: tokenSource ? async () => Promise.resolve(tokenSource()) : apiKey,\n appCategories: appCategories?.join(\",\"),\n appTitle: appName,\n httpReferer: appUrl,\n serverURL: baseUrl,\n });\n};\n\nexport { OfficialOpenRouterSDK as OpenRouterSDK };\nexport type { SDKOptions as OfficialOpenRouterSDKOptions } from \"@openrouter/sdk\";\nexport type { RequestOptions as OpenRouterSDKRequestOptions } from \"@openrouter/sdk/lib/sdks.js\";\n"
6
+ ],
7
+ "mappings": ";;;;AAAA;AAAA,gBACE;AAAA;AAwBK,IAAM,sBAAsB,CAAC,SAA8B,CAAC,MAAM;AAAA,EACvE,IAAI,OAAO,iBAAiB,OAAO,cAAc,SAAS;AAAA,IACxD,MAAM,IAAI,MACR,gEACF;AAAA,EACF,IAAI,CAAC,OAAO,UAAU,CAAC,OAAO;AAAA,IAC5B,MAAM,IAAI,MACR,6DACF;AAAA,EACF;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,OACG;AAAA,MACD;AAAA,EACJ,OAAO,IAAI,sBAAsB;AAAA,OAC5B;AAAA,IACH,QAAQ,cAAc,YAAY,QAAQ,QAAQ,YAAY,CAAC,IAAI;AAAA,IACnE,eAAe,eAAe,KAAK,GAAG;AAAA,IACtC,UAAU;AAAA,IACV,aAAa;AAAA,IACb,WAAW;AAAA,EACb,CAAC;AAAA;",
8
+ "debugId": "7959A7816069F74364756E2164756E21",
9
+ "names": []
10
+ }
@@ -25,7 +25,7 @@ export { anthropic } from "./providers/anthropic";
25
25
  export { ollama } from "./providers/ollama";
26
26
  export { openai } from "./providers/openai";
27
27
  export { createOpenRouterAuthorizationUrl, createOpenRouterClient, createOpenRouterKeyLinks, estimateOpenRouterCost, estimateOpenRouterModelCost, exchangeOpenRouterAuthCode, generateOpenRouterPKCE, openrouter, openrouterMessages, openrouterResponses, openRouterModelMatchesRule, verifyOpenRouterWebhookSignature, } from "./providers/openrouter";
28
- export type { OpenRouterActivityItem, OpenRouterActivityQuery, OpenRouterAnalyticsMeta, OpenRouterAnalyticsQuery, OpenRouterAnalyticsResponse, OpenRouterAuthCodeExchangeRequest, OpenRouterAuthCodeExchangeResponse, OpenRouterAutoRouterCostTier, OpenRouterAutoRouterPlugin, OpenRouterAuthorizationUrlOptions, OpenRouterBatch, OpenRouterBatchEndpoint, OpenRouterBatchRequest, OpenRouterBatchResult, OpenRouterBatchStatus, OpenRouterClient, OpenRouterClientConfig, OpenRouterConfig, OpenRouterCostEstimate, OpenRouterCostUnits, OpenRouterCreateAuthCodeRequest, OpenRouterCreateAuthCodeResponse, OpenRouterCreateBatchRequest, OpenRouterCreateWorkspaceRequest, OpenRouterDataCollection, OpenRouterEmbeddingRequest, OpenRouterEmbeddingResponse, OpenRouterFile, OpenRouterFileList, OpenRouterHttpRequestOptions, OpenRouterImageModelEndpoint, OpenRouterImageModelEndpoints, OpenRouterImageRequest, OpenRouterImageResponse, OpenRouterImageStreamEvent, OpenRouterMaxPrice, OpenRouterModel, OpenRouterModelList, OpenRouterModelQuery, OpenRouterPerformancePreference, OpenRouterPlugin, OpenRouterPKCE, OpenRouterPreset, OpenRouterPresetInferenceRequest, OpenRouterPresetResponse, OpenRouterPresetVersion, OpenRouterPresetVersionResponse, OpenRouterPricing, OpenRouterPricingKey, OpenRouterProviderRouting, OpenRouterQuantization, OpenRouterRequestOptions, OpenRouterRerankRequest, OpenRouterRerankResponse, OpenRouterResponseCache, OpenRouterResponsesRequest, OpenRouterServerTool, OpenRouterServiceTier, OpenRouterSpeechRequest, OpenRouterSort, OpenRouterSortStrategy, OpenRouterTrace, OpenRouterTaskClassifications, OpenRouterTranscriptionRequest, OpenRouterTranscriptionResponse, OpenRouterVideoJob, OpenRouterVideoRequest, OpenRouterVideoWebhookEvent, OpenRouterWorkspace, OpenRouterWorkspaceBudget, OpenRouterWorkspaceBudgetInterval, OpenRouterWorkspaceMember, OpenRouterWorkspaceOptions, OpenRouterZdrEndpoint, } from "./providers/openrouter";
28
+ export type { OpenRouterActivityItem, OpenRouterActivityQuery, OpenRouterAdvisorParameters, OpenRouterAnalyticsMeta, OpenRouterAnalyticsQuery, OpenRouterAnalyticsResponse, OpenRouterAuthCodeExchangeRequest, OpenRouterAuthCodeExchangeResponse, OpenRouterAutoRouterCostTier, OpenRouterAutoRouterPlugin, OpenRouterAuthorizationUrlOptions, OpenRouterBatch, OpenRouterBatchEndpoint, OpenRouterBatchRequest, OpenRouterBatchResult, OpenRouterBatchStatus, OpenRouterChatRequest, OpenRouterChatResponse, OpenRouterClient, OpenRouterClientConfig, OpenRouterConfig, OpenRouterCostEstimate, OpenRouterCostUnits, OpenRouterCreateAuthCodeRequest, OpenRouterCreateAuthCodeResponse, OpenRouterCreateBatchRequest, OpenRouterCreateWorkspaceRequest, OpenRouterDataCollection, OpenRouterEmbeddingRequest, OpenRouterEmbeddingResponse, OpenRouterFile, OpenRouterFileList, OpenRouterHttpRequestOptions, OpenRouterImageModelEndpoint, OpenRouterImageModelEndpoints, OpenRouterImageRequest, OpenRouterImageResponse, OpenRouterImageStreamEvent, OpenRouterImageGenerationParameters, OpenRouterMaxPrice, OpenRouterModel, OpenRouterModelList, OpenRouterModelQuery, OpenRouterPerformancePreference, OpenRouterPlugin, OpenRouterPKCE, OpenRouterPreset, OpenRouterPresetInferenceRequest, OpenRouterPresetResponse, OpenRouterPresetVersion, OpenRouterPresetVersionResponse, OpenRouterPricing, OpenRouterPricingKey, OpenRouterProviderRouting, OpenRouterQuantization, OpenRouterRequestOptions, OpenRouterRerankRequest, OpenRouterRerankResponse, OpenRouterResponseCache, OpenRouterResponsesRequest, OpenRouterServerTool, OpenRouterShellParameters, OpenRouterServiceTier, OpenRouterSpeechRequest, OpenRouterSort, OpenRouterSortStrategy, OpenRouterTrace, OpenRouterFusionPlugin, OpenRouterFusionServerToolParameters, OpenRouterResponseHealingPlugin, OpenRouterSubagentParameters, OpenRouterTaskClassifications, OpenRouterTranscriptionRequest, OpenRouterTranscriptionResponse, OpenRouterVideoJob, OpenRouterVideoRequest, OpenRouterVideoWebhookEvent, OpenRouterWorkspace, OpenRouterWorkspaceBudget, OpenRouterWorkspaceBudgetInterval, OpenRouterWorkspaceMember, OpenRouterWorkspaceOptions, OpenRouterWebFetchParameters, OpenRouterWebSearchParameters, OpenRouterWebSearchPlugin, OpenRouterZdrEndpoint, } from "./providers/openrouter";
29
29
  export { createOAuth2ClientCredentialsTokenSource } from "./providers/oauth2TokenSource";
30
30
  export type { OAuth2ClientCredentialsConfig } from "./providers/oauth2TokenSource";
31
31
  export { ProviderError, PROVIDER_STATUS_PAGES, providerStatusPage, } from "./errors/providerError";
@@ -81,13 +81,152 @@ export type OpenRouterAutoRouterPlugin = {
81
81
  /** Legacy numeric control. When present, OpenRouter prioritizes it over cost_tier. */
82
82
  cost_quality_tradeoff?: number;
83
83
  };
84
- export type OpenRouterPlugin = OpenRouterAutoRouterPlugin | {
84
+ /** @deprecated OpenRouter recommends the `openrouter:web_search` server tool. */
85
+ export type OpenRouterWebSearchPlugin = {
86
+ id: "web";
87
+ engine?: "native" | "exa" | "firecrawl" | "parallel" | "perplexity";
88
+ exclude_domains?: readonly string[];
89
+ include_domains?: readonly string[];
90
+ max_results?: number;
91
+ search_prompt?: string;
92
+ };
93
+ export type OpenRouterFusionPlugin = {
94
+ id: "fusion";
95
+ analysis_models?: readonly string[];
96
+ enabled?: boolean;
97
+ max_tool_calls?: number;
98
+ model?: string;
99
+ preset?: string;
100
+ };
101
+ export type OpenRouterResponseHealingPlugin = {
102
+ id: "response-healing";
103
+ };
104
+ export type OpenRouterPlugin = OpenRouterAutoRouterPlugin | OpenRouterFusionPlugin | OpenRouterResponseHealingPlugin | OpenRouterWebSearchPlugin | {
85
105
  id: string;
86
106
  [option: string]: unknown;
87
107
  };
108
+ export type OpenRouterWebSearchParameters = {
109
+ allowed_domains?: readonly string[];
110
+ engine?: "auto" | "native" | "exa" | "firecrawl" | "parallel" | "perplexity";
111
+ excluded_domains?: readonly string[];
112
+ max_characters?: number;
113
+ max_results?: number;
114
+ max_total_results?: number;
115
+ search_context_size?: "low" | "medium" | "high";
116
+ user_location?: {
117
+ city?: string;
118
+ country?: string;
119
+ region?: string;
120
+ timezone?: string;
121
+ type: "approximate";
122
+ };
123
+ };
124
+ export type OpenRouterWebFetchParameters = {
125
+ allowed_domains?: readonly string[];
126
+ blocked_domains?: readonly string[];
127
+ engine?: "auto" | "native" | "exa" | "openrouter" | "firecrawl" | "parallel";
128
+ max_content_tokens?: number;
129
+ max_uses?: number;
130
+ };
131
+ export type OpenRouterImageGenerationParameters = {
132
+ aspect_ratio?: string;
133
+ background?: string;
134
+ model?: string;
135
+ moderation?: string;
136
+ output_compression?: number;
137
+ output_format?: string;
138
+ quality?: string;
139
+ size?: string;
140
+ };
141
+ export type OpenRouterSubagentParameters = {
142
+ inherit_functions?: boolean;
143
+ inherited_function_names?: readonly string[];
144
+ instructions?: string;
145
+ max_completion_tokens?: number;
146
+ max_tool_calls?: number;
147
+ model?: string;
148
+ name?: string;
149
+ reasoning?: {
150
+ effort?: OpenRouterReasoning["effort"];
151
+ max_tokens?: number;
152
+ };
153
+ temperature?: number;
154
+ tools?: readonly Exclude<OpenRouterServerTool, {
155
+ type: "openrouter:subagent";
156
+ }>[];
157
+ };
158
+ export type OpenRouterAdvisorParameters = {
159
+ forward_transcript?: boolean;
160
+ instructions?: string;
161
+ max_completion_tokens?: number;
162
+ model?: string;
163
+ name?: string;
164
+ reasoning?: {
165
+ effort?: string;
166
+ max_tokens?: number;
167
+ };
168
+ stream?: boolean;
169
+ temperature?: number;
170
+ };
171
+ export type OpenRouterFusionServerToolParameters = {
172
+ analysis_models?: readonly string[];
173
+ cache_control?: OpenRouterCacheControl;
174
+ max_completion_tokens?: number;
175
+ max_tool_calls?: number;
176
+ model?: string;
177
+ reasoning?: {
178
+ effort?: string;
179
+ max_tokens?: number;
180
+ };
181
+ temperature?: number;
182
+ tools?: readonly OpenRouterServerTool[];
183
+ };
184
+ export type OpenRouterShellParameters = {
185
+ engine?: "auto" | "openrouter";
186
+ environment?: {
187
+ type: "container_auto";
188
+ } | {
189
+ container_id: string;
190
+ type: "container_reference";
191
+ };
192
+ sleep_after_seconds?: number;
193
+ };
88
194
  export type OpenRouterServerTool = {
89
- type: "openrouter:web_search" | "openrouter:web_fetch" | "openrouter:datetime" | "openrouter:image_generation" | "openrouter:apply_patch" | "openrouter:shell" | "openrouter:fusion" | "openrouter:advisor" | "openrouter:subagent" | "openrouter:experimental__search_models";
90
- parameters?: Record<string, unknown>;
195
+ type: "openrouter:web_search";
196
+ parameters?: OpenRouterWebSearchParameters;
197
+ } | {
198
+ type: "openrouter:web_fetch";
199
+ parameters?: OpenRouterWebFetchParameters;
200
+ } | {
201
+ type: "openrouter:datetime";
202
+ parameters?: {
203
+ timezone?: string;
204
+ };
205
+ } | {
206
+ type: "openrouter:image_generation";
207
+ parameters?: OpenRouterImageGenerationParameters;
208
+ } | {
209
+ type: "openrouter:apply_patch";
210
+ parameters?: {
211
+ engine?: "auto" | "native" | "openrouter";
212
+ };
213
+ } | {
214
+ type: "openrouter:subagent";
215
+ parameters: OpenRouterSubagentParameters;
216
+ } | {
217
+ type: "openrouter:advisor";
218
+ parameters?: OpenRouterAdvisorParameters;
219
+ } | {
220
+ type: "openrouter:fusion";
221
+ parameters?: OpenRouterFusionServerToolParameters;
222
+ } | {
223
+ type: "openrouter:shell";
224
+ parameters?: OpenRouterShellParameters;
225
+ } | {
226
+ type: "openrouter:experimental__search_models";
227
+ parameters?: {
228
+ max_results?: number;
229
+ };
91
230
  };
92
231
  export type OpenRouterRequestOptions = {
93
232
  /** Stream text and synthesized audio from an audio-output chat model. */
@@ -163,4 +302,4 @@ export declare const openrouterResponses: (config: OpenRouterConfig) => AIProvid
163
302
  /** OpenRouter provider using the native Anthropic Messages protocol skin. */
164
303
  export declare const openrouterMessages: (config: OpenRouterConfig) => AIProviderConfig;
165
304
  export { createOpenRouterAuthorizationUrl, createOpenRouterClient, createOpenRouterKeyLinks, estimateOpenRouterCost, estimateOpenRouterModelCost, exchangeOpenRouterAuthCode, generateOpenRouterPKCE, openRouterModelMatchesRule, verifyOpenRouterWebhookSignature, } from "./openrouterClient";
166
- export type { OpenRouterActivityItem, OpenRouterActivityQuery, OpenRouterAnalyticsMeta, OpenRouterAnalyticsQuery, OpenRouterAnalyticsResponse, OpenRouterAuthCodeExchangeRequest, OpenRouterAuthCodeExchangeResponse, OpenRouterAuthorizationUrlOptions, OpenRouterBatch, OpenRouterBatchEndpoint, OpenRouterBatchRequest, OpenRouterBatchResult, OpenRouterBatchStatus, OpenRouterClient, OpenRouterClientConfig, OpenRouterCostEstimate, OpenRouterCostUnits, OpenRouterCreateAuthCodeRequest, OpenRouterCreateAuthCodeResponse, OpenRouterCreateBatchRequest, OpenRouterCreateWorkspaceRequest, OpenRouterEmbeddingRequest, OpenRouterEmbeddingResponse, OpenRouterFile, OpenRouterFileList, OpenRouterHttpRequestOptions, OpenRouterImageModelEndpoint, OpenRouterImageModelEndpoints, OpenRouterImageRequest, OpenRouterImageResponse, OpenRouterImageStreamEvent, OpenRouterModel, OpenRouterModelList, OpenRouterModelQuery, OpenRouterPreset, OpenRouterPresetInferenceRequest, OpenRouterPresetResponse, OpenRouterPresetVersion, OpenRouterPresetVersionResponse, OpenRouterPricing, OpenRouterPricingKey, OpenRouterPKCE, OpenRouterRerankRequest, OpenRouterRerankResponse, OpenRouterResponsesRequest, OpenRouterSpeechRequest, OpenRouterTranscriptionRequest, OpenRouterTranscriptionResponse, OpenRouterTaskClassifications, OpenRouterVideoJob, OpenRouterVideoRequest, OpenRouterVideoWebhookEvent, OpenRouterWorkspace, OpenRouterWorkspaceBudget, OpenRouterWorkspaceBudgetInterval, OpenRouterWorkspaceMember, OpenRouterWorkspaceOptions, OpenRouterZdrEndpoint, } from "./openrouterClient";
305
+ export type { OpenRouterActivityItem, OpenRouterActivityQuery, OpenRouterAnalyticsMeta, OpenRouterAnalyticsQuery, OpenRouterAnalyticsResponse, OpenRouterAuthCodeExchangeRequest, OpenRouterAuthCodeExchangeResponse, OpenRouterAuthorizationUrlOptions, OpenRouterBatch, OpenRouterBatchEndpoint, OpenRouterBatchRequest, OpenRouterBatchResult, OpenRouterBatchStatus, OpenRouterChatRequest, OpenRouterChatResponse, OpenRouterClient, OpenRouterClientConfig, OpenRouterCostEstimate, OpenRouterCostUnits, OpenRouterCreateAuthCodeRequest, OpenRouterCreateAuthCodeResponse, OpenRouterCreateBatchRequest, OpenRouterCreateWorkspaceRequest, OpenRouterEmbeddingRequest, OpenRouterEmbeddingResponse, OpenRouterFile, OpenRouterFileList, OpenRouterHttpRequestOptions, OpenRouterImageModelEndpoint, OpenRouterImageModelEndpoints, OpenRouterImageRequest, OpenRouterImageResponse, OpenRouterImageStreamEvent, OpenRouterModel, OpenRouterModelList, OpenRouterModelQuery, OpenRouterPreset, OpenRouterPresetInferenceRequest, OpenRouterPresetResponse, OpenRouterPresetVersion, OpenRouterPresetVersionResponse, OpenRouterPricing, OpenRouterPricingKey, OpenRouterPKCE, OpenRouterRerankRequest, OpenRouterRerankResponse, OpenRouterResponsesRequest, OpenRouterSpeechRequest, OpenRouterTranscriptionRequest, OpenRouterTranscriptionResponse, OpenRouterTaskClassifications, OpenRouterVideoJob, OpenRouterVideoRequest, OpenRouterVideoWebhookEvent, OpenRouterWorkspace, OpenRouterWorkspaceBudget, OpenRouterWorkspaceBudgetInterval, OpenRouterWorkspaceMember, OpenRouterWorkspaceOptions, OpenRouterZdrEndpoint, } from "./openrouterClient";
@@ -139,6 +139,17 @@ export type OpenRouterEmbeddingRequest = {
139
139
  provider?: Record<string, unknown>;
140
140
  user?: string;
141
141
  };
142
+ export type OpenRouterChatRequest = Record<string, unknown> & {
143
+ messages: readonly unknown[];
144
+ model: string;
145
+ stream?: false;
146
+ };
147
+ export type OpenRouterChatResponse = Record<string, unknown> & {
148
+ choices: Array<Record<string, unknown>>;
149
+ id: string;
150
+ model: string;
151
+ usage?: Record<string, unknown>;
152
+ };
142
153
  export type OpenRouterEmbeddingResponse = {
143
154
  data: Array<{
144
155
  embedding: number[] | string;
@@ -517,6 +528,7 @@ export declare const createOpenRouterClient: (config: OpenRouterClientConfig) =>
517
528
  data: OpenRouterWorkspaceMember[];
518
529
  }>;
519
530
  createAuthCode: (body: OpenRouterCreateAuthCodeRequest) => Promise<OpenRouterCreateAuthCodeResponse>;
531
+ chat: (body: OpenRouterChatRequest) => Promise<OpenRouterChatResponse>;
520
532
  createPresetFromChatCompletions: (slug: string, body: OpenRouterPresetInferenceRequest) => Promise<OpenRouterPresetResponse>;
521
533
  createPresetFromMessages: (slug: string, body: OpenRouterPresetInferenceRequest) => Promise<OpenRouterPresetResponse>;
522
534
  createPresetFromResponses: (slug: string, body: OpenRouterPresetInferenceRequest) => Promise<OpenRouterPresetResponse>;
@@ -568,6 +580,7 @@ export declare const createOpenRouterClient: (config: OpenRouterClientConfig) =>
568
580
  data: OpenRouterWorkspace;
569
581
  }>;
570
582
  listImageModels: () => Promise<OpenRouterModelList>;
583
+ listEmbeddingModels: () => Promise<OpenRouterModelList>;
571
584
  listFiles: (query?: {
572
585
  cursor?: string;
573
586
  limit?: number;
@@ -0,0 +1,21 @@
1
+ import { OpenRouter as OfficialOpenRouterSDK, type SDKOptions } from "@openrouter/sdk";
2
+ export type OpenRouterSDKConfig = Omit<SDKOptions, "apiKey" | "appCategories" | "appTitle" | "httpReferer" | "serverURL"> & {
3
+ apiKey?: string;
4
+ /** Comma-separated marketplace categories are produced from this list. */
5
+ appCategories?: readonly string[];
6
+ appName?: string;
7
+ appUrl?: string;
8
+ baseUrl?: string;
9
+ tokenSource?: () => Promise<string> | string;
10
+ };
11
+ /**
12
+ * Create OpenRouter's generated SDK with AbsoluteJS-style configuration.
13
+ *
14
+ * Use this for the complete REST surface: API keys, BYOK, guardrails,
15
+ * observability, organizations, SCIM, datasets, benchmarks, and future
16
+ * OpenAPI-generated additions. Use `openrouter()` for policy-aware inference.
17
+ */
18
+ export declare const createOpenRouterSDK: (config?: OpenRouterSDKConfig) => OfficialOpenRouterSDK;
19
+ export { OfficialOpenRouterSDK as OpenRouterSDK };
20
+ export type { SDKOptions as OfficialOpenRouterSDKOptions } from "@openrouter/sdk";
21
+ export type { RequestOptions as OpenRouterSDKRequestOptions } from "@openrouter/sdk/lib/sdks.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/ai",
3
- "version": "0.0.52",
3
+ "version": "0.0.53",
4
4
  "homepage": "https://github.com/absolutejs/ai",
5
5
  "bugs": {
6
6
  "url": "https://github.com/absolutejs/ai/issues"
@@ -63,6 +63,10 @@
63
63
  "import": "./dist/ai/providers/openrouter.js",
64
64
  "types": "./dist/src/ai/providers/openrouter.d.ts"
65
65
  },
66
+ "./openrouter/sdk": {
67
+ "import": "./dist/ai/providers/openrouterSDK.js",
68
+ "types": "./dist/src/ai/providers/openrouterSDK.d.ts"
69
+ },
66
70
  "./openai-responses": {
67
71
  "import": "./dist/ai/providers/openaiResponses.js",
68
72
  "types": "./dist/src/ai/providers/openaiResponses.d.ts"
@@ -85,7 +89,8 @@
85
89
  }
86
90
  },
87
91
  "dependencies": {
88
- "@absolutejs/linked-providers": "0.0.2"
92
+ "@absolutejs/linked-providers": "0.0.2",
93
+ "@openrouter/sdk": "^1.2.47"
89
94
  },
90
95
  "peerDependencies": {
91
96
  "@absolutejs/isolated-jsc": ">= 0.4.0",
@@ -182,6 +187,9 @@
182
187
  "openrouter": [
183
188
  "dist/src/ai/providers/openrouter.d.ts"
184
189
  ],
190
+ "openrouter/sdk": [
191
+ "dist/src/ai/providers/openrouterSDK.d.ts"
192
+ ],
185
193
  "openai-responses": [
186
194
  "dist/src/ai/providers/openaiResponses.d.ts"
187
195
  ],