@tool-bridge/server 0.21.1 → 0.22.1
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/admin.js +170 -0
- package/dist/airtable-ML2GIGCH.js +790 -0
- package/dist/{alt_text_generator_ai-W7O34SNG.js → alt_text_generator_ai-FGYQAF2A.js} +12 -11
- package/dist/{amap-VOX4T2AW.js → amap-G7V65NGK.js} +221 -220
- package/dist/anthropic-6ZK24TBB.js +203 -0
- package/dist/apify-VDGYHP6W.js +248 -0
- package/dist/brave_search-TAATLZOS.js +302 -0
- package/dist/chunk-2IAI3XQM.js +302 -0
- package/dist/chunk-7ISGFRC6.js +161 -0
- package/dist/{chunk-E6JCVKW6.js → chunk-BNMLA2RC.js} +3 -3
- package/dist/chunk-HA4BGL6C.js +8429 -0
- package/dist/{chunk-KMTT3I6D.js → chunk-RMAWSG7E.js} +19172 -25717
- package/dist/{chunk-XYBU3WZH.js → chunk-RTW5VRTK.js} +3 -3
- package/dist/chunk-U7PTOA3U.js +7320 -0
- package/dist/chunk-UY6ANCOY.js +378 -0
- package/dist/{chunk-ATK45BXV.js → chunk-X7ZUTKHR.js} +4 -2
- package/dist/circleci-BQ2UWXL2.js +389 -0
- package/dist/clerk-2JYWQNOI.js +1019 -0
- package/dist/cohere-6MI7AQM4.js +185 -0
- package/dist/{confluence-B3EWPZVE.js → confluence-6Y6GDETF.js} +105 -104
- package/dist/{convertapi-EUWSQYPF.js → convertapi-HBZCSWOX.js} +32 -31
- package/dist/{currencyapi-KVTIK3GL.js → currencyapi-337U5TGI.js} +71 -71
- package/dist/deepseek-OSPASO7O.js +210 -0
- package/dist/docker_hub-3ATQOY5L.js +933 -0
- package/dist/dropbox-LSA4GM2Y.js +1305 -0
- package/dist/dub-VZPJSPI6.js +680 -0
- package/dist/e2b-6SDYQZL2.js +278 -0
- package/dist/exa-B6EUYDVP.js +332 -0
- package/dist/{fal_ai-23E7JPNT.js → fal_ai-K4Q27IME.js} +81 -80
- package/dist/{feishu-7QRIDUV6.js → feishu-4TKXG4SU.js} +528 -572
- package/dist/{feishu_custom_bot-TJ4K7QNJ.js → feishu_custom_bot-7CTEAKRB.js} +57 -53
- package/dist/figma-OUKSZLD5.js +777 -0
- package/dist/firehydrant-7MOYL7QH.js +563 -0
- package/dist/{fixer-BWON27UO.js → fixer-H2BV2NO4.js} +34 -33
- package/dist/fly-PXKY6PNH.js +469 -0
- package/dist/{front-QCGXYEDJ.js → front-UZYIV5DW.js} +104 -104
- package/dist/geocodio-NSYO7TFP.js +213 -0
- package/dist/ghost-QBKKQQMF.js +338 -0
- package/dist/github-ENLSJ4CL.js +5421 -0
- package/dist/gmail-KQSDEB47.js +1887 -0
- package/dist/googlecalendar-5YCX4SZF.js +2524 -0
- package/dist/{googledocs-BUHL4J2H.js → googledocs-SSWIVFKA.js} +341 -340
- package/dist/{grafana-GLU2DWF2.js → grafana-TF2LXDQA.js} +221 -220
- package/dist/graphhopper-CURBVHYK.js +325 -0
- package/dist/index.d.ts +1132 -332
- package/dist/index.js +31 -14
- package/dist/{ip2proxy-EZ64Y4ZH.js → ip2proxy-YNVMTZEM.js} +28 -27
- package/dist/ipgeolocation_io-NAU7VJ4J.js +315 -0
- package/dist/ipqualityscore-OT63L4TI.js +279 -0
- package/dist/{jina_ai-EFBHTBXL.js → jina_ai-6WBMBGWM.js} +23 -23
- package/dist/{jira-HQSHAA5K.js → jira-DVDVTHNO.js} +118 -117
- package/dist/langsmith-IM5N4YAU.js +593 -0
- package/dist/lemlist-277SHUQF.js +289 -0
- package/dist/{linear-K7RYFYAD.js → linear-AEPH7B5V.js} +327 -326
- package/dist/logsnag-VEWRAGBG.js +150 -0
- package/dist/main.js +57 -280
- package/dist/{mattermost-S2BRCWLQ.js → mattermost-Q3A2BIZA.js} +59 -58
- package/dist/mem0-AXS7GZGI.js +544 -0
- package/dist/memos-7TXG4ZTU.js +744 -0
- package/dist/{metabase-MMSEPCOF.js → metabase-NSVACWQM.js} +90 -89
- package/dist/mistral_ai-YZ52RGD4.js +1196 -0
- package/dist/{mother_duck-H7PCQNZ2.js → mother_duck-XLLL6FVL.js} +94 -93
- package/dist/ngrok-4O4W3WZW.js +356 -0
- package/dist/{notes-PFMKRO33.js → notes-YTB3TJOO.js} +11 -9
- package/dist/notion-4W4O7J7V.js +940 -0
- package/dist/open_exchange_rates-23QJXVO5.js +215 -0
- package/dist/openai-ZS7GLSLH.js +800 -0
- package/dist/opengraph_io-PMVH7OYI.js +362 -0
- package/dist/openrouter-ONRGFNB6.js +441 -0
- package/dist/outline-UCUYZZ7J.js +599 -0
- package/dist/paddle-35HTKTUL.js +454 -0
- package/dist/perplexity-NVOBYN24.js +220 -0
- package/dist/pinecone-55CJY73C.js +571 -0
- package/dist/{pipedrive-Y2O7QGFF.js → pipedrive-WMCAKS72.js} +99 -98
- package/dist/polar-SM4ZM53B.js +395 -0
- package/dist/posthog-NWCXVXNJ.js +3464 -0
- package/dist/postmark-QJV5PHUQ.js +427 -0
- package/dist/{prerender-MENYM2TY.js → prerender-2W7UT4SC.js} +31 -30
- package/dist/{pubmed-GOXUVVH5.js → pubmed-VVV7XYLU.js} +239 -238
- package/dist/{railway-V2SID4WV.js → railway-KGI57S3O.js} +118 -117
- package/dist/readwise-AGHTQB42.js +470 -0
- package/dist/render-O4HBROCK.js +461 -0
- package/dist/{replicate-756MXPYX.js → replicate-KWBOMX7D.js} +81 -80
- package/dist/{resend-ZKH3BTBI.js → resend-DRH6Y6I4.js} +20 -16
- package/dist/rootly-XGCUDW6X.js +336 -0
- package/dist/{scrapfly-NSRHFDIQ.js → scrapfly-OIQ3OY6L.js} +62 -61
- package/dist/{scrapingbee-OQHLAVEY.js → scrapingbee-OCZO4FHX.js} +56 -56
- package/dist/{screenshot_fyi-DVWG3AXC.js → screenshot_fyi-CUNGFZOC.js} +16 -16
- package/dist/semantic_scholar-3UJRLKES.js +611 -0
- package/dist/{sentry-546MNDJG.js → sentry-5BWVZFJV.js} +208 -207
- package/dist/{shodan-C3OON3Z3.js → shodan-HI37CTEW.js} +62 -61
- package/dist/shopify-LJ2EV2HH.js +610 -0
- package/dist/stripe-3LHMV55K.js +585 -0
- package/dist/{supabase-U2SL4D63.js → supabase-H2KPX3Q2.js} +245 -244
- package/dist/tavily-FBEWGH3Z.js +326 -0
- package/dist/telegram-MYYO3JND.js +1767 -0
- package/dist/{telnyx-CXQ4EZUX.js → telnyx-H4ALEGAX.js} +57 -56
- package/dist/todoist-OBWICA5Q.js +664 -0
- package/dist/trello-GUFUJRWO.js +1080 -0
- package/dist/turso-NIAK4UMS.js +416 -0
- package/dist/{twilio-4PDBJKWX.js → twilio-K6SLK2CX.js} +70 -69
- package/dist/umami-42RS2EPS.js +389 -0
- package/dist/unsplash-V7TOTETT.js +351 -0
- package/dist/{upstash_redis-G4LQBYHA.js → upstash_redis-AWQMB6Y3.js} +51 -50
- package/dist/uptimerobot-AZC2DHOT.js +483 -0
- package/dist/v2ex-4TVRNMLS.js +667 -0
- package/dist/vercel-DPHTJ3XR.js +1076 -0
- package/dist/{wolfram_alpha_api-3G4PUJWB.js → wolfram_alpha_api-XAG7IXBW.js} +36 -35
- package/dist/wordpress-KMPKVGUX.js +812 -0
- package/dist/workos-PKB2YR7S.js +664 -0
- package/dist/zhihu-Y4H4XYPB.js +254 -0
- package/package.json +18 -9
- package/dist/airtable-LLZDFN7M.js +0 -789
- package/dist/anthropic-G23NN3X5.js +0 -202
- package/dist/apify-Y3SS734K.js +0 -247
- package/dist/brave_search-ZC7OAPSZ.js +0 -301
- package/dist/chunk-R6P4XAE5.js +0 -248
- package/dist/chunk-U7B6DS2O.js +0 -977
- package/dist/chunk-UZM2RXZH.js +0 -23436
- package/dist/circleci-3BAX5FCG.js +0 -388
- package/dist/clerk-6LEM6TNU.js +0 -1019
- package/dist/cloudflare_dns-KINYTJUD.js +0 -588
- package/dist/cohere-XCJ5AJ6B.js +0 -185
- package/dist/deepseek-PC5YGNC5.js +0 -209
- package/dist/docker_hub-C3MA5FU6.js +0 -932
- package/dist/dropbox-XBV7Z2IR.js +0 -1304
- package/dist/dub-LDOFG3HC.js +0 -679
- package/dist/e2b-JMCPSVBW.js +0 -277
- package/dist/exa-RAK7O7RD.js +0 -331
- package/dist/figma-E6IX5DTH.js +0 -773
- package/dist/firehydrant-ZBLPQREE.js +0 -562
- package/dist/fly-ZH3HFCZJ.js +0 -468
- package/dist/geocodio-YGNI7DA4.js +0 -212
- package/dist/ghost-EVSGKH2Q.js +0 -337
- package/dist/github-MA2BGRCJ.js +0 -5420
- package/dist/gmail-E5E6AADE.js +0 -1886
- package/dist/googlecalendar-BTLFPXTD.js +0 -2523
- package/dist/graphhopper-WSMB3TCD.js +0 -324
- package/dist/ipgeolocation_io-AA7HAS22.js +0 -315
- package/dist/ipqualityscore-BHJXVTJT.js +0 -277
- package/dist/langsmith-5W6SCT6F.js +0 -592
- package/dist/lemlist-HJWH6UMK.js +0 -288
- package/dist/logsnag-4KFOHL37.js +0 -150
- package/dist/mem0-CAW43CIC.js +0 -543
- package/dist/memos-TWEGPKFM.js +0 -740
- package/dist/mistral_ai-64BGZQHP.js +0 -1195
- package/dist/ngrok-GQCUGZKJ.js +0 -356
- package/dist/notion-DQWZWP4N.js +0 -936
- package/dist/open_exchange_rates-QMMD735E.js +0 -214
- package/dist/openai-W6PX32NZ.js +0 -799
- package/dist/opengraph_io-HNDBXYNW.js +0 -361
- package/dist/openrouter-JJYMEAUL.js +0 -437
- package/dist/outline-MCBNQZYY.js +0 -595
- package/dist/paddle-D2SKLUDN.js +0 -453
- package/dist/perplexity-XIFMKUAE.js +0 -219
- package/dist/pinecone-HUFTALV2.js +0 -570
- package/dist/polar-TYTOMOSR.js +0 -394
- package/dist/posthog-43JAR3VW.js +0 -3463
- package/dist/postmark-KL2QJYSG.js +0 -426
- package/dist/readwise-CI4GIMMJ.js +0 -469
- package/dist/render-SUBJ6YRZ.js +0 -460
- package/dist/rootly-CD2LJHPI.js +0 -336
- package/dist/semantic_scholar-T4A252KW.js +0 -610
- package/dist/shopify-Y2HN2MCQ.js +0 -609
- package/dist/stripe-VE3CD3AY.js +0 -584
- package/dist/tavily-KCZHK6HE.js +0 -326
- package/dist/telegram-3URFBCMY.js +0 -1766
- package/dist/todoist-HNPWNYTD.js +0 -663
- package/dist/trello-3W2MIXRP.js +0 -1079
- package/dist/turso-2EQF7C2Z.js +0 -415
- package/dist/umami-5REN7TGP.js +0 -388
- package/dist/unsplash-EIXL424F.js +0 -350
- package/dist/uptimerobot-KNJ3EYLY.js +0 -482
- package/dist/v2ex-RHJ234PZ.js +0 -666
- package/dist/vercel-AS6NCIC7.js +0 -1075
- package/dist/wordpress-KNDAAUV7.js +0 -811
- package/dist/workos-R6UITSJ7.js +0 -663
- package/dist/zhihu-AGK4HILK.js +0 -253
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createAuthedClient
|
|
3
|
+
} from "./chunk-RTW5VRTK.js";
|
|
4
|
+
import "./chunk-BNMLA2RC.js";
|
|
5
|
+
import {
|
|
6
|
+
asJsonObject,
|
|
7
|
+
compactDefined,
|
|
8
|
+
trimmedText
|
|
9
|
+
} from "./chunk-JXHMDBAY.js";
|
|
10
|
+
import {
|
|
11
|
+
createProviderPlugin,
|
|
12
|
+
upstreamError
|
|
13
|
+
} from "./chunk-X7ZUTKHR.js";
|
|
14
|
+
import "./chunk-7ISGFRC6.js";
|
|
15
|
+
import "./chunk-UY6ANCOY.js";
|
|
16
|
+
import {
|
|
17
|
+
TBError
|
|
18
|
+
} from "./chunk-HA4BGL6C.js";
|
|
19
|
+
import "./chunk-U67V476Y.js";
|
|
20
|
+
|
|
21
|
+
// ../plugins/src/openrouter/api.ts
|
|
22
|
+
var SERVICE = "openrouter";
|
|
23
|
+
var API_BASE = "https://openrouter.ai/api/v1";
|
|
24
|
+
var HEADER_INPUT_KEYS = ["httpReferer", "xTitle"];
|
|
25
|
+
function requireRecord(value, label) {
|
|
26
|
+
const result = asJsonObject(value);
|
|
27
|
+
if (result === void 0) {
|
|
28
|
+
throw new TBError("unavailable", `OpenRouter \u7684${label}\u4E0D\u662F\u5BF9\u8C61`, { retryable: true });
|
|
29
|
+
}
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
function stripHeaderInputs(input) {
|
|
33
|
+
return Object.fromEntries(
|
|
34
|
+
Object.entries(input).filter(([key, value]) => !HEADER_INPUT_KEYS.includes(key) && value !== void 0)
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
function assertStreamingDisabled(input) {
|
|
38
|
+
if (input.stream === true) {
|
|
39
|
+
throw new TBError("invalid_argument", "stream=true \u4E0D\u88AB\u652F\u6301:\u672C action \u53EA\u8FD4\u56DE\u4E00\u6B21\u6027\u54CD\u5E94");
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function legacyTools(value) {
|
|
43
|
+
if (!Array.isArray(value)) return void 0;
|
|
44
|
+
return value.map((tool) => ({ type: "function", function: tool }));
|
|
45
|
+
}
|
|
46
|
+
function legacyToolChoice(value) {
|
|
47
|
+
if (value === "none" || value === "auto") return value;
|
|
48
|
+
const name = trimmedText(asJsonObject(value)?.name);
|
|
49
|
+
if (name === void 0) return void 0;
|
|
50
|
+
return { type: "function", function: { name } };
|
|
51
|
+
}
|
|
52
|
+
function errorMessage(payload) {
|
|
53
|
+
const body = asJsonObject(payload);
|
|
54
|
+
if (body === void 0) return void 0;
|
|
55
|
+
return trimmedText(asJsonObject(body.error)?.message) ?? trimmedText(body.message);
|
|
56
|
+
}
|
|
57
|
+
var http = createAuthedClient({
|
|
58
|
+
baseUrl: `${API_BASE}/`,
|
|
59
|
+
service: SERVICE,
|
|
60
|
+
auth: { kind: "bearer" },
|
|
61
|
+
// 非 JSON 错误体**不回显原文**(bodyKind 门控),与标准提取的 string 取文语义不同,整段覆写。
|
|
62
|
+
mapError: ({ bodyKind, data, status }) => upstreamError(
|
|
63
|
+
status,
|
|
64
|
+
bodyKind === "json" ? errorMessage(data) ?? `OpenRouter \u8FD4\u56DE HTTP ${status}` : `OpenRouter \u8FD4\u56DE HTTP ${status}`
|
|
65
|
+
)
|
|
66
|
+
});
|
|
67
|
+
async function request(ctx, input) {
|
|
68
|
+
const hasBody = input.body !== void 0;
|
|
69
|
+
const headers = new Headers();
|
|
70
|
+
const referer = trimmedText(input.headerSource?.httpReferer);
|
|
71
|
+
const title = trimmedText(input.headerSource?.xTitle);
|
|
72
|
+
if (referer !== void 0) headers.set("HTTP-Referer", referer);
|
|
73
|
+
if (title !== void 0) headers.set("X-Title", title);
|
|
74
|
+
const response = await http.request(ctx, {
|
|
75
|
+
method: input.method ?? "GET",
|
|
76
|
+
path: input.path,
|
|
77
|
+
query: Object.entries(input.query ?? {}),
|
|
78
|
+
headers,
|
|
79
|
+
...hasBody ? { json: compactDefined(input.body ?? {}) } : {},
|
|
80
|
+
responseType: "json",
|
|
81
|
+
invalidJson: "text"
|
|
82
|
+
});
|
|
83
|
+
const contentType = response.headers.get("content-type") ?? "";
|
|
84
|
+
const isText = contentType.includes("xml") || contentType.includes("rss") || contentType.startsWith("text/");
|
|
85
|
+
if (input.allowText === true && response.bodyKind === "invalid-json" && isText) {
|
|
86
|
+
return { rss: String(response.data) };
|
|
87
|
+
}
|
|
88
|
+
if (response.bodyKind !== "json") {
|
|
89
|
+
throw new TBError("unavailable", "OpenRouter \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94", { retryable: true });
|
|
90
|
+
}
|
|
91
|
+
return requireRecord(response.data, "\u54CD\u5E94");
|
|
92
|
+
}
|
|
93
|
+
function createChatCompletion(input, ctx) {
|
|
94
|
+
assertStreamingDisabled(input);
|
|
95
|
+
const body = stripHeaderInputs(input);
|
|
96
|
+
return request(ctx, {
|
|
97
|
+
method: "POST",
|
|
98
|
+
path: "/chat/completions",
|
|
99
|
+
headerSource: input,
|
|
100
|
+
body: compactDefined({
|
|
101
|
+
...body,
|
|
102
|
+
// 给了新字段就不翻译 legacy 的那两个(新的优先),翻完旧字段一律不发。
|
|
103
|
+
tools: body.tools ?? legacyTools(input.functions),
|
|
104
|
+
tool_choice: body.tool_choice ?? legacyToolChoice(input.function_call),
|
|
105
|
+
functions: void 0,
|
|
106
|
+
function_call: void 0
|
|
107
|
+
})
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
function createCoinbaseCharge(input, ctx) {
|
|
111
|
+
return request(ctx, {
|
|
112
|
+
method: "POST",
|
|
113
|
+
path: "/credits/coinbase",
|
|
114
|
+
headerSource: input,
|
|
115
|
+
body: stripHeaderInputs(input)
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
function createMessage(input, ctx) {
|
|
119
|
+
assertStreamingDisabled(input);
|
|
120
|
+
return request(ctx, {
|
|
121
|
+
method: "POST",
|
|
122
|
+
path: "/messages",
|
|
123
|
+
headerSource: input,
|
|
124
|
+
body: stripHeaderInputs(input)
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
function getCredits(_input, ctx) {
|
|
128
|
+
return request(ctx, { path: "/credits" });
|
|
129
|
+
}
|
|
130
|
+
function getCurrentKey(input, ctx) {
|
|
131
|
+
return request(ctx, { path: "/key", headerSource: input });
|
|
132
|
+
}
|
|
133
|
+
function getGeneration(input, ctx) {
|
|
134
|
+
return request(ctx, { path: "/generation", query: { id: input.id } });
|
|
135
|
+
}
|
|
136
|
+
function getModelsCount(input, ctx) {
|
|
137
|
+
return request(ctx, {
|
|
138
|
+
path: "/models/count",
|
|
139
|
+
headerSource: input,
|
|
140
|
+
query: { output_modalities: trimmedText(input.outputModalities) }
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
function listAvailableModels(input, ctx) {
|
|
144
|
+
return request(ctx, {
|
|
145
|
+
path: "/models",
|
|
146
|
+
// 入参名是驼峰,query 名是下划线 —— 这一层改名是上游的,不是笔误。
|
|
147
|
+
query: {
|
|
148
|
+
category: trimmedText(input.category),
|
|
149
|
+
supported_parameters: trimmedText(input.supportedParameters),
|
|
150
|
+
output_modalities: trimmedText(input.outputModalities),
|
|
151
|
+
use_rss: input.useRss,
|
|
152
|
+
use_rss_chat_links: input.useRssChatLinks
|
|
153
|
+
},
|
|
154
|
+
allowText: input.useRss === true
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
function listEmbeddingModels(input, ctx) {
|
|
158
|
+
return request(ctx, { path: "/embeddings/models", headerSource: input });
|
|
159
|
+
}
|
|
160
|
+
function listModelEndpoints(input, ctx) {
|
|
161
|
+
const path = `/models/${encodeURIComponent(input.author)}/${encodeURIComponent(input.slug)}/endpoints`;
|
|
162
|
+
return request(ctx, { path });
|
|
163
|
+
}
|
|
164
|
+
function listProviders(_input, ctx) {
|
|
165
|
+
return request(ctx, { path: "/providers" });
|
|
166
|
+
}
|
|
167
|
+
function listUserModels(input, ctx) {
|
|
168
|
+
return request(ctx, { path: "/models/user", headerSource: input });
|
|
169
|
+
}
|
|
170
|
+
function listZdrEndpoints(input, ctx) {
|
|
171
|
+
return request(ctx, { path: "/endpoints/zdr", headerSource: input });
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// ../plugins/src/openrouter/schema.ts
|
|
175
|
+
import { z as z2 } from "zod/v4";
|
|
176
|
+
|
|
177
|
+
// ../plugins/src/openrouter/schema.handwritten.ts
|
|
178
|
+
import { z } from "zod/v4";
|
|
179
|
+
var createCoinbaseChargeInput = z.strictObject({
|
|
180
|
+
amount: z.number().gt(0).describe("The USD amount to top up."),
|
|
181
|
+
sender: z.string().min(1).describe("The wallet address that initiated the payment."),
|
|
182
|
+
chain_id: z.union([
|
|
183
|
+
z.literal(1).describe("Ethereum mainnet."),
|
|
184
|
+
z.literal(137).describe("Polygon."),
|
|
185
|
+
z.literal(8453).describe("Base.")
|
|
186
|
+
]).describe("The chain ID used to initiate the payment."),
|
|
187
|
+
httpReferer: z.string().describe(
|
|
188
|
+
"The application URL sent in the HTTP-Referer header for OpenRouter attribution and analytics."
|
|
189
|
+
).optional(),
|
|
190
|
+
xTitle: z.string().describe(
|
|
191
|
+
"The application display name sent in the X-Title header for OpenRouter console display."
|
|
192
|
+
).optional()
|
|
193
|
+
}).describe("Input parameters when creating a Coinbase deposit order.");
|
|
194
|
+
var createCoinbaseChargeOutput = z.strictObject({
|
|
195
|
+
data: z.looseObject({}).describe("A JSON object returned by OpenRouter.").optional()
|
|
196
|
+
}).describe("Returns the standard response for Coinbase charge results.");
|
|
197
|
+
|
|
198
|
+
// ../plugins/src/openrouter/schema.ts
|
|
199
|
+
var createChatCompletionInput = z2.looseObject({
|
|
200
|
+
model: z2.string().min(1).describe("The model ID to use."),
|
|
201
|
+
messages: z2.array(z2.looseObject({}).describe("A JSON object returned by OpenRouter.")).min(1).describe("An ordered list of conversation messages."),
|
|
202
|
+
n: z2.int().min(1).describe("The number of choices to generate.").optional(),
|
|
203
|
+
stop: z2.union([z2.string().min(1).describe("A single stop sequence."), z2.array(z2.string().min(1).describe("A stop sequence.")).min(1).describe("Multiple stop sequences.")]).describe("Stop sequences for generation.").optional(),
|
|
204
|
+
user: z2.string().describe("The end user's unique identifier.").optional(),
|
|
205
|
+
top_p: z2.number().min(0).max(1).describe("Nucleus sampling parameter.").optional(),
|
|
206
|
+
stream: z2.boolean().describe("Whether to request a streaming response. Connector actions only support false or omitted.").optional(),
|
|
207
|
+
functions: z2.array(z2.looseObject({}).describe("A JSON object returned by OpenRouter.")).describe("A list of JSON objects returned by OpenRouter.").optional(),
|
|
208
|
+
function_call: z2.union([z2.enum(["none", "auto"]), z2.looseObject({}).describe("A JSON object returned by OpenRouter.")]).describe("Legacy function calling strategy converted to tool_choice at execution time.").optional(),
|
|
209
|
+
logit_bias: z2.record(z2.string(), z2.number().describe("The bias value for this token.")).describe("Token bias map.").optional(),
|
|
210
|
+
max_tokens: z2.int().min(1).describe("The maximum number of output tokens.").optional(),
|
|
211
|
+
max_completion_tokens: z2.int().min(1).describe("New max output token field, taking precedence over max_tokens.").optional(),
|
|
212
|
+
temperature: z2.number().min(0).max(2).describe("Sampling temperature.").optional(),
|
|
213
|
+
presence_penalty: z2.number().min(-2).max(2).describe("Presence penalty.").optional(),
|
|
214
|
+
frequency_penalty: z2.number().min(-2).max(2).describe("Frequency penalty.").optional(),
|
|
215
|
+
logprobs: z2.boolean().describe("Whether to return token-level probabilities.").optional(),
|
|
216
|
+
top_logprobs: z2.int().min(0).max(20).describe("The number of top logprobs to return.").optional(),
|
|
217
|
+
tools: z2.array(z2.looseObject({}).describe("A JSON object returned by OpenRouter.")).describe("A list of JSON objects returned by OpenRouter.").optional(),
|
|
218
|
+
tool_choice: z2.union([z2.enum(["none", "auto", "required"]), z2.looseObject({}).describe("A JSON object returned by OpenRouter.")]).describe("Tool selection strategy.").optional(),
|
|
219
|
+
response_format: z2.looseObject({}).describe("A JSON object returned by OpenRouter.").optional(),
|
|
220
|
+
modalities: z2.array(z2.string().min(1)).describe("List of output modalities to request.").optional(),
|
|
221
|
+
models: z2.array(z2.string().min(1)).describe("Candidate fallback model IDs.").optional(),
|
|
222
|
+
metadata: z2.looseObject({}).describe("A JSON object returned by OpenRouter.").optional(),
|
|
223
|
+
provider: z2.looseObject({}).describe("A JSON object returned by OpenRouter.").optional(),
|
|
224
|
+
plugins: z2.array(z2.looseObject({}).describe("A JSON object returned by OpenRouter.")).describe("A list of JSON objects returned by OpenRouter.").optional(),
|
|
225
|
+
service_tier: z2.string().describe("Requested service tier.").optional(),
|
|
226
|
+
session_id: z2.string().describe("Session ID used to associate requests.").optional(),
|
|
227
|
+
parallel_tool_calls: z2.boolean().describe("Whether to allow parallel tool calls.").optional(),
|
|
228
|
+
stream_options: z2.looseObject({}).describe("A JSON object returned by OpenRouter.").optional(),
|
|
229
|
+
reasoning: z2.looseObject({}).describe("A JSON object returned by OpenRouter.").optional(),
|
|
230
|
+
httpReferer: z2.string().describe("The application URL sent in the HTTP-Referer header for OpenRouter attribution and analytics.").optional(),
|
|
231
|
+
xTitle: z2.string().describe("The application display name sent in the X-Title header for OpenRouter console display.").optional()
|
|
232
|
+
}).describe("Input parameters when creating an OpenRouter chat completion.");
|
|
233
|
+
var createChatCompletionOutput = z2.looseObject({}).describe("A JSON object returned by OpenRouter.");
|
|
234
|
+
var createMessageInput = z2.looseObject({
|
|
235
|
+
model: z2.string().min(1).describe("The model ID to use."),
|
|
236
|
+
max_tokens: z2.int().min(1).describe("The maximum number of output tokens."),
|
|
237
|
+
messages: z2.array(z2.looseObject({}).describe("A JSON object returned by OpenRouter.")).min(1).describe("An ordered list of Anthropic-format messages."),
|
|
238
|
+
user: z2.string().describe("The end user's unique identifier.").optional(),
|
|
239
|
+
tools: z2.array(z2.looseObject({}).describe("A JSON object returned by OpenRouter.")).describe("A list of JSON objects returned by OpenRouter.").optional(),
|
|
240
|
+
top_k: z2.int().min(0).describe("Top-k sampling parameter.").optional(),
|
|
241
|
+
top_p: z2.number().min(0).max(1).describe("Nucleus sampling parameter.").optional(),
|
|
242
|
+
models: z2.array(z2.string().min(1)).describe("Candidate fallback model IDs.").optional(),
|
|
243
|
+
stream: z2.boolean().describe("Whether to request a streaming response. Connector actions only support false or omitted.").optional(),
|
|
244
|
+
system: z2.union([z2.string().describe("System prompt text."), z2.array(z2.looseObject({}).describe("A JSON object returned by OpenRouter.")).min(1).describe("Structured system prompt content blocks.")]).describe("System prompt content.").optional(),
|
|
245
|
+
plugins: z2.array(z2.looseObject({}).describe("A JSON object returned by OpenRouter.")).describe("A list of JSON objects returned by OpenRouter.").optional(),
|
|
246
|
+
metadata: z2.looseObject({}).describe("A JSON object returned by OpenRouter.").optional(),
|
|
247
|
+
output_config: z2.looseObject({}).describe("A JSON object returned by OpenRouter.").optional(),
|
|
248
|
+
provider: z2.looseObject({}).describe("A JSON object returned by OpenRouter.").optional(),
|
|
249
|
+
service_tier: z2.string().describe("Requested service tier.").optional(),
|
|
250
|
+
session_id: z2.string().describe("Session ID used to associate requests.").optional(),
|
|
251
|
+
stop_sequences: z2.array(z2.string().min(1)).describe("Stop sequences for generation.").optional(),
|
|
252
|
+
temperature: z2.number().min(0).max(2).describe("Sampling temperature.").optional(),
|
|
253
|
+
thinking: z2.looseObject({}).describe("A JSON object returned by OpenRouter.").optional(),
|
|
254
|
+
tool_choice: z2.union([z2.enum(["auto", "any", "none"]), z2.looseObject({}).describe("A JSON object returned by OpenRouter.")]).describe("Tool selection strategy.").optional(),
|
|
255
|
+
httpReferer: z2.string().describe("The application URL sent in the HTTP-Referer header for OpenRouter attribution and analytics.").optional(),
|
|
256
|
+
xTitle: z2.string().describe("The application display name sent in the X-Title header for OpenRouter console display.").optional()
|
|
257
|
+
}).describe("Input parameters when creating an OpenRouter Anthropic Messages request.");
|
|
258
|
+
var createMessageOutput = z2.looseObject({}).describe("A JSON object returned by OpenRouter.");
|
|
259
|
+
var getCreditsInput = z2.strictObject({}).describe("This action requires no additional input parameters.");
|
|
260
|
+
var getCreditsOutput = z2.strictObject({
|
|
261
|
+
data: z2.looseObject({
|
|
262
|
+
total_credits: z2.number().describe("Cumulative purchased credits.").optional(),
|
|
263
|
+
total_usage: z2.number().describe("Cumulative credits used.").optional()
|
|
264
|
+
}).describe("Credit overview information.").optional()
|
|
265
|
+
}).describe("Returns the standard response for an OpenRouter credit overview.");
|
|
266
|
+
var getCurrentKeyInput = z2.strictObject({
|
|
267
|
+
httpReferer: z2.string().describe("The application URL sent in the HTTP-Referer header for OpenRouter attribution and analytics.").optional(),
|
|
268
|
+
xTitle: z2.string().describe("The application display name sent in the X-Title header for OpenRouter console display.").optional()
|
|
269
|
+
}).describe("Input parameters when querying the current API key information.");
|
|
270
|
+
var getCurrentKeyOutput = z2.strictObject({
|
|
271
|
+
data: z2.looseObject({}).describe("A JSON object returned by OpenRouter.").optional()
|
|
272
|
+
}).describe("Returns metadata for the current OpenRouter API key.");
|
|
273
|
+
var getGenerationInput = z2.strictObject({
|
|
274
|
+
id: z2.string().min(1).describe("The generation ID to query.")
|
|
275
|
+
}).describe("Input parameters when querying generation metadata.");
|
|
276
|
+
var getGenerationOutput = z2.strictObject({
|
|
277
|
+
data: z2.looseObject({}).describe("A JSON object returned by OpenRouter.").optional()
|
|
278
|
+
}).describe("Returns the standard response with generation metadata.");
|
|
279
|
+
var getModelsCountInput = z2.strictObject({
|
|
280
|
+
outputModalities: z2.string().min(1).describe("Filter statistics by output modality, such as text, image, audio, embeddings, or all.").optional(),
|
|
281
|
+
httpReferer: z2.string().describe("The application URL sent in the HTTP-Referer header for OpenRouter attribution and analytics.").optional(),
|
|
282
|
+
xTitle: z2.string().describe("The application display name sent in the X-Title header for OpenRouter console display.").optional()
|
|
283
|
+
}).describe("Input parameters when getting the number of models.");
|
|
284
|
+
var getModelsCountOutput = z2.strictObject({
|
|
285
|
+
data: z2.strictObject({
|
|
286
|
+
count: z2.int().describe("The current number of eligible models.").optional()
|
|
287
|
+
}).describe("Model count result.").optional()
|
|
288
|
+
}).describe("Returns the standard response for the number of models.");
|
|
289
|
+
var listAvailableModelsInput = z2.strictObject({
|
|
290
|
+
category: z2.string().min(1).describe("Filter the model list by use case classification.").optional(),
|
|
291
|
+
supportedParameters: z2.string().min(1).describe("Filter the model list by supported parameter names. Multiple parameters can be separated by commas.").optional(),
|
|
292
|
+
outputModalities: z2.string().min(1).describe("Filter the list of models by output modality, such as text, image, audio, embeddings, or all.").optional(),
|
|
293
|
+
useRss: z2.boolean().describe("Whether to return RSS XML instead of JSON.").optional(),
|
|
294
|
+
useRssChatLinks: z2.boolean().describe("Whether to use the chat page link instead of the model details page link when returning RSS.").optional()
|
|
295
|
+
}).describe("Input parameters when listing available models for OpenRouter.");
|
|
296
|
+
var listAvailableModelsOutput = z2.union([z2.strictObject({
|
|
297
|
+
data: z2.array(z2.looseObject({}).describe("A JSON object returned by OpenRouter.")).describe("A list of JSON objects returned by OpenRouter.").optional()
|
|
298
|
+
}).describe("Standard OpenRouter response that returns a list of models."), z2.strictObject({
|
|
299
|
+
rss: z2.string().describe("RSS XML string returned when useRss=true.").optional()
|
|
300
|
+
}).describe("RSS output format.")]).describe("Response when listing available OpenRouter models.");
|
|
301
|
+
var listEmbeddingModelsInput = z2.strictObject({
|
|
302
|
+
httpReferer: z2.string().describe("The application URL sent in the HTTP-Referer header for OpenRouter attribution and analytics.").optional(),
|
|
303
|
+
xTitle: z2.string().describe("The application display name sent in the X-Title header for OpenRouter console display.").optional()
|
|
304
|
+
}).describe("Input parameters when listing embedding models.");
|
|
305
|
+
var listEmbeddingModelsOutput = z2.strictObject({
|
|
306
|
+
data: z2.array(z2.looseObject({}).describe("A JSON object returned by OpenRouter.")).describe("A list of JSON objects returned by OpenRouter.").optional()
|
|
307
|
+
}).describe("Standard OpenRouter response that returns a list of models.");
|
|
308
|
+
var listModelEndpointsInput = z2.strictObject({
|
|
309
|
+
author: z2.string().min(1).describe("Model author or organization name."),
|
|
310
|
+
slug: z2.string().min(1).describe("Model slug.")
|
|
311
|
+
}).describe("Input parameters when listing endpoints for a specific model.");
|
|
312
|
+
var listModelEndpointsOutput = z2.strictObject({
|
|
313
|
+
data: z2.looseObject({}).describe("A JSON object returned by OpenRouter.").optional()
|
|
314
|
+
}).describe("Returns the standard response for the specified model endpoints.");
|
|
315
|
+
var listProvidersInput = z2.strictObject({}).describe("This action requires no additional input parameters.");
|
|
316
|
+
var listProvidersOutput = z2.strictObject({
|
|
317
|
+
data: z2.array(z2.looseObject({}).describe("A JSON object returned by OpenRouter.")).describe("A list of JSON objects returned by OpenRouter.").optional()
|
|
318
|
+
}).describe("Returns a standard response with a list of providers.");
|
|
319
|
+
var listUserModelsInput = z2.strictObject({
|
|
320
|
+
httpReferer: z2.string().describe("The application URL sent in the HTTP-Referer header for OpenRouter attribution and analytics.").optional(),
|
|
321
|
+
xTitle: z2.string().describe("The application display name sent in the X-Title header for OpenRouter console display.").optional()
|
|
322
|
+
}).describe("Input parameters when listing models visible to the current user.");
|
|
323
|
+
var listUserModelsOutput = z2.strictObject({
|
|
324
|
+
data: z2.array(z2.looseObject({}).describe("A JSON object returned by OpenRouter.")).describe("A list of JSON objects returned by OpenRouter.").optional()
|
|
325
|
+
}).describe("Standard OpenRouter response that returns a list of models.");
|
|
326
|
+
var listZdrEndpointsInput = z2.strictObject({
|
|
327
|
+
httpReferer: z2.string().describe("The application URL sent in the HTTP-Referer header for OpenRouter attribution and analytics.").optional(),
|
|
328
|
+
xTitle: z2.string().describe("The application display name sent in the X-Title header for OpenRouter console display.").optional()
|
|
329
|
+
}).describe("Input parameters when listing ZDR endpoints.");
|
|
330
|
+
var listZdrEndpointsOutput = z2.strictObject({
|
|
331
|
+
data: z2.array(z2.looseObject({}).describe("A JSON object returned by OpenRouter.")).describe("A list of JSON objects returned by OpenRouter.").optional()
|
|
332
|
+
}).describe("Returns the standard response for ZDR endpoints.");
|
|
333
|
+
var openrouterActions = {
|
|
334
|
+
create_chat_completion: {
|
|
335
|
+
description: "Create an OpenRouter chat completion through the OpenAI-compatible `/chat/completions` endpoint.",
|
|
336
|
+
effect: "write",
|
|
337
|
+
inputSchema: createChatCompletionInput,
|
|
338
|
+
outputSchema: z2.toJSONSchema(createChatCompletionOutput, { io: "output", unrepresentable: "any" })
|
|
339
|
+
},
|
|
340
|
+
create_coinbase_charge: {
|
|
341
|
+
description: "Call OpenRouter's deprecated Coinbase charge endpoint for credits purchases. The upstream endpoint is currently deprecated and may return 410 Gone.",
|
|
342
|
+
effect: "write",
|
|
343
|
+
inputSchema: createCoinbaseChargeInput,
|
|
344
|
+
outputSchema: z2.toJSONSchema(createCoinbaseChargeOutput, { io: "output", unrepresentable: "any" })
|
|
345
|
+
},
|
|
346
|
+
create_message: {
|
|
347
|
+
description: "Create an OpenRouter Anthropic-format message through the `/messages` endpoint.",
|
|
348
|
+
effect: "write",
|
|
349
|
+
inputSchema: createMessageInput,
|
|
350
|
+
outputSchema: z2.toJSONSchema(createMessageOutput, { io: "output", unrepresentable: "any" })
|
|
351
|
+
},
|
|
352
|
+
get_credits: {
|
|
353
|
+
description: "Get the authenticated OpenRouter credit balance summary.",
|
|
354
|
+
effect: "read",
|
|
355
|
+
inputSchema: getCreditsInput,
|
|
356
|
+
outputSchema: z2.toJSONSchema(getCreditsOutput, { io: "output", unrepresentable: "any" })
|
|
357
|
+
},
|
|
358
|
+
get_current_key: {
|
|
359
|
+
description: "Get metadata for the currently authenticated OpenRouter API key.",
|
|
360
|
+
effect: "read",
|
|
361
|
+
inputSchema: getCurrentKeyInput,
|
|
362
|
+
outputSchema: z2.toJSONSchema(getCurrentKeyOutput, { io: "output", unrepresentable: "any" })
|
|
363
|
+
},
|
|
364
|
+
get_generation: {
|
|
365
|
+
description: "Get request and usage metadata for a specific OpenRouter generation.",
|
|
366
|
+
effect: "read",
|
|
367
|
+
inputSchema: getGenerationInput,
|
|
368
|
+
outputSchema: z2.toJSONSchema(getGenerationOutput, { io: "output", unrepresentable: "any" })
|
|
369
|
+
},
|
|
370
|
+
get_models_count: {
|
|
371
|
+
description: "Get the total number of OpenRouter models, optionally filtered by output modalities.",
|
|
372
|
+
effect: "read",
|
|
373
|
+
inputSchema: getModelsCountInput,
|
|
374
|
+
outputSchema: z2.toJSONSchema(getModelsCountOutput, { io: "output", unrepresentable: "any" })
|
|
375
|
+
},
|
|
376
|
+
list_available_models: {
|
|
377
|
+
description: "List the available OpenRouter models, or return the RSS feed when requested.",
|
|
378
|
+
effect: "read",
|
|
379
|
+
inputSchema: listAvailableModelsInput,
|
|
380
|
+
outputSchema: z2.toJSONSchema(listAvailableModelsOutput, { io: "output", unrepresentable: "any" })
|
|
381
|
+
},
|
|
382
|
+
list_embedding_models: {
|
|
383
|
+
description: "List the embedding models available through OpenRouter.",
|
|
384
|
+
effect: "read",
|
|
385
|
+
inputSchema: listEmbeddingModelsInput,
|
|
386
|
+
outputSchema: z2.toJSONSchema(listEmbeddingModelsOutput, { io: "output", unrepresentable: "any" })
|
|
387
|
+
},
|
|
388
|
+
list_model_endpoints: {
|
|
389
|
+
description: "List the currently available endpoints for a specific OpenRouter model.",
|
|
390
|
+
effect: "read",
|
|
391
|
+
inputSchema: listModelEndpointsInput,
|
|
392
|
+
outputSchema: z2.toJSONSchema(listModelEndpointsOutput, { io: "output", unrepresentable: "any" })
|
|
393
|
+
},
|
|
394
|
+
list_providers: {
|
|
395
|
+
description: "List the model providers currently available through OpenRouter.",
|
|
396
|
+
effect: "read",
|
|
397
|
+
inputSchema: listProvidersInput,
|
|
398
|
+
outputSchema: z2.toJSONSchema(listProvidersOutput, { io: "output", unrepresentable: "any" })
|
|
399
|
+
},
|
|
400
|
+
list_user_models: {
|
|
401
|
+
description: "List models filtered by the current user's OpenRouter routing preferences, privacy settings, and guardrails.",
|
|
402
|
+
effect: "read",
|
|
403
|
+
inputSchema: listUserModelsInput,
|
|
404
|
+
outputSchema: z2.toJSONSchema(listUserModelsOutput, { io: "output", unrepresentable: "any" })
|
|
405
|
+
},
|
|
406
|
+
list_zdr_endpoints: {
|
|
407
|
+
description: "Preview the OpenRouter endpoints that remain available under Zero Data Retention.",
|
|
408
|
+
effect: "read",
|
|
409
|
+
inputSchema: listZdrEndpointsInput,
|
|
410
|
+
outputSchema: z2.toJSONSchema(listZdrEndpointsOutput, { io: "output", unrepresentable: "any" })
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
// ../plugins/src/openrouter/index.ts
|
|
415
|
+
function createOpenrouterPlugin() {
|
|
416
|
+
return createProviderPlugin({
|
|
417
|
+
description: "OpenRouter",
|
|
418
|
+
actions: openrouterActions,
|
|
419
|
+
credentialProbe: "get_current_key",
|
|
420
|
+
handlers: {
|
|
421
|
+
create_chat_completion: createChatCompletion,
|
|
422
|
+
create_coinbase_charge: createCoinbaseCharge,
|
|
423
|
+
create_message: createMessage,
|
|
424
|
+
get_credits: getCredits,
|
|
425
|
+
get_current_key: getCurrentKey,
|
|
426
|
+
get_generation: getGeneration,
|
|
427
|
+
get_models_count: getModelsCount,
|
|
428
|
+
list_available_models: listAvailableModels,
|
|
429
|
+
list_embedding_models: listEmbeddingModels,
|
|
430
|
+
list_model_endpoints: listModelEndpoints,
|
|
431
|
+
list_providers: listProviders,
|
|
432
|
+
list_user_models: listUserModels,
|
|
433
|
+
list_zdr_endpoints: listZdrEndpoints
|
|
434
|
+
}
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
var openrouter_default = createOpenrouterPlugin();
|
|
438
|
+
export {
|
|
439
|
+
createOpenrouterPlugin,
|
|
440
|
+
openrouter_default as default
|
|
441
|
+
};
|