@openrouter/sdk 0.12.79 → 0.13.7
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/README.md +40 -0
- package/esm/funcs/betaAnalyticsGetAnalyticsMeta.d.ts +18 -0
- package/esm/funcs/betaAnalyticsGetAnalyticsMeta.js +96 -0
- package/esm/funcs/betaAnalyticsQueryAnalytics.d.ts +18 -0
- package/esm/funcs/betaAnalyticsQueryAnalytics.js +97 -0
- package/esm/funcs/betaResponsesSend.js +1 -1
- package/esm/funcs/chatSend.js +1 -1
- package/esm/funcs/datasetsGetAppRankings.d.ts +43 -0
- package/esm/funcs/datasetsGetAppRankings.js +161 -0
- package/esm/funcs/datasetsGetBenchmarksArtificialAnalysis.d.ts +19 -0
- package/esm/funcs/datasetsGetBenchmarksArtificialAnalysis.js +102 -0
- package/esm/funcs/datasetsGetBenchmarksDesignArena.d.ts +19 -0
- package/esm/funcs/datasetsGetBenchmarksDesignArena.js +104 -0
- package/esm/funcs/filesDelete.d.ts +19 -0
- package/esm/funcs/filesDelete.js +107 -0
- package/esm/funcs/filesDownload.d.ts +18 -0
- package/esm/funcs/filesDownload.js +107 -0
- package/esm/funcs/filesList.d.ts +21 -0
- package/esm/funcs/filesList.js +131 -0
- package/esm/funcs/filesRetrieve.d.ts +19 -0
- package/esm/funcs/filesRetrieve.js +107 -0
- package/esm/funcs/filesUpload.d.ts +19 -0
- package/esm/funcs/filesUpload.js +121 -0
- package/esm/funcs/modelsGet.d.ts +19 -0
- package/esm/funcs/modelsGet.js +107 -0
- package/esm/funcs/modelsList.js +12 -0
- package/esm/funcs/oAuthCreateAuthCode.d.ts +1 -1
- package/esm/funcs/oAuthCreateAuthCode.js +1 -1
- package/esm/funcs/presetsGet.d.ts +21 -0
- package/esm/funcs/presetsGet.js +105 -0
- package/esm/funcs/presetsGetVersion.d.ts +21 -0
- package/esm/funcs/presetsGetVersion.js +109 -0
- package/esm/funcs/presetsList.d.ts +23 -0
- package/esm/funcs/presetsList.js +136 -0
- package/esm/funcs/presetsListVersions.d.ts +23 -0
- package/esm/funcs/presetsListVersions.js +142 -0
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/aabenchmarkentry.d.ts +24 -0
- package/esm/models/aabenchmarkentry.js +23 -0
- package/esm/models/advisornestedtool.d.ts +25 -0
- package/esm/models/advisornestedtool.js +23 -0
- package/esm/models/advisorreasoning.d.ts +41 -0
- package/esm/models/advisorreasoning.js +33 -0
- package/esm/models/advisorservertoolconfig.d.ts +65 -0
- package/esm/models/advisorservertoolconfig.js +31 -0
- package/esm/models/advisorservertoolopenrouter.d.ts +28 -0
- package/esm/models/advisorservertoolopenrouter.js +20 -0
- package/esm/models/apprankingsitem.d.ts +29 -0
- package/esm/models/apprankingsitem.js +26 -0
- package/esm/models/apprankingsresponse.d.ts +16 -0
- package/esm/models/apprankingsresponse.js +17 -0
- package/esm/models/bashservertool.d.ts +28 -0
- package/esm/models/bashservertool.js +20 -0
- package/esm/models/bashservertoolconfig.d.ts +30 -0
- package/esm/models/bashservertoolconfig.js +22 -0
- package/esm/models/bashservertoolengine.d.ts +17 -0
- package/esm/models/bashservertoolengine.js +16 -0
- package/esm/models/bashservertoolenvironment.d.ts +13 -0
- package/esm/models/bashservertoolenvironment.js +16 -0
- package/esm/models/benchmarkpricing.d.ts +20 -0
- package/esm/models/benchmarkpricing.js +15 -0
- package/esm/models/benchmarksaaitem.d.ts +34 -0
- package/esm/models/benchmarksaaitem.js +29 -0
- package/esm/models/benchmarksaameta.d.ts +70 -0
- package/esm/models/benchmarksaameta.js +50 -0
- package/esm/models/benchmarksaaresponse.d.ts +13 -0
- package/esm/models/benchmarksaaresponse.js +17 -0
- package/esm/models/benchmarksdaitem.d.ts +59 -0
- package/esm/models/benchmarksdaitem.js +50 -0
- package/esm/models/benchmarksdameta.d.ts +98 -0
- package/esm/models/benchmarksdameta.js +62 -0
- package/esm/models/benchmarksdaresponse.d.ts +13 -0
- package/esm/models/benchmarksdaresponse.js +17 -0
- package/esm/models/byokproviderslug.d.ts +2 -1
- package/esm/models/byokproviderslug.js +2 -1
- package/esm/models/chatfunctiontool.d.ts +5 -2
- package/esm/models/chatfunctiontool.js +6 -0
- package/esm/models/chatrequest.d.ts +42 -0
- package/esm/models/chatrequest.js +24 -0
- package/esm/models/chatwebsearchshorthand.d.ts +10 -5
- package/esm/models/chatwebsearchshorthand.js +2 -0
- package/esm/models/containerautoenvironment.d.ts +15 -0
- package/esm/models/containerautoenvironment.js +13 -0
- package/esm/models/containerreferenceenvironment.d.ts +20 -0
- package/esm/models/containerreferenceenvironment.js +19 -0
- package/esm/models/contentfilterbuiltinentry.d.ts +5 -0
- package/esm/models/contentfilterbuiltinentry.js +7 -0
- package/esm/models/contentfilterbuiltinentryinput.d.ts +6 -0
- package/esm/models/contentfilterbuiltinentryinput.js +7 -0
- package/esm/models/contentpartaudio.d.ts +24 -0
- package/esm/models/contentpartaudio.js +27 -0
- package/esm/models/contentpartimage.d.ts +2 -9
- package/esm/models/contentpartimage.js +1 -6
- package/esm/models/contentpartvideo.d.ts +24 -0
- package/esm/models/contentpartvideo.js +27 -0
- package/esm/models/createobservabilitydestinationrequest.d.ts +1 -1
- package/esm/models/dabenchmarkentry.d.ts +32 -0
- package/esm/models/dabenchmarkentry.js +23 -0
- package/esm/models/filedeleteresponse.d.ts +21 -0
- package/esm/models/filedeleteresponse.js +20 -0
- package/esm/models/filelistresponse.d.ts +21 -0
- package/esm/models/filelistresponse.js +26 -0
- package/esm/models/filemetadata.d.ts +26 -0
- package/esm/models/filemetadata.js +33 -0
- package/esm/models/fusionanalysisresult.d.ts +88 -0
- package/esm/models/fusionanalysisresult.js +109 -0
- package/esm/models/fusioncallanalysiscompletedevent.d.ts +21 -0
- package/esm/models/fusioncallanalysiscompletedevent.js +26 -0
- package/esm/models/fusioncallanalysisinprogressevent.d.ts +17 -0
- package/esm/models/fusioncallanalysisinprogressevent.js +26 -0
- package/esm/models/fusioncallcompletedevent.d.ts +16 -0
- package/esm/models/fusioncallcompletedevent.js +24 -0
- package/esm/models/fusioncallinprogressevent.d.ts +16 -0
- package/esm/models/fusioncallinprogressevent.js +24 -0
- package/esm/models/fusioncallpaneladdedevent.d.ts +17 -0
- package/esm/models/fusioncallpaneladdedevent.js +25 -0
- package/esm/models/fusioncallpanelcompletedevent.d.ts +18 -0
- package/esm/models/fusioncallpanelcompletedevent.js +26 -0
- package/esm/models/fusioncallpaneldeltaevent.d.ts +18 -0
- package/esm/models/fusioncallpaneldeltaevent.js +26 -0
- package/esm/models/fusioncallpanelfailedevent.d.ts +19 -0
- package/esm/models/fusioncallpanelfailedevent.js +28 -0
- package/esm/models/fusioncallpanelreasoningdeltaevent.d.ts +18 -0
- package/esm/models/fusioncallpanelreasoningdeltaevent.js +26 -0
- package/esm/models/fusionplugin.d.ts +46 -0
- package/esm/models/fusionplugin.js +20 -0
- package/esm/models/fusionservertoolconfig.d.ts +27 -0
- package/esm/models/fusionservertoolconfig.js +10 -0
- package/esm/models/generationresponse.d.ts +22 -0
- package/esm/models/generationresponse.js +14 -0
- package/esm/models/getpresetresponse.d.ts +17 -0
- package/esm/models/getpresetresponse.js +15 -0
- package/esm/models/getpresetversionresponse.d.ts +17 -0
- package/esm/models/getpresetversionresponse.js +15 -0
- package/esm/models/index.d.ts +60 -0
- package/esm/models/index.js +60 -0
- package/esm/models/inputreference.d.ts +14 -0
- package/esm/models/inputreference.js +18 -0
- package/esm/models/inputsunion.d.ts +7 -4
- package/esm/models/inputsunion.js +11 -2
- package/esm/models/legacywebsearchservertool.d.ts +2 -2
- package/esm/models/listpresetsresponse.d.ts +15 -0
- package/esm/models/listpresetsresponse.js +21 -0
- package/esm/models/listpresetversionsresponse.d.ts +15 -0
- package/esm/models/listpresetversionsresponse.js +21 -0
- package/esm/models/messagesfallbackparam.d.ts +19 -0
- package/esm/models/messagesfallbackparam.js +22 -0
- package/esm/models/messagesrequest.d.ts +11 -4
- package/esm/models/messagesrequest.js +6 -0
- package/esm/models/model.d.ts +5 -0
- package/esm/models/model.js +2 -0
- package/esm/models/modelbenchmarks.d.ts +22 -0
- package/esm/models/modelbenchmarks.js +23 -0
- package/esm/models/modelresponse.d.ts +17 -0
- package/esm/models/modelresponse.js +16 -0
- package/esm/models/observabilityarizedestination.d.ts +1 -1
- package/esm/models/observabilitybraintrustdestination.d.ts +1 -1
- package/esm/models/observabilityclickhousedestination.d.ts +1 -1
- package/esm/models/observabilitydatadogdestination.d.ts +1 -1
- package/esm/models/observabilitygrafanadestination.d.ts +1 -1
- package/esm/models/observabilitylangfusedestination.d.ts +1 -1
- package/esm/models/observabilitylangsmithdestination.d.ts +1 -1
- package/esm/models/observabilitynewrelicdestination.d.ts +1 -1
- package/esm/models/observabilityopikdestination.d.ts +1 -1
- package/esm/models/observabilityotelcollectordestination.d.ts +1 -1
- package/esm/models/observabilityposthogdestination.d.ts +1 -1
- package/esm/models/observabilityrampdestination.d.ts +1 -1
- package/esm/models/observabilitys3destination.d.ts +1 -1
- package/esm/models/observabilitysentrydestination.d.ts +1 -1
- package/esm/models/observabilitysnowflakedestination.d.ts +1 -1
- package/esm/models/observabilityweavedestination.d.ts +1 -1
- package/esm/models/observabilitywebhookdestination.d.ts +1 -1
- package/esm/models/operations/createauthkeyscode.d.ts +6 -1
- package/esm/models/operations/createauthkeyscode.js +2 -0
- package/esm/models/operations/creatererank.d.ts +44 -10
- package/esm/models/operations/creatererank.js +21 -6
- package/esm/models/operations/createresponses.d.ts +3 -3
- package/esm/models/operations/createresponses.js +2 -3
- package/esm/models/operations/deletefile.d.ts +60 -0
- package/esm/models/operations/deletefile.js +24 -0
- package/esm/models/operations/downloadfilecontent.d.ts +60 -0
- package/esm/models/operations/downloadfilecontent.js +24 -0
- package/esm/models/operations/getanalyticsmeta.d.ts +198 -0
- package/esm/models/operations/getanalyticsmeta.js +141 -0
- package/esm/models/operations/getapprankings.d.ts +152 -0
- package/esm/models/operations/getapprankings.js +85 -0
- package/esm/models/operations/getbenchmarksartificialanalysis.d.ts +58 -0
- package/esm/models/operations/getbenchmarksartificialanalysis.js +22 -0
- package/esm/models/operations/getbenchmarksdesignarena.d.ts +83 -0
- package/esm/models/operations/getbenchmarksdesignarena.js +36 -0
- package/esm/models/operations/getfilemetadata.d.ts +60 -0
- package/esm/models/operations/getfilemetadata.js +24 -0
- package/esm/models/operations/getmodel.d.ts +63 -0
- package/esm/models/operations/getmodel.js +22 -0
- package/esm/models/operations/getmodels.d.ts +121 -5
- package/esm/models/operations/getmodels.js +59 -4
- package/esm/models/operations/getpreset.d.ts +58 -0
- package/esm/models/operations/getpreset.js +21 -0
- package/esm/models/operations/getpresetversion.d.ts +63 -0
- package/esm/models/operations/getpresetversion.js +22 -0
- package/esm/models/operations/index.d.ts +15 -0
- package/esm/models/operations/index.js +15 -0
- package/esm/models/operations/listbyokkeys.d.ts +2 -1
- package/esm/models/operations/listbyokkeys.js +2 -1
- package/esm/models/operations/listfiles.d.ts +77 -0
- package/esm/models/operations/listfiles.js +37 -0
- package/esm/models/operations/listpresets.d.ts +72 -0
- package/esm/models/operations/listpresets.js +35 -0
- package/esm/models/operations/listpresetversions.d.ts +77 -0
- package/esm/models/operations/listpresetversions.js +36 -0
- package/esm/models/operations/queryanalytics.d.ts +195 -0
- package/esm/models/operations/queryanalytics.js +129 -0
- package/esm/models/operations/sendchatcompletionrequest.d.ts +3 -3
- package/esm/models/operations/sendchatcompletionrequest.js +2 -3
- package/esm/models/operations/uploadfile.d.ts +82 -0
- package/esm/models/operations/uploadfile.js +45 -0
- package/esm/models/outputadvisorservertoolitem.d.ts +59 -0
- package/esm/models/outputadvisorservertoolitem.js +52 -0
- package/esm/models/outputfusionservertoolitem.d.ts +44 -43
- package/esm/models/outputfusionservertoolitem.js +49 -51
- package/esm/models/outputitems.d.ts +13 -3
- package/esm/models/outputitems.js +9 -1
- package/esm/models/outputshellcallitem.d.ts +29 -0
- package/esm/models/outputshellcallitem.js +38 -0
- package/esm/models/outputshellcalloutputitem.d.ts +48 -0
- package/esm/models/outputshellcalloutputitem.js +67 -0
- package/esm/models/outputsubagentservertoolitem.d.ts +59 -0
- package/esm/models/outputsubagentservertoolitem.js +54 -0
- package/esm/models/outputwebsearchcallitem.d.ts +2 -2
- package/esm/models/outputwebsearchcallitem.js +2 -2
- package/esm/models/preset.d.ts +27 -0
- package/esm/models/preset.js +35 -0
- package/esm/models/presetstatus.d.ts +17 -0
- package/esm/models/presetstatus.js +16 -0
- package/esm/models/presetwithdesignatedversion.d.ts +9 -14
- package/esm/models/presetwithdesignatedversion.js +4 -11
- package/esm/models/preview20250311websearchservertool.d.ts +2 -2
- package/esm/models/previewwebsearchservertool.d.ts +2 -2
- package/esm/models/promptinjectionscanscope.d.ts +18 -0
- package/esm/models/promptinjectionscanscope.js +17 -0
- package/esm/models/providername.d.ts +2 -1
- package/esm/models/providername.js +2 -1
- package/esm/models/provideroptions.d.ts +12 -0
- package/esm/models/provideroptions.js +2 -0
- package/esm/models/providerresponse.d.ts +3 -1
- package/esm/models/providerresponse.js +4 -2
- package/esm/models/rankingsdailymeta.d.ts +4 -4
- package/esm/models/rankingsdailymeta.js +3 -3
- package/esm/models/responsesrequest.d.ts +36 -8
- package/esm/models/responsesrequest.js +12 -0
- package/esm/models/searchqualitylevel.d.ts +2 -2
- package/esm/models/searchqualitylevel.js +1 -1
- package/esm/models/shellcallstatus.d.ts +17 -0
- package/esm/models/shellcallstatus.js +16 -0
- package/esm/models/shellservertoolconfig.d.ts +30 -0
- package/esm/models/shellservertoolconfig.js +22 -0
- package/esm/models/shellservertoolengine.d.ts +16 -0
- package/esm/models/shellservertoolengine.js +15 -0
- package/esm/models/shellservertoolenvironment.d.ts +13 -0
- package/esm/models/shellservertoolenvironment.js +16 -0
- package/esm/models/shellservertoolopenrouter.d.ts +21 -0
- package/esm/models/shellservertoolopenrouter.js +15 -0
- package/esm/models/streamevents.d.ts +10 -1
- package/esm/models/streamevents.js +18 -0
- package/esm/models/subagentnestedtool.d.ts +25 -0
- package/esm/models/subagentnestedtool.js +23 -0
- package/esm/models/subagentreasoning.d.ts +41 -0
- package/esm/models/subagentreasoning.js +33 -0
- package/esm/models/subagentservertoolconfig.d.ts +50 -0
- package/esm/models/subagentservertoolconfig.js +27 -0
- package/esm/models/subagentservertoolopenrouter.d.ts +28 -0
- package/esm/models/subagentservertoolopenrouter.js +20 -0
- package/esm/models/updateobservabilitydestinationrequest.d.ts +1 -1
- package/esm/models/urlcitation.d.ts +2 -0
- package/esm/models/urlcitation.js +2 -0
- package/esm/models/videogenerationrequest.d.ts +16 -4
- package/esm/models/videogenerationrequest.js +4 -2
- package/esm/models/websearchconfig.d.ts +10 -5
- package/esm/models/websearchconfig.js +2 -0
- package/esm/models/websearchengine.d.ts +1 -0
- package/esm/models/websearchengine.js +1 -0
- package/esm/models/websearchengineenum.d.ts +4 -3
- package/esm/models/websearchengineenum.js +3 -2
- package/esm/models/websearchservertool.d.ts +2 -2
- package/esm/models/websearchservertoolconfig.d.ts +10 -5
- package/esm/models/websearchservertoolconfig.js +2 -0
- package/esm/sdk/beta.d.ts +3 -0
- package/esm/sdk/beta.js +4 -0
- package/esm/sdk/betaanalytics.d.ts +19 -0
- package/esm/sdk/betaanalytics.js +29 -0
- package/esm/sdk/datasets.d.ts +46 -0
- package/esm/sdk/datasets.js +53 -0
- package/esm/sdk/files.d.ts +44 -0
- package/esm/sdk/files.js +60 -0
- package/esm/sdk/models.d.ts +7 -0
- package/esm/sdk/models.js +10 -0
- package/esm/sdk/presets.d.ts +33 -0
- package/esm/sdk/presets.js +41 -0
- package/esm/sdk/sdk.d.ts +5 -2
- package/esm/sdk/sdk.js +7 -3
- package/jsr.json +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 8f8ccc701fa7
|
|
4
|
+
*/
|
|
5
|
+
import { dlv } from "../lib/dlv.js";
|
|
6
|
+
import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
|
|
7
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
8
|
+
import * as M from "../lib/matchers.js";
|
|
9
|
+
import { compactMap } from "../lib/primitives.js";
|
|
10
|
+
import { safeParse } from "../lib/schemas.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import * as errors from "../models/errors/index.js";
|
|
14
|
+
import * as operations from "../models/operations/index.js";
|
|
15
|
+
import { APIPromise } from "../types/async.js";
|
|
16
|
+
import { createPageIterator, haltIterator, } from "../types/operations.js";
|
|
17
|
+
/**
|
|
18
|
+
* List presets
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* Lists all presets for the authenticated user, ordered by most recently updated first.
|
|
22
|
+
*
|
|
23
|
+
* If set, this operation will use {@link Security.apiKey} from the global security.
|
|
24
|
+
*/
|
|
25
|
+
export function presetsList(client, request, options) {
|
|
26
|
+
return new APIPromise($do(client, request, options));
|
|
27
|
+
}
|
|
28
|
+
async function $do(client, request, options) {
|
|
29
|
+
const parsed = safeParse(request, (value) => operations.ListPresetsRequest$outboundSchema.optional().parse(value), "Input validation failed");
|
|
30
|
+
if (!parsed.ok) {
|
|
31
|
+
return [haltIterator(parsed), { status: "invalid" }];
|
|
32
|
+
}
|
|
33
|
+
const payload = parsed.value;
|
|
34
|
+
const body = null;
|
|
35
|
+
const path = pathToFunc("/presets")();
|
|
36
|
+
const query = encodeFormQuery({
|
|
37
|
+
"limit": payload?.limit,
|
|
38
|
+
"offset": payload?.offset,
|
|
39
|
+
});
|
|
40
|
+
const headers = new Headers(compactMap({
|
|
41
|
+
Accept: "application/json",
|
|
42
|
+
"HTTP-Referer": encodeSimple("HTTP-Referer", payload?.["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
|
|
43
|
+
"X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload?.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
|
|
44
|
+
"X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload?.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
|
|
45
|
+
}));
|
|
46
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
47
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
48
|
+
const requestSecurity = resolveGlobalSecurity(securityInput, [0]);
|
|
49
|
+
const context = {
|
|
50
|
+
options: client._options,
|
|
51
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
52
|
+
operationID: "listPresets",
|
|
53
|
+
oAuth2Scopes: null,
|
|
54
|
+
resolvedSecurity: requestSecurity,
|
|
55
|
+
securitySource: client._options.apiKey,
|
|
56
|
+
retryConfig: options?.retries
|
|
57
|
+
|| client._options.retryConfig
|
|
58
|
+
|| {
|
|
59
|
+
strategy: "backoff",
|
|
60
|
+
backoff: {
|
|
61
|
+
initialInterval: 500,
|
|
62
|
+
maxInterval: 60000,
|
|
63
|
+
exponent: 1.5,
|
|
64
|
+
maxElapsedTime: 3600000,
|
|
65
|
+
},
|
|
66
|
+
retryConnectionErrors: true,
|
|
67
|
+
}
|
|
68
|
+
|| { strategy: "none" },
|
|
69
|
+
retryCodes: options?.retryCodes || ["5XX"],
|
|
70
|
+
};
|
|
71
|
+
const requestRes = client._createRequest(context, {
|
|
72
|
+
security: requestSecurity,
|
|
73
|
+
method: "GET",
|
|
74
|
+
baseURL: options?.serverURL,
|
|
75
|
+
path: path,
|
|
76
|
+
headers: headers,
|
|
77
|
+
query: query,
|
|
78
|
+
body: body,
|
|
79
|
+
userAgent: client._options.userAgent,
|
|
80
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
81
|
+
}, options);
|
|
82
|
+
if (!requestRes.ok) {
|
|
83
|
+
return [haltIterator(requestRes), { status: "invalid" }];
|
|
84
|
+
}
|
|
85
|
+
const req = requestRes.value;
|
|
86
|
+
const doResult = await client._do(req, {
|
|
87
|
+
context,
|
|
88
|
+
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
89
|
+
retryConfig: context.retryConfig,
|
|
90
|
+
retryCodes: context.retryCodes,
|
|
91
|
+
});
|
|
92
|
+
if (!doResult.ok) {
|
|
93
|
+
return [haltIterator(doResult), { status: "request-error", request: req }];
|
|
94
|
+
}
|
|
95
|
+
const response = doResult.value;
|
|
96
|
+
const responseFields = {
|
|
97
|
+
HttpMeta: { Response: response, Request: req },
|
|
98
|
+
};
|
|
99
|
+
const [result, raw] = await M.match(M.json(200, operations.ListPresetsResponse$inboundSchema, {
|
|
100
|
+
key: "Result",
|
|
101
|
+
}), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
102
|
+
if (!result.ok) {
|
|
103
|
+
return [haltIterator(result), {
|
|
104
|
+
status: "complete",
|
|
105
|
+
request: req,
|
|
106
|
+
response,
|
|
107
|
+
}];
|
|
108
|
+
}
|
|
109
|
+
const nextFunc = (responseData) => {
|
|
110
|
+
const offset = request?.offset ?? 0;
|
|
111
|
+
if (!responseData) {
|
|
112
|
+
return { next: () => null };
|
|
113
|
+
}
|
|
114
|
+
const results = dlv(responseData, "data");
|
|
115
|
+
if (!Array.isArray(results) || !results.length) {
|
|
116
|
+
return { next: () => null };
|
|
117
|
+
}
|
|
118
|
+
const limit = request?.limit ?? 0;
|
|
119
|
+
if (results.length < limit) {
|
|
120
|
+
return { next: () => null };
|
|
121
|
+
}
|
|
122
|
+
const nextOffset = offset + results.length;
|
|
123
|
+
const nextVal = () => presetsList(client, {
|
|
124
|
+
...request,
|
|
125
|
+
offset: nextOffset,
|
|
126
|
+
}, options);
|
|
127
|
+
return { next: nextVal, "~next": { offset: nextOffset } };
|
|
128
|
+
};
|
|
129
|
+
const page = { ...result, ...nextFunc(raw) };
|
|
130
|
+
return [{ ...page, ...createPageIterator(page, (v) => !v.ok) }, {
|
|
131
|
+
status: "complete",
|
|
132
|
+
request: req,
|
|
133
|
+
response,
|
|
134
|
+
}];
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=presetsList.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { OpenRouterCore } from "../core.js";
|
|
2
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
3
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
|
|
4
|
+
import * as errors from "../models/errors/index.js";
|
|
5
|
+
import { OpenRouterError } from "../models/errors/openroutererror.js";
|
|
6
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
7
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
8
|
+
import * as operations from "../models/operations/index.js";
|
|
9
|
+
import { APIPromise } from "../types/async.js";
|
|
10
|
+
import { Result } from "../types/fp.js";
|
|
11
|
+
import { PageIterator } from "../types/operations.js";
|
|
12
|
+
/**
|
|
13
|
+
* List versions of a preset
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* Lists all versions of a preset, ordered by version number ascending (oldest first).
|
|
17
|
+
*
|
|
18
|
+
* If set, this operation will use {@link Security.apiKey} from the global security.
|
|
19
|
+
*/
|
|
20
|
+
export declare function presetsListVersions(client: OpenRouterCore, request: operations.ListPresetVersionsRequest, options?: RequestOptions): APIPromise<PageIterator<Result<operations.ListPresetVersionsResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.NotFoundResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>, {
|
|
21
|
+
offset: number;
|
|
22
|
+
}>>;
|
|
23
|
+
//# sourceMappingURL=presetsListVersions.d.ts.map
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 326969b5ca64
|
|
4
|
+
*/
|
|
5
|
+
import { dlv } from "../lib/dlv.js";
|
|
6
|
+
import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
|
|
7
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
8
|
+
import * as M from "../lib/matchers.js";
|
|
9
|
+
import { compactMap } from "../lib/primitives.js";
|
|
10
|
+
import { safeParse } from "../lib/schemas.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import * as errors from "../models/errors/index.js";
|
|
14
|
+
import * as operations from "../models/operations/index.js";
|
|
15
|
+
import { APIPromise } from "../types/async.js";
|
|
16
|
+
import { createPageIterator, haltIterator, } from "../types/operations.js";
|
|
17
|
+
/**
|
|
18
|
+
* List versions of a preset
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* Lists all versions of a preset, ordered by version number ascending (oldest first).
|
|
22
|
+
*
|
|
23
|
+
* If set, this operation will use {@link Security.apiKey} from the global security.
|
|
24
|
+
*/
|
|
25
|
+
export function presetsListVersions(client, request, options) {
|
|
26
|
+
return new APIPromise($do(client, request, options));
|
|
27
|
+
}
|
|
28
|
+
async function $do(client, request, options) {
|
|
29
|
+
const parsed = safeParse(request, (value) => operations.ListPresetVersionsRequest$outboundSchema.parse(value), "Input validation failed");
|
|
30
|
+
if (!parsed.ok) {
|
|
31
|
+
return [haltIterator(parsed), { status: "invalid" }];
|
|
32
|
+
}
|
|
33
|
+
const payload = parsed.value;
|
|
34
|
+
const body = null;
|
|
35
|
+
const pathParams = {
|
|
36
|
+
slug: encodeSimple("slug", payload.slug, {
|
|
37
|
+
explode: false,
|
|
38
|
+
charEncoding: "percent",
|
|
39
|
+
}),
|
|
40
|
+
};
|
|
41
|
+
const path = pathToFunc("/presets/{slug}/versions")(pathParams);
|
|
42
|
+
const query = encodeFormQuery({
|
|
43
|
+
"limit": payload.limit,
|
|
44
|
+
"offset": payload.offset,
|
|
45
|
+
});
|
|
46
|
+
const headers = new Headers(compactMap({
|
|
47
|
+
Accept: "application/json",
|
|
48
|
+
"HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
|
|
49
|
+
"X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
|
|
50
|
+
"X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
|
|
51
|
+
}));
|
|
52
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
53
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
54
|
+
const requestSecurity = resolveGlobalSecurity(securityInput, [0]);
|
|
55
|
+
const context = {
|
|
56
|
+
options: client._options,
|
|
57
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
58
|
+
operationID: "listPresetVersions",
|
|
59
|
+
oAuth2Scopes: null,
|
|
60
|
+
resolvedSecurity: requestSecurity,
|
|
61
|
+
securitySource: client._options.apiKey,
|
|
62
|
+
retryConfig: options?.retries
|
|
63
|
+
|| client._options.retryConfig
|
|
64
|
+
|| {
|
|
65
|
+
strategy: "backoff",
|
|
66
|
+
backoff: {
|
|
67
|
+
initialInterval: 500,
|
|
68
|
+
maxInterval: 60000,
|
|
69
|
+
exponent: 1.5,
|
|
70
|
+
maxElapsedTime: 3600000,
|
|
71
|
+
},
|
|
72
|
+
retryConnectionErrors: true,
|
|
73
|
+
}
|
|
74
|
+
|| { strategy: "none" },
|
|
75
|
+
retryCodes: options?.retryCodes || ["5XX"],
|
|
76
|
+
};
|
|
77
|
+
const requestRes = client._createRequest(context, {
|
|
78
|
+
security: requestSecurity,
|
|
79
|
+
method: "GET",
|
|
80
|
+
baseURL: options?.serverURL,
|
|
81
|
+
path: path,
|
|
82
|
+
headers: headers,
|
|
83
|
+
query: query,
|
|
84
|
+
body: body,
|
|
85
|
+
userAgent: client._options.userAgent,
|
|
86
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
87
|
+
}, options);
|
|
88
|
+
if (!requestRes.ok) {
|
|
89
|
+
return [haltIterator(requestRes), { status: "invalid" }];
|
|
90
|
+
}
|
|
91
|
+
const req = requestRes.value;
|
|
92
|
+
const doResult = await client._do(req, {
|
|
93
|
+
context,
|
|
94
|
+
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
95
|
+
retryConfig: context.retryConfig,
|
|
96
|
+
retryCodes: context.retryCodes,
|
|
97
|
+
});
|
|
98
|
+
if (!doResult.ok) {
|
|
99
|
+
return [haltIterator(doResult), { status: "request-error", request: req }];
|
|
100
|
+
}
|
|
101
|
+
const response = doResult.value;
|
|
102
|
+
const responseFields = {
|
|
103
|
+
HttpMeta: { Response: response, Request: req },
|
|
104
|
+
};
|
|
105
|
+
const [result, raw] = await M.match(M.json(200, operations.ListPresetVersionsResponse$inboundSchema, {
|
|
106
|
+
key: "Result",
|
|
107
|
+
}), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
108
|
+
if (!result.ok) {
|
|
109
|
+
return [haltIterator(result), {
|
|
110
|
+
status: "complete",
|
|
111
|
+
request: req,
|
|
112
|
+
response,
|
|
113
|
+
}];
|
|
114
|
+
}
|
|
115
|
+
const nextFunc = (responseData) => {
|
|
116
|
+
const offset = request?.offset ?? 0;
|
|
117
|
+
if (!responseData) {
|
|
118
|
+
return { next: () => null };
|
|
119
|
+
}
|
|
120
|
+
const results = dlv(responseData, "data");
|
|
121
|
+
if (!Array.isArray(results) || !results.length) {
|
|
122
|
+
return { next: () => null };
|
|
123
|
+
}
|
|
124
|
+
const limit = request?.limit ?? 0;
|
|
125
|
+
if (results.length < limit) {
|
|
126
|
+
return { next: () => null };
|
|
127
|
+
}
|
|
128
|
+
const nextOffset = offset + results.length;
|
|
129
|
+
const nextVal = () => presetsListVersions(client, {
|
|
130
|
+
...request,
|
|
131
|
+
offset: nextOffset,
|
|
132
|
+
}, options);
|
|
133
|
+
return { next: nextVal, "~next": { offset: nextOffset } };
|
|
134
|
+
};
|
|
135
|
+
const page = { ...result, ...nextFunc(raw) };
|
|
136
|
+
return [{ ...page, ...createPageIterator(page, (v) => !v.ok) }, {
|
|
137
|
+
status: "complete",
|
|
138
|
+
request: req,
|
|
139
|
+
response,
|
|
140
|
+
}];
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=presetsListVersions.js.map
|
package/esm/lib/config.d.ts
CHANGED
|
@@ -49,8 +49,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
49
49
|
export declare const SDK_METADATA: {
|
|
50
50
|
readonly language: "typescript";
|
|
51
51
|
readonly openapiDocVersion: "1.0.0";
|
|
52
|
-
readonly sdkVersion: "0.
|
|
52
|
+
readonly sdkVersion: "0.13.7";
|
|
53
53
|
readonly genVersion: "2.884.4";
|
|
54
|
-
readonly userAgent: "speakeasy-sdk/typescript 0.
|
|
54
|
+
readonly userAgent: "speakeasy-sdk/typescript 0.13.7 2.884.4 1.0.0 @openrouter/sdk";
|
|
55
55
|
};
|
|
56
56
|
//# sourceMappingURL=config.d.ts.map
|
package/esm/lib/config.js
CHANGED
|
@@ -26,8 +26,8 @@ export function serverURLFromOptions(options) {
|
|
|
26
26
|
export const SDK_METADATA = {
|
|
27
27
|
language: "typescript",
|
|
28
28
|
openapiDocVersion: "1.0.0",
|
|
29
|
-
sdkVersion: "0.
|
|
29
|
+
sdkVersion: "0.13.7",
|
|
30
30
|
genVersion: "2.884.4",
|
|
31
|
-
userAgent: "speakeasy-sdk/typescript 0.
|
|
31
|
+
userAgent: "speakeasy-sdk/typescript 0.13.7 2.884.4 1.0.0 @openrouter/sdk",
|
|
32
32
|
};
|
|
33
33
|
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
4
|
+
/**
|
|
5
|
+
* Artificial Analysis benchmark index scores.
|
|
6
|
+
*/
|
|
7
|
+
export type AABenchmarkEntry = {
|
|
8
|
+
/**
|
|
9
|
+
* Artificial Analysis Agentic Index score
|
|
10
|
+
*/
|
|
11
|
+
agenticIndex: number | null;
|
|
12
|
+
/**
|
|
13
|
+
* Artificial Analysis Coding Index score
|
|
14
|
+
*/
|
|
15
|
+
codingIndex: number | null;
|
|
16
|
+
/**
|
|
17
|
+
* Artificial Analysis Intelligence Index score
|
|
18
|
+
*/
|
|
19
|
+
intelligenceIndex: number | null;
|
|
20
|
+
};
|
|
21
|
+
/** @internal */
|
|
22
|
+
export declare const AABenchmarkEntry$inboundSchema: z.ZodType<AABenchmarkEntry, unknown>;
|
|
23
|
+
export declare function aaBenchmarkEntryFromJSON(jsonString: string): SafeParseResult<AABenchmarkEntry, SDKValidationError>;
|
|
24
|
+
//# sourceMappingURL=aabenchmarkentry.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: fff97d475d2d
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../lib/schemas.js";
|
|
8
|
+
/** @internal */
|
|
9
|
+
export const AABenchmarkEntry$inboundSchema = z.object({
|
|
10
|
+
agentic_index: z.nullable(z.number()),
|
|
11
|
+
coding_index: z.nullable(z.number()),
|
|
12
|
+
intelligence_index: z.nullable(z.number()),
|
|
13
|
+
}).transform((v) => {
|
|
14
|
+
return remap$(v, {
|
|
15
|
+
"agentic_index": "agenticIndex",
|
|
16
|
+
"coding_index": "codingIndex",
|
|
17
|
+
"intelligence_index": "intelligenceIndex",
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
export function aaBenchmarkEntryFromJSON(jsonString) {
|
|
21
|
+
return safeParse(jsonString, (x) => AABenchmarkEntry$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AABenchmarkEntry' from JSON`);
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=aabenchmarkentry.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
/**
|
|
3
|
+
* A tool made available to the advisor sub-agent. Only OpenRouter server tools (e.g. openrouter:web_search) are supported; function tools are rejected because the advisor has no way to execute them. The advisor tool may not list itself.
|
|
4
|
+
*/
|
|
5
|
+
export type AdvisorNestedTool = {
|
|
6
|
+
parameters?: {
|
|
7
|
+
[k: string]: any | null;
|
|
8
|
+
} | undefined;
|
|
9
|
+
type: string;
|
|
10
|
+
additionalProperties?: {
|
|
11
|
+
[k: string]: any | null;
|
|
12
|
+
} | undefined;
|
|
13
|
+
};
|
|
14
|
+
/** @internal */
|
|
15
|
+
export type AdvisorNestedTool$Outbound = {
|
|
16
|
+
parameters?: {
|
|
17
|
+
[k: string]: any | null;
|
|
18
|
+
} | undefined;
|
|
19
|
+
type: string;
|
|
20
|
+
[additionalProperties: string]: unknown;
|
|
21
|
+
};
|
|
22
|
+
/** @internal */
|
|
23
|
+
export declare const AdvisorNestedTool$outboundSchema: z.ZodType<AdvisorNestedTool$Outbound, AdvisorNestedTool>;
|
|
24
|
+
export declare function advisorNestedToolToJSON(advisorNestedTool: AdvisorNestedTool): string;
|
|
25
|
+
//# sourceMappingURL=advisornestedtool.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 5dc7e04c01b7
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export const AdvisorNestedTool$outboundSchema = z.object({
|
|
9
|
+
parameters: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
10
|
+
type: z.string(),
|
|
11
|
+
additionalProperties: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
12
|
+
}).transform((v) => {
|
|
13
|
+
return {
|
|
14
|
+
...v.additionalProperties,
|
|
15
|
+
...remap$(v, {
|
|
16
|
+
additionalProperties: null,
|
|
17
|
+
}),
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
export function advisorNestedToolToJSON(advisorNestedTool) {
|
|
21
|
+
return JSON.stringify(AdvisorNestedTool$outboundSchema.parse(advisorNestedTool));
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=advisornestedtool.js.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { OpenEnum } from "../types/enums.js";
|
|
3
|
+
/**
|
|
4
|
+
* Reasoning effort level for the advisor call.
|
|
5
|
+
*/
|
|
6
|
+
export declare const AdvisorReasoningEffort: {
|
|
7
|
+
readonly Xhigh: "xhigh";
|
|
8
|
+
readonly High: "high";
|
|
9
|
+
readonly Medium: "medium";
|
|
10
|
+
readonly Low: "low";
|
|
11
|
+
readonly Minimal: "minimal";
|
|
12
|
+
readonly None: "none";
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Reasoning effort level for the advisor call.
|
|
16
|
+
*/
|
|
17
|
+
export type AdvisorReasoningEffort = OpenEnum<typeof AdvisorReasoningEffort>;
|
|
18
|
+
/**
|
|
19
|
+
* Reasoning configuration forwarded to the advisor call. Use this to control reasoning effort and token budget for models that support extended thinking.
|
|
20
|
+
*/
|
|
21
|
+
export type AdvisorReasoning = {
|
|
22
|
+
/**
|
|
23
|
+
* Reasoning effort level for the advisor call.
|
|
24
|
+
*/
|
|
25
|
+
effort?: AdvisorReasoningEffort | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Maximum number of reasoning tokens the advisor may use.
|
|
28
|
+
*/
|
|
29
|
+
maxTokens?: number | undefined;
|
|
30
|
+
};
|
|
31
|
+
/** @internal */
|
|
32
|
+
export declare const AdvisorReasoningEffort$outboundSchema: z.ZodType<string, AdvisorReasoningEffort>;
|
|
33
|
+
/** @internal */
|
|
34
|
+
export type AdvisorReasoning$Outbound = {
|
|
35
|
+
effort?: string | undefined;
|
|
36
|
+
max_tokens?: number | undefined;
|
|
37
|
+
};
|
|
38
|
+
/** @internal */
|
|
39
|
+
export declare const AdvisorReasoning$outboundSchema: z.ZodType<AdvisorReasoning$Outbound, AdvisorReasoning>;
|
|
40
|
+
export declare function advisorReasoningToJSON(advisorReasoning: AdvisorReasoning): string;
|
|
41
|
+
//# sourceMappingURL=advisorreasoning.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 4c86be6688b0
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import * as openEnums from "../types/enums.js";
|
|
8
|
+
/**
|
|
9
|
+
* Reasoning effort level for the advisor call.
|
|
10
|
+
*/
|
|
11
|
+
export const AdvisorReasoningEffort = {
|
|
12
|
+
Xhigh: "xhigh",
|
|
13
|
+
High: "high",
|
|
14
|
+
Medium: "medium",
|
|
15
|
+
Low: "low",
|
|
16
|
+
Minimal: "minimal",
|
|
17
|
+
None: "none",
|
|
18
|
+
};
|
|
19
|
+
/** @internal */
|
|
20
|
+
export const AdvisorReasoningEffort$outboundSchema = openEnums.outboundSchema(AdvisorReasoningEffort);
|
|
21
|
+
/** @internal */
|
|
22
|
+
export const AdvisorReasoning$outboundSchema = z.object({
|
|
23
|
+
effort: AdvisorReasoningEffort$outboundSchema.optional(),
|
|
24
|
+
maxTokens: z.int().optional(),
|
|
25
|
+
}).transform((v) => {
|
|
26
|
+
return remap$(v, {
|
|
27
|
+
maxTokens: "max_tokens",
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
export function advisorReasoningToJSON(advisorReasoning) {
|
|
31
|
+
return JSON.stringify(AdvisorReasoning$outboundSchema.parse(advisorReasoning));
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=advisorreasoning.js.map
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { AdvisorNestedTool, AdvisorNestedTool$Outbound } from "./advisornestedtool.js";
|
|
3
|
+
import { AdvisorReasoning, AdvisorReasoning$Outbound } from "./advisorreasoning.js";
|
|
4
|
+
/**
|
|
5
|
+
* Configuration for one openrouter:advisor server tool entry.
|
|
6
|
+
*/
|
|
7
|
+
export type AdvisorServerToolConfig = {
|
|
8
|
+
/**
|
|
9
|
+
* When true, the full parent conversation is forwarded to the advisor so it sees the same context the executor does (and the tool-call `prompt`, if given, is appended as a final user turn). When false or omitted, the advisor receives only the `prompt` the executor passes in the tool call.
|
|
10
|
+
*/
|
|
11
|
+
forwardTranscript?: boolean | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* System instructions for the advisor sub-agent. When omitted, the advisor responds with no system prompt of its own.
|
|
14
|
+
*/
|
|
15
|
+
instructions?: string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Maximum number of output tokens (including reasoning) the advisor may produce. When omitted, the provider's default applies.
|
|
18
|
+
*/
|
|
19
|
+
maxCompletionTokens?: number | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Maximum number of tool-calling steps the advisor sub-agent may take during its agentic loop. Capped at 25. Only relevant when the advisor is given tools.
|
|
22
|
+
*/
|
|
23
|
+
maxToolCalls?: number | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Slug of the advisor model to consult (any OpenRouter model). When omitted, the executor can choose it via the tool call's `model` argument; if neither is set, the model from the outer API request is used. The advisor tool itself cannot be the advisor model.
|
|
26
|
+
*/
|
|
27
|
+
model?: string | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Optional name for this advisor. The model sees one tool per named advisor (and one default for an unnamed entry). Names must be unique across advisor entries. Letters, digits, spaces, underscores, and dashes; trimmed; 1–64 chars.
|
|
30
|
+
*/
|
|
31
|
+
name?: string | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Reasoning configuration forwarded to the advisor call. Use this to control reasoning effort and token budget for models that support extended thinking.
|
|
34
|
+
*/
|
|
35
|
+
reasoning?: AdvisorReasoning | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* When true, the advisor's advice streams incrementally as it is produced. In the Responses API this emits `response.output_text.delta` events targeting the advisor output item; the final `advice` field is still set on the completed item. Has no effect on the Chat Completions API (where the advice arrives only as the final tool result). When false or omitted, the advice arrives only as the final result.
|
|
38
|
+
*/
|
|
39
|
+
stream?: boolean | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Sampling temperature forwarded to the advisor call. When omitted, the provider's default applies.
|
|
42
|
+
*/
|
|
43
|
+
temperature?: number | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Tools the advisor sub-agent may use while forming its advice. The advisor runs as an agentic sub-agent over these tools, then returns its text. Only OpenRouter server tools are supported — function tools are rejected — and the list must not include the advisor tool itself.
|
|
46
|
+
*/
|
|
47
|
+
tools?: Array<AdvisorNestedTool> | undefined;
|
|
48
|
+
};
|
|
49
|
+
/** @internal */
|
|
50
|
+
export type AdvisorServerToolConfig$Outbound = {
|
|
51
|
+
forward_transcript?: boolean | undefined;
|
|
52
|
+
instructions?: string | undefined;
|
|
53
|
+
max_completion_tokens?: number | undefined;
|
|
54
|
+
max_tool_calls?: number | undefined;
|
|
55
|
+
model?: string | undefined;
|
|
56
|
+
name?: string | undefined;
|
|
57
|
+
reasoning?: AdvisorReasoning$Outbound | undefined;
|
|
58
|
+
stream?: boolean | undefined;
|
|
59
|
+
temperature?: number | undefined;
|
|
60
|
+
tools?: Array<AdvisorNestedTool$Outbound> | undefined;
|
|
61
|
+
};
|
|
62
|
+
/** @internal */
|
|
63
|
+
export declare const AdvisorServerToolConfig$outboundSchema: z.ZodType<AdvisorServerToolConfig$Outbound, AdvisorServerToolConfig>;
|
|
64
|
+
export declare function advisorServerToolConfigToJSON(advisorServerToolConfig: AdvisorServerToolConfig): string;
|
|
65
|
+
//# sourceMappingURL=advisorservertoolconfig.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 4c2b85fa1b08
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import { AdvisorNestedTool$outboundSchema, } from "./advisornestedtool.js";
|
|
8
|
+
import { AdvisorReasoning$outboundSchema, } from "./advisorreasoning.js";
|
|
9
|
+
/** @internal */
|
|
10
|
+
export const AdvisorServerToolConfig$outboundSchema = z.object({
|
|
11
|
+
forwardTranscript: z.boolean().optional(),
|
|
12
|
+
instructions: z.string().optional(),
|
|
13
|
+
maxCompletionTokens: z.int().optional(),
|
|
14
|
+
maxToolCalls: z.int().optional(),
|
|
15
|
+
model: z.string().optional(),
|
|
16
|
+
name: z.string().optional(),
|
|
17
|
+
reasoning: AdvisorReasoning$outboundSchema.optional(),
|
|
18
|
+
stream: z.boolean().optional(),
|
|
19
|
+
temperature: z.number().optional(),
|
|
20
|
+
tools: z.array(AdvisorNestedTool$outboundSchema).optional(),
|
|
21
|
+
}).transform((v) => {
|
|
22
|
+
return remap$(v, {
|
|
23
|
+
forwardTranscript: "forward_transcript",
|
|
24
|
+
maxCompletionTokens: "max_completion_tokens",
|
|
25
|
+
maxToolCalls: "max_tool_calls",
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
export function advisorServerToolConfigToJSON(advisorServerToolConfig) {
|
|
29
|
+
return JSON.stringify(AdvisorServerToolConfig$outboundSchema.parse(advisorServerToolConfig));
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=advisorservertoolconfig.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { ClosedEnum } from "../types/enums.js";
|
|
3
|
+
import { AdvisorServerToolConfig, AdvisorServerToolConfig$Outbound } from "./advisorservertoolconfig.js";
|
|
4
|
+
export declare const AdvisorServerToolOpenRouterType: {
|
|
5
|
+
readonly OpenrouterAdvisor: "openrouter:advisor";
|
|
6
|
+
};
|
|
7
|
+
export type AdvisorServerToolOpenRouterType = ClosedEnum<typeof AdvisorServerToolOpenRouterType>;
|
|
8
|
+
/**
|
|
9
|
+
* OpenRouter built-in server tool: consults a higher-intelligence advisor model (any OpenRouter model) for guidance mid-generation and returns its response. The advisor may run as a sub-agent with its own tools. Include multiple entries to offer several named advisors; at most one entry may omit `name` to act as the default advisor.
|
|
10
|
+
*/
|
|
11
|
+
export type AdvisorServerToolOpenRouter = {
|
|
12
|
+
/**
|
|
13
|
+
* Configuration for one openrouter:advisor server tool entry.
|
|
14
|
+
*/
|
|
15
|
+
parameters?: AdvisorServerToolConfig | undefined;
|
|
16
|
+
type: AdvisorServerToolOpenRouterType;
|
|
17
|
+
};
|
|
18
|
+
/** @internal */
|
|
19
|
+
export declare const AdvisorServerToolOpenRouterType$outboundSchema: z.ZodEnum<typeof AdvisorServerToolOpenRouterType>;
|
|
20
|
+
/** @internal */
|
|
21
|
+
export type AdvisorServerToolOpenRouter$Outbound = {
|
|
22
|
+
parameters?: AdvisorServerToolConfig$Outbound | undefined;
|
|
23
|
+
type: string;
|
|
24
|
+
};
|
|
25
|
+
/** @internal */
|
|
26
|
+
export declare const AdvisorServerToolOpenRouter$outboundSchema: z.ZodType<AdvisorServerToolOpenRouter$Outbound, AdvisorServerToolOpenRouter>;
|
|
27
|
+
export declare function advisorServerToolOpenRouterToJSON(advisorServerToolOpenRouter: AdvisorServerToolOpenRouter): string;
|
|
28
|
+
//# sourceMappingURL=advisorservertoolopenrouter.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 980c275cec65
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { AdvisorServerToolConfig$outboundSchema, } from "./advisorservertoolconfig.js";
|
|
7
|
+
export const AdvisorServerToolOpenRouterType = {
|
|
8
|
+
OpenrouterAdvisor: "openrouter:advisor",
|
|
9
|
+
};
|
|
10
|
+
/** @internal */
|
|
11
|
+
export const AdvisorServerToolOpenRouterType$outboundSchema = z.enum(AdvisorServerToolOpenRouterType);
|
|
12
|
+
/** @internal */
|
|
13
|
+
export const AdvisorServerToolOpenRouter$outboundSchema = z.object({
|
|
14
|
+
parameters: AdvisorServerToolConfig$outboundSchema.optional(),
|
|
15
|
+
type: AdvisorServerToolOpenRouterType$outboundSchema,
|
|
16
|
+
});
|
|
17
|
+
export function advisorServerToolOpenRouterToJSON(advisorServerToolOpenRouter) {
|
|
18
|
+
return JSON.stringify(AdvisorServerToolOpenRouter$outboundSchema.parse(advisorServerToolOpenRouter));
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=advisorservertoolopenrouter.js.map
|