@omnicross/core 0.1.1 → 0.1.3
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/ApiConverter.cjs +3 -778
- package/dist/ApiConverter.js +12 -751
- package/dist/{CompletionService-DtOF_War.d.cts → CompletionService-D3a47vdU.d.cts} +2 -1
- package/dist/{CompletionService-7fCmKAP3.d.ts → CompletionService-DdWaAxq0.d.ts} +2 -1
- package/dist/auth/GeminiCodeAssistProjectResolver.cjs +32 -60
- package/dist/auth/GeminiCodeAssistProjectResolver.js +11 -10
- package/dist/builtin-web-fetch-77JZUZGM.cjs +100 -0
- package/dist/builtin-web-fetch-IGLBX2XY.js +100 -0
- package/dist/chunk-2DCNB7DF.cjs +514 -0
- package/dist/chunk-2FMI2B6V.cjs +6196 -0
- package/dist/chunk-3OPYJG76.cjs +266 -0
- package/dist/chunk-3QOSDDNI.cjs +130 -0
- package/dist/chunk-46RLHI7D.js +0 -0
- package/dist/chunk-46ZIFWYG.cjs +277 -0
- package/dist/chunk-4DECIFU7.js +6196 -0
- package/dist/chunk-4IH4EL7M.cjs +9 -0
- package/dist/chunk-4VAVYUZS.cjs +991 -0
- package/dist/chunk-5ENKBSWO.js +311 -0
- package/dist/chunk-5ERIZW3D.js +44 -0
- package/dist/chunk-5HTVET6E.js +514 -0
- package/dist/chunk-5ZQBEOMD.js +764 -0
- package/dist/chunk-6RPZADX3.cjs +92 -0
- package/dist/chunk-7VU7V2E4.js +0 -0
- package/dist/chunk-7YN22L2H.cjs +87 -0
- package/dist/chunk-A2YMUCBT.cjs +105 -0
- package/dist/chunk-AEOZIDEB.cjs +32 -0
- package/dist/chunk-AQ5TNQB7.js +13 -0
- package/dist/chunk-AVYJ4YBN.js +58 -0
- package/dist/chunk-BO4RFWBR.js +89 -0
- package/dist/chunk-C72S6TTV.cjs +49 -0
- package/dist/chunk-C7PSERMH.js +87 -0
- package/dist/chunk-CDHS2QDC.js +179 -0
- package/dist/chunk-CWM2ZDU5.js +130 -0
- package/dist/chunk-CZHZGRU7.js +383 -0
- package/dist/chunk-DK4A7DLE.js +266 -0
- package/dist/chunk-DQ5VAYZ6.cjs +42 -0
- package/dist/chunk-DRWHTIIZ.js +13 -0
- package/dist/chunk-DWKQZ2SK.cjs +254 -0
- package/dist/chunk-EYZYXJTJ.cjs +1 -0
- package/dist/chunk-FFALUUZZ.cjs +235 -0
- package/dist/chunk-FMOBD2OQ.js +39 -0
- package/dist/chunk-FTQ7IQUC.js +991 -0
- package/dist/chunk-FZ46M34D.cjs +1 -0
- package/dist/chunk-G2UTNSGU.js +277 -0
- package/dist/chunk-GBHYAGX3.cjs +26 -0
- package/dist/chunk-GMMT7RVN.cjs +39 -0
- package/dist/chunk-H5JUT3KV.js +105 -0
- package/dist/chunk-HQP3K7PU.cjs +431 -0
- package/dist/chunk-HUZZZ3JL.js +32 -0
- package/dist/chunk-IAXWICZU.js +69 -0
- package/dist/chunk-JMJBSACD.cjs +147 -0
- package/dist/chunk-JO5NLTLY.js +46 -0
- package/dist/chunk-JWC6APFQ.js +23 -0
- package/dist/chunk-KUU2RNG6.cjs +46 -0
- package/dist/chunk-L74VDN4A.cjs +32 -0
- package/dist/chunk-MQNDWYPN.js +235 -0
- package/dist/chunk-MZNPGW5Q.js +26 -0
- package/dist/chunk-N5QFKSDO.js +56 -0
- package/dist/chunk-NYUNU75A.cjs +44 -0
- package/dist/chunk-NZYN7C3P.cjs +179 -0
- package/dist/chunk-Q27JY5RG.cjs +126 -0
- package/dist/chunk-QBZJ7P2T.cjs +13 -0
- package/dist/chunk-QWBWGODS.cjs +69 -0
- package/dist/chunk-QXD4MV2X.cjs +23 -0
- package/dist/chunk-R3HK6R4B.cjs +13 -0
- package/dist/chunk-RPII3E6Z.cjs +145 -0
- package/dist/chunk-RSJ3TWJQ.cjs +186 -0
- package/dist/chunk-S4WBV25P.js +913 -0
- package/dist/chunk-S6JGLF3G.cjs +89 -0
- package/dist/chunk-SUEGJ75D.cjs +764 -0
- package/dist/chunk-SVNDB62D.cjs +58 -0
- package/dist/chunk-SVXC36MU.cjs +383 -0
- package/dist/chunk-TKJMZBAH.js +32 -0
- package/dist/chunk-UBWEBKRC.js +42 -0
- package/dist/chunk-UNEFIWXI.cjs +32 -0
- package/dist/chunk-VQY5W4YW.cjs +311 -0
- package/dist/chunk-VVEHS2LI.js +431 -0
- package/dist/chunk-WNY4WMRF.js +32 -0
- package/dist/chunk-XEKD23J5.js +9 -0
- package/dist/chunk-XTEI64OU.js +145 -0
- package/dist/chunk-XX6NQJMA.js +92 -0
- package/dist/chunk-Y6OM7EV7.cjs +56 -0
- package/dist/chunk-Y7FO65VT.js +147 -0
- package/dist/chunk-YGXJGRFI.cjs +913 -0
- package/dist/chunk-YMFAJFQT.cjs +173 -0
- package/dist/chunk-Z7LUNECE.js +49 -0
- package/dist/chunk-Z7Y2NPHY.js +186 -0
- package/dist/chunk-ZJZAOKI7.js +254 -0
- package/dist/chunk-ZLX3KGXX.js +173 -0
- package/dist/chunk-ZY6KU6P3.js +126 -0
- package/dist/completion/ApiKeyPoolService.cjs +23 -48
- package/dist/completion/ApiKeyPoolService.d.cts +150 -2
- package/dist/completion/ApiKeyPoolService.d.ts +150 -2
- package/dist/completion/BuiltinToolExecutor.cjs +9 -324
- package/dist/completion/BuiltinToolExecutor.js +6 -290
- package/dist/completion/CompletionService.cjs +45 -3487
- package/dist/completion/CompletionService.d.cts +3 -2
- package/dist/completion/CompletionService.d.ts +3 -2
- package/dist/completion/CompletionService.js +41 -3457
- package/dist/completion/NativeSearchInjector.cjs +8 -192
- package/dist/completion/NativeSearchInjector.js +7 -162
- package/dist/completion/ProviderSearchInjector.cjs +12 -39
- package/dist/completion/native-search-types.cjs +13 -66
- package/dist/completion/native-search-types.js +7 -31
- package/dist/completion/openrouter-headers.cjs +12 -71
- package/dist/completion/openrouter-headers.d.cts +9 -12
- package/dist/completion/openrouter-headers.d.ts +9 -12
- package/dist/completion/openrouter-headers.js +7 -36
- package/dist/completion/openrouter-models.cjs +11 -67
- package/dist/completion/openrouter-models.js +5 -34
- package/dist/completion/types.cjs +1 -18
- package/dist/completion/url-builder.cjs +24 -138
- package/dist/completion/url-builder.js +12 -92
- package/dist/completion.cjs +62 -3989
- package/dist/completion.d.cts +3 -2
- package/dist/completion.d.ts +3 -2
- package/dist/completion.js +70 -3953
- package/dist/index.cjs +319 -10429
- package/dist/index.d.cts +49 -12
- package/dist/index.d.ts +49 -12
- package/dist/index.js +248 -10269
- package/dist/logger-4GvQNzhE.d.cts +22 -0
- package/dist/logger-4GvQNzhE.d.ts +22 -0
- package/dist/outbound-api/routeResolver.cjs +10 -217
- package/dist/outbound-api/routeResolver.d.cts +10 -3
- package/dist/outbound-api/routeResolver.d.ts +10 -3
- package/dist/outbound-api/routeResolver.js +9 -187
- package/dist/outbound-api/subscriptionRegistryPort.cjs +7 -37
- package/dist/outbound-api/subscriptionRegistryPort.d.cts +2 -1
- package/dist/outbound-api/subscriptionRegistryPort.d.ts +2 -1
- package/dist/outbound-api/subscriptionRegistryPort.js +4 -8
- package/dist/outbound-api/types.cjs +5 -17
- package/dist/outbound-api/types.d.cts +12 -144
- package/dist/outbound-api/types.d.ts +12 -144
- package/dist/outbound-api/types.js +6 -0
- package/dist/outbound-api.cjs +197 -5265
- package/dist/outbound-api.d.cts +787 -25
- package/dist/outbound-api.d.ts +787 -25
- package/dist/outbound-api.js +173 -5195
- package/dist/pipeline/AuthSource.cjs +1 -18
- package/dist/pipeline/AuthSource.d.cts +23 -1
- package/dist/pipeline/AuthSource.d.ts +23 -1
- package/dist/pipeline/LlmConfigProviderAuth.cjs +5 -166
- package/dist/pipeline/LlmConfigProviderAuth.d.cts +2 -1
- package/dist/pipeline/LlmConfigProviderAuth.d.ts +2 -1
- package/dist/pipeline/LlmConfigProviderAuth.js +5 -139
- package/dist/pipeline/SubscriptionAccountHealth.cjs +22 -0
- package/dist/pipeline/SubscriptionAccountHealth.d.cts +235 -0
- package/dist/pipeline/SubscriptionAccountHealth.d.ts +235 -0
- package/dist/pipeline/SubscriptionAccountHealth.js +22 -0
- package/dist/pipeline/SubscriptionAuthSource.cjs +6 -128
- package/dist/pipeline/SubscriptionAuthSource.d.cts +3 -2
- package/dist/pipeline/SubscriptionAuthSource.d.ts +3 -2
- package/dist/pipeline/SubscriptionAuthSource.js +5 -99
- package/dist/pipeline/SubscriptionAuthStrategy.cjs +1 -18
- package/dist/pipeline/SubscriptionAuthStrategy.d.cts +24 -1
- package/dist/pipeline/SubscriptionAuthStrategy.d.ts +24 -1
- package/dist/pipeline/auditSink.cjs +14 -0
- package/dist/pipeline/auditSink.d.cts +48 -0
- package/dist/pipeline/auditSink.d.ts +48 -0
- package/dist/pipeline/auditSink.js +14 -0
- package/dist/pipeline/billingEmit.cjs +14 -0
- package/dist/pipeline/billingEmit.d.cts +49 -0
- package/dist/pipeline/billingEmit.d.ts +49 -0
- package/dist/pipeline/billingEmit.js +14 -0
- package/dist/pipeline/executeProviderCall.cjs +5 -69
- package/dist/pipeline/executeProviderCall.js +3 -42
- package/dist/pipeline/resolveProviderChain.cjs +5 -46
- package/dist/pipeline/resolveProviderChain.js +3 -19
- package/dist/pipeline/resolveSubscriptionChain.cjs +5 -67
- package/dist/pipeline/resolveSubscriptionChain.js +3 -40
- package/dist/ports/gemini-code-assist-resolver.cjs +7 -37
- package/dist/ports/gemini-code-assist-resolver.js +4 -8
- package/dist/ports/pricing-store.cjs +1 -0
- package/dist/ports/pricing-store.d.cts +50 -0
- package/dist/ports/pricing-store.d.ts +50 -0
- package/dist/ports/pricing-store.js +0 -0
- package/dist/ports/provider-config-source.cjs +1 -18
- package/dist/ports/usage-event-store.cjs +1 -0
- package/dist/ports/usage-event-store.d.cts +54 -0
- package/dist/ports/usage-event-store.d.ts +54 -0
- package/dist/ports/usage-event-store.js +0 -0
- package/dist/ports/web-search-backend.cjs +1 -18
- package/dist/ports.cjs +1 -18
- package/dist/ports.d.cts +13 -2
- package/dist/ports.d.ts +13 -2
- package/dist/provider-proxy/ProviderProxy.cjs +47 -4643
- package/dist/provider-proxy/ProviderProxy.d.cts +2 -1
- package/dist/provider-proxy/ProviderProxy.d.ts +2 -1
- package/dist/provider-proxy/ProviderProxy.js +42 -4613
- package/dist/provider-proxy/identity/SubscriptionIdentityStore.cjs +15 -0
- package/dist/provider-proxy/identity/SubscriptionIdentityStore.d.cts +121 -0
- package/dist/provider-proxy/identity/SubscriptionIdentityStore.d.ts +121 -0
- package/dist/provider-proxy/identity/SubscriptionIdentityStore.js +15 -0
- package/dist/provider-proxy/identity/fingerprintHeaders.cjs +20 -0
- package/dist/provider-proxy/identity/fingerprintHeaders.d.cts +89 -0
- package/dist/provider-proxy/identity/fingerprintHeaders.d.ts +89 -0
- package/dist/provider-proxy/identity/fingerprintHeaders.js +20 -0
- package/dist/provider-proxy/ingress/providerProxyShared.cjs +42 -2941
- package/dist/provider-proxy/ingress/providerProxyShared.d.cts +13 -3
- package/dist/provider-proxy/ingress/providerProxyShared.d.ts +13 -3
- package/dist/provider-proxy/ingress/providerProxyShared.js +48 -2914
- package/dist/provider-proxy/matchText.cjs +13 -72
- package/dist/provider-proxy/matchText.d.cts +14 -1
- package/dist/provider-proxy/matchText.d.ts +14 -1
- package/dist/provider-proxy/matchText.js +8 -39
- package/dist/provider-proxy/types.cjs +1 -18
- package/dist/provider-proxy/types.d.cts +25 -1
- package/dist/provider-proxy/types.d.ts +25 -1
- package/dist/provider-proxy.cjs +42 -4655
- package/dist/provider-proxy.d.cts +2 -1
- package/dist/provider-proxy.d.ts +2 -1
- package/dist/provider-proxy.js +46 -4628
- package/dist/{routeResolver-HE-ZO0fO.d.ts → routeResolver-B1NglTfe.d.ts} +36 -10
- package/dist/{routeResolver-BrbK6ja9.d.cts → routeResolver-CbG5uBgm.d.cts} +36 -10
- package/dist/serializeError.cjs +5 -81
- package/dist/serializeError.js +3 -54
- package/dist/sse-parser.cjs +7 -455
- package/dist/sse-parser.js +4 -426
- package/dist/transformer/TransformerChainExecutor.cjs +4 -318
- package/dist/transformer/TransformerChainExecutor.js +4 -291
- package/dist/transformer/TransformerService.cjs +5 -289
- package/dist/transformer/TransformerService.js +3 -262
- package/dist/transformer/anthropicBetaInject.cjs +7 -50
- package/dist/transformer/anthropicBetaInject.js +4 -21
- package/dist/transformer/transformers/AnthropicTransformer.cjs +3 -1014
- package/dist/transformer/transformers/AnthropicTransformer.js +3 -987
- package/dist/transformer/transformers/GeminiCodeAssistTransformer.cjs +4 -1106
- package/dist/transformer/transformers/GeminiCodeAssistTransformer.js +7 -1079
- package/dist/transformer/transformers/GeminiTransformer.cjs +4 -1010
- package/dist/transformer/transformers/GeminiTransformer.js +4 -983
- package/dist/transformer/transformers/OpenAIResponseTransformer.cjs +3 -535
- package/dist/transformer/transformers/OpenAIResponseTransformer.js +3 -510
- package/dist/transformer/transformers/OpenCodeGoTransformer.cjs +5 -72
- package/dist/transformer/transformers/OpenCodeGoTransformer.js +3 -45
- package/dist/transformer/transformers/ReasoningTransformer.cjs +3 -270
- package/dist/transformer/transformers/ReasoningTransformer.js +2 -249
- package/dist/transformer/transformers.cjs +10 -3177
- package/dist/transformer/transformers.js +23 -3158
- package/dist/transformer/types.cjs +1 -18
- package/dist/transformer.cjs +13 -3726
- package/dist/transformer.js +17 -3706
- package/dist/types-6OUY_xfA.d.ts +830 -0
- package/dist/types-aBFFXoBz.d.cts +830 -0
- package/dist/usage/pricing-engine.cjs +6 -0
- package/dist/usage/pricing-engine.d.cts +83 -0
- package/dist/usage/pricing-engine.d.ts +83 -0
- package/dist/usage/pricing-engine.js +6 -0
- package/dist/usage/usage-recorder.cjs +6 -0
- package/dist/usage/usage-recorder.d.cts +91 -0
- package/dist/usage/usage-recorder.d.ts +91 -0
- package/dist/usage/usage-recorder.js +6 -0
- package/dist/usage.cjs +11 -0
- package/dist/usage.d.cts +8 -0
- package/dist/usage.d.ts +8 -0
- package/dist/usage.js +11 -0
- package/package.json +4 -2
- package/dist/ApiKeyPoolService-BmMkau07.d.cts +0 -170
- package/dist/ApiKeyPoolService-BmMkau07.d.ts +0 -170
|
@@ -2,18 +2,13 @@
|
|
|
2
2
|
* OpenRouter request header / endpoint helpers.
|
|
3
3
|
*
|
|
4
4
|
* Shared by the multimodal subsystems (image / music / video / asr / tts) that
|
|
5
|
-
* route through OpenRouter. The
|
|
6
|
-
* `
|
|
7
|
-
*
|
|
5
|
+
* route through OpenRouter. The app-attribution headers (`HTTP-Referer` /
|
|
6
|
+
* `X-Title`) come from the single shared `OPENROUTER_APP_HEADERS` identity in
|
|
7
|
+
* `../openrouter` — the SAME source the LLM `header-builder` path uses — so a
|
|
8
|
+
* host embedder's boot-time `setOpenRouterAppIdentity` override is honored here
|
|
9
|
+
* too. This helper exists so media services don't need the LLM provider type.
|
|
8
10
|
*/
|
|
9
11
|
declare const OPENROUTER_DEFAULT_BASE_URL = "https://openrouter.ai/api/v1";
|
|
10
|
-
/**
|
|
11
|
-
* Default HTTP-Referer / X-Title for every OpenRouter request the serving core
|
|
12
|
-
* makes. OpenRouter uses these for app-stats attribution. A host embedder may
|
|
13
|
-
* override the values it sends; these are the package defaults.
|
|
14
|
-
*/
|
|
15
|
-
declare const OPENROUTER_HTTP_REFERER = "https://omnicross.dev";
|
|
16
|
-
declare const OPENROUTER_X_TITLE = "Omnicross";
|
|
17
12
|
interface OpenRouterCredentialFields {
|
|
18
13
|
apiKey?: string;
|
|
19
14
|
endpoint?: string;
|
|
@@ -27,7 +22,9 @@ interface OpenRouterHeaderOptions {
|
|
|
27
22
|
/**
|
|
28
23
|
* Build the standard OpenRouter request header set from a credential record.
|
|
29
24
|
* Throws when `apiKey` is missing — every OpenRouter request requires one.
|
|
30
|
-
* `HTTP-Referer` and `X-Title`
|
|
25
|
+
* `HTTP-Referer` and `X-Title` come from the shared app-attribution identity
|
|
26
|
+
* (`OPENROUTER_APP_HEADERS`), overridable once at host boot via
|
|
27
|
+
* `setOpenRouterAppIdentity`.
|
|
31
28
|
*/
|
|
32
29
|
declare function buildOpenRouterHeaders(credentials: OpenRouterCredentialFields, options?: OpenRouterHeaderOptions): Record<string, string>;
|
|
33
30
|
/**
|
|
@@ -41,4 +38,4 @@ declare function resolveOpenRouterBaseUrl(endpoint?: string | null): string;
|
|
|
41
38
|
*/
|
|
42
39
|
declare function buildOpenRouterUrl(endpoint: string | undefined, path: string): string;
|
|
43
40
|
|
|
44
|
-
export { OPENROUTER_DEFAULT_BASE_URL,
|
|
41
|
+
export { OPENROUTER_DEFAULT_BASE_URL, type OpenRouterCredentialFields, type OpenRouterHeaderOptions, buildOpenRouterHeaders, buildOpenRouterUrl, resolveOpenRouterBaseUrl };
|
|
@@ -2,18 +2,13 @@
|
|
|
2
2
|
* OpenRouter request header / endpoint helpers.
|
|
3
3
|
*
|
|
4
4
|
* Shared by the multimodal subsystems (image / music / video / asr / tts) that
|
|
5
|
-
* route through OpenRouter. The
|
|
6
|
-
* `
|
|
7
|
-
*
|
|
5
|
+
* route through OpenRouter. The app-attribution headers (`HTTP-Referer` /
|
|
6
|
+
* `X-Title`) come from the single shared `OPENROUTER_APP_HEADERS` identity in
|
|
7
|
+
* `../openrouter` — the SAME source the LLM `header-builder` path uses — so a
|
|
8
|
+
* host embedder's boot-time `setOpenRouterAppIdentity` override is honored here
|
|
9
|
+
* too. This helper exists so media services don't need the LLM provider type.
|
|
8
10
|
*/
|
|
9
11
|
declare const OPENROUTER_DEFAULT_BASE_URL = "https://openrouter.ai/api/v1";
|
|
10
|
-
/**
|
|
11
|
-
* Default HTTP-Referer / X-Title for every OpenRouter request the serving core
|
|
12
|
-
* makes. OpenRouter uses these for app-stats attribution. A host embedder may
|
|
13
|
-
* override the values it sends; these are the package defaults.
|
|
14
|
-
*/
|
|
15
|
-
declare const OPENROUTER_HTTP_REFERER = "https://omnicross.dev";
|
|
16
|
-
declare const OPENROUTER_X_TITLE = "Omnicross";
|
|
17
12
|
interface OpenRouterCredentialFields {
|
|
18
13
|
apiKey?: string;
|
|
19
14
|
endpoint?: string;
|
|
@@ -27,7 +22,9 @@ interface OpenRouterHeaderOptions {
|
|
|
27
22
|
/**
|
|
28
23
|
* Build the standard OpenRouter request header set from a credential record.
|
|
29
24
|
* Throws when `apiKey` is missing — every OpenRouter request requires one.
|
|
30
|
-
* `HTTP-Referer` and `X-Title`
|
|
25
|
+
* `HTTP-Referer` and `X-Title` come from the shared app-attribution identity
|
|
26
|
+
* (`OPENROUTER_APP_HEADERS`), overridable once at host boot via
|
|
27
|
+
* `setOpenRouterAppIdentity`.
|
|
31
28
|
*/
|
|
32
29
|
declare function buildOpenRouterHeaders(credentials: OpenRouterCredentialFields, options?: OpenRouterHeaderOptions): Record<string, string>;
|
|
33
30
|
/**
|
|
@@ -41,4 +38,4 @@ declare function resolveOpenRouterBaseUrl(endpoint?: string | null): string;
|
|
|
41
38
|
*/
|
|
42
39
|
declare function buildOpenRouterUrl(endpoint: string | undefined, path: string): string;
|
|
43
40
|
|
|
44
|
-
export { OPENROUTER_DEFAULT_BASE_URL,
|
|
41
|
+
export { OPENROUTER_DEFAULT_BASE_URL, type OpenRouterCredentialFields, type OpenRouterHeaderOptions, buildOpenRouterHeaders, buildOpenRouterUrl, resolveOpenRouterBaseUrl };
|
|
@@ -1,41 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
throw new Error("OpenRouter API key is required");
|
|
9
|
-
}
|
|
10
|
-
const headers = {
|
|
11
|
-
Authorization: `Bearer ${apiKey}`,
|
|
12
|
-
"HTTP-Referer": OPENROUTER_HTTP_REFERER,
|
|
13
|
-
"X-Title": OPENROUTER_X_TITLE
|
|
14
|
-
};
|
|
15
|
-
if (options.contentType !== false) {
|
|
16
|
-
headers["Content-Type"] = options.contentType ?? "application/json";
|
|
17
|
-
}
|
|
18
|
-
if (options.extra) {
|
|
19
|
-
for (const [key, value] of Object.entries(options.extra)) {
|
|
20
|
-
headers[key] = value;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return headers;
|
|
24
|
-
}
|
|
25
|
-
function resolveOpenRouterBaseUrl(endpoint) {
|
|
26
|
-
const raw = endpoint?.trim();
|
|
27
|
-
const base = raw && raw.length > 0 ? raw : OPENROUTER_DEFAULT_BASE_URL;
|
|
28
|
-
return base.replace(/\/+$/, "");
|
|
29
|
-
}
|
|
30
|
-
function buildOpenRouterUrl(endpoint, path) {
|
|
31
|
-
const base = resolveOpenRouterBaseUrl(endpoint);
|
|
32
|
-
const cleanPath = path.startsWith("/") ? path : `/${path}`;
|
|
33
|
-
return `${base}${cleanPath}`;
|
|
34
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
OPENROUTER_DEFAULT_BASE_URL,
|
|
3
|
+
buildOpenRouterHeaders,
|
|
4
|
+
buildOpenRouterUrl,
|
|
5
|
+
resolveOpenRouterBaseUrl
|
|
6
|
+
} from "../chunk-UBWEBKRC.js";
|
|
7
|
+
import "../chunk-HUZZZ3JL.js";
|
|
35
8
|
export {
|
|
36
9
|
OPENROUTER_DEFAULT_BASE_URL,
|
|
37
|
-
OPENROUTER_HTTP_REFERER,
|
|
38
|
-
OPENROUTER_X_TITLE,
|
|
39
10
|
buildOpenRouterHeaders,
|
|
40
11
|
buildOpenRouterUrl,
|
|
41
12
|
resolveOpenRouterBaseUrl
|
|
@@ -1,68 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
19
2
|
|
|
20
|
-
// src/completion/openrouter-models.ts
|
|
21
|
-
var openrouter_models_exports = {};
|
|
22
|
-
__export(openrouter_models_exports, {
|
|
23
|
-
fetchOpenRouterModels: () => fetchOpenRouterModels
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(openrouter_models_exports);
|
|
26
3
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
var OPENROUTER_HTTP_REFERER = "https://omnicross.dev";
|
|
30
|
-
var OPENROUTER_X_TITLE = "Omnicross";
|
|
31
|
-
function buildOpenRouterHeaders(credentials, options = {}) {
|
|
32
|
-
const apiKey = credentials.apiKey?.trim();
|
|
33
|
-
if (!apiKey) {
|
|
34
|
-
throw new Error("OpenRouter API key is required");
|
|
35
|
-
}
|
|
36
|
-
const headers = {
|
|
37
|
-
Authorization: `Bearer ${apiKey}`,
|
|
38
|
-
"HTTP-Referer": OPENROUTER_HTTP_REFERER,
|
|
39
|
-
"X-Title": OPENROUTER_X_TITLE
|
|
40
|
-
};
|
|
41
|
-
if (options.contentType !== false) {
|
|
42
|
-
headers["Content-Type"] = options.contentType ?? "application/json";
|
|
43
|
-
}
|
|
44
|
-
if (options.extra) {
|
|
45
|
-
for (const [key, value] of Object.entries(options.extra)) {
|
|
46
|
-
headers[key] = value;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return headers;
|
|
50
|
-
}
|
|
51
|
-
function resolveOpenRouterBaseUrl(endpoint) {
|
|
52
|
-
const raw = endpoint?.trim();
|
|
53
|
-
const base = raw && raw.length > 0 ? raw : OPENROUTER_DEFAULT_BASE_URL;
|
|
54
|
-
return base.replace(/\/+$/, "");
|
|
55
|
-
}
|
|
56
|
-
function buildOpenRouterUrl(endpoint, path) {
|
|
57
|
-
const base = resolveOpenRouterBaseUrl(endpoint);
|
|
58
|
-
const cleanPath = path.startsWith("/") ? path : `/${path}`;
|
|
59
|
-
return `${base}${cleanPath}`;
|
|
60
|
-
}
|
|
4
|
+
var _chunkDQ5VAYZ6cjs = require('../chunk-DQ5VAYZ6.cjs');
|
|
5
|
+
require('../chunk-UNEFIWXI.cjs');
|
|
61
6
|
|
|
62
7
|
// src/completion/openrouter-models.ts
|
|
63
8
|
async function fetchOpenRouterModels(credentials, outputModality) {
|
|
64
|
-
const headers = buildOpenRouterHeaders(credentials);
|
|
65
|
-
const url = buildOpenRouterUrl(
|
|
9
|
+
const headers = _chunkDQ5VAYZ6cjs.buildOpenRouterHeaders.call(void 0, credentials);
|
|
10
|
+
const url = _chunkDQ5VAYZ6cjs.buildOpenRouterUrl.call(void 0,
|
|
66
11
|
credentials.endpoint,
|
|
67
12
|
`/models?output_modalities=${encodeURIComponent(outputModality)}`
|
|
68
13
|
);
|
|
@@ -72,15 +17,14 @@ async function fetchOpenRouterModels(credentials, outputModality) {
|
|
|
72
17
|
let message = text.slice(0, 300);
|
|
73
18
|
try {
|
|
74
19
|
const parsed = JSON.parse(text);
|
|
75
|
-
message = parsed
|
|
76
|
-
} catch {
|
|
20
|
+
message = _optionalChain([parsed, 'optionalAccess', _ => _.error, 'optionalAccess', _2 => _2.message]) || _optionalChain([parsed, 'optionalAccess', _3 => _3.message]) || message;
|
|
21
|
+
} catch (e) {
|
|
77
22
|
}
|
|
78
23
|
throw new Error(`OpenRouter /models failed (${response.status}): ${message}`);
|
|
79
24
|
}
|
|
80
25
|
const data = await response.json();
|
|
81
|
-
return data
|
|
26
|
+
return _nullishCoalesce(_optionalChain([data, 'optionalAccess', _4 => _4.data]), () => ( []));
|
|
82
27
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
});
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
exports.fetchOpenRouterModels = fetchOpenRouterModels;
|
|
@@ -1,37 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const apiKey = credentials.apiKey?.trim();
|
|
7
|
-
if (!apiKey) {
|
|
8
|
-
throw new Error("OpenRouter API key is required");
|
|
9
|
-
}
|
|
10
|
-
const headers = {
|
|
11
|
-
Authorization: `Bearer ${apiKey}`,
|
|
12
|
-
"HTTP-Referer": OPENROUTER_HTTP_REFERER,
|
|
13
|
-
"X-Title": OPENROUTER_X_TITLE
|
|
14
|
-
};
|
|
15
|
-
if (options.contentType !== false) {
|
|
16
|
-
headers["Content-Type"] = options.contentType ?? "application/json";
|
|
17
|
-
}
|
|
18
|
-
if (options.extra) {
|
|
19
|
-
for (const [key, value] of Object.entries(options.extra)) {
|
|
20
|
-
headers[key] = value;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return headers;
|
|
24
|
-
}
|
|
25
|
-
function resolveOpenRouterBaseUrl(endpoint) {
|
|
26
|
-
const raw = endpoint?.trim();
|
|
27
|
-
const base = raw && raw.length > 0 ? raw : OPENROUTER_DEFAULT_BASE_URL;
|
|
28
|
-
return base.replace(/\/+$/, "");
|
|
29
|
-
}
|
|
30
|
-
function buildOpenRouterUrl(endpoint, path) {
|
|
31
|
-
const base = resolveOpenRouterBaseUrl(endpoint);
|
|
32
|
-
const cleanPath = path.startsWith("/") ? path : `/${path}`;
|
|
33
|
-
return `${base}${cleanPath}`;
|
|
34
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
buildOpenRouterHeaders,
|
|
3
|
+
buildOpenRouterUrl
|
|
4
|
+
} from "../chunk-UBWEBKRC.js";
|
|
5
|
+
import "../chunk-HUZZZ3JL.js";
|
|
35
6
|
|
|
36
7
|
// src/completion/openrouter-models.ts
|
|
37
8
|
async function fetchOpenRouterModels(credentials, outputModality) {
|
|
@@ -1,18 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
|
|
16
|
-
// src/completion/types.ts
|
|
17
|
-
var types_exports = {};
|
|
18
|
-
module.exports = __toCommonJS(types_exports);
|
|
1
|
+
"use strict";
|
|
@@ -1,138 +1,24 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
buildGeminiApiUrl: () => buildGeminiApiUrl,
|
|
26
|
-
buildGeminiModelActionUrl: () => buildGeminiModelActionUrl,
|
|
27
|
-
buildOpenAIApiUrl: () => buildOpenAIApiUrl,
|
|
28
|
-
buildOpenAIResponseApiUrl: () => buildOpenAIResponseApiUrl,
|
|
29
|
-
buildProviderApiUrl: () => buildProviderApiUrl,
|
|
30
|
-
normalizeAzureEndpoint: () => normalizeAzureEndpoint,
|
|
31
|
-
resolveApiFormat: () => resolveApiFormat,
|
|
32
|
-
resolveProviderEndpoint: () => resolveProviderEndpoint
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(url_builder_exports);
|
|
35
|
-
var import_endpoint_resolver = require("@omnicross/contracts/endpoint-resolver");
|
|
36
|
-
function resolveApiFormat(provider) {
|
|
37
|
-
if (provider.apiFormat) {
|
|
38
|
-
return provider.apiFormat;
|
|
39
|
-
}
|
|
40
|
-
if (provider.chatApiFormat) {
|
|
41
|
-
return provider.chatApiFormat;
|
|
42
|
-
}
|
|
43
|
-
if (provider.apiType === "claudecode" || provider.apiType === "anthropic") {
|
|
44
|
-
return "anthropic";
|
|
45
|
-
}
|
|
46
|
-
if (provider.apiType === "google") {
|
|
47
|
-
return "google";
|
|
48
|
-
}
|
|
49
|
-
return "openai";
|
|
50
|
-
}
|
|
51
|
-
function buildOpenAIApiUrl(baseUrl) {
|
|
52
|
-
const url = baseUrl.replace(/\/+$/, "");
|
|
53
|
-
if (url.endsWith("/chat/completions")) {
|
|
54
|
-
return url;
|
|
55
|
-
}
|
|
56
|
-
if (/\/v\d+$/.test(url)) {
|
|
57
|
-
return url + "/chat/completions";
|
|
58
|
-
}
|
|
59
|
-
if (url.includes("/chat/completions")) {
|
|
60
|
-
return url;
|
|
61
|
-
}
|
|
62
|
-
return url + "/v1/chat/completions";
|
|
63
|
-
}
|
|
64
|
-
function buildAnthropicApiUrl(baseUrl) {
|
|
65
|
-
const url = baseUrl.replace(/\/+$/, "");
|
|
66
|
-
if (url.endsWith("/messages")) {
|
|
67
|
-
return url;
|
|
68
|
-
}
|
|
69
|
-
if (url.includes("/messages")) {
|
|
70
|
-
return url;
|
|
71
|
-
}
|
|
72
|
-
if (/\/v\d+$/.test(url)) {
|
|
73
|
-
return url + "/messages";
|
|
74
|
-
}
|
|
75
|
-
return url + "/v1/messages";
|
|
76
|
-
}
|
|
77
|
-
function buildGeminiModelActionUrl(baseUrl, model, action) {
|
|
78
|
-
let url = baseUrl.replace(/\/+$/, "");
|
|
79
|
-
if (url.includes("/models/")) {
|
|
80
|
-
return url;
|
|
81
|
-
}
|
|
82
|
-
if (!/\/v\d+(?:beta)?(?:$|\/)/.test(url)) {
|
|
83
|
-
url += "/v1beta";
|
|
84
|
-
}
|
|
85
|
-
return `${url}/models/${model}:${action}`;
|
|
86
|
-
}
|
|
87
|
-
function buildGeminiApiUrl(baseUrl, model, stream) {
|
|
88
|
-
const action = stream ? "streamGenerateContent?alt=sse" : "generateContent";
|
|
89
|
-
return buildGeminiModelActionUrl(baseUrl, model, action);
|
|
90
|
-
}
|
|
91
|
-
function normalizeAzureEndpoint(endpoint) {
|
|
92
|
-
return endpoint.replace(/\/+$/, "").replace(/\/openai(\/v\d+)?$/, "");
|
|
93
|
-
}
|
|
94
|
-
function buildAzureOpenAIApiUrl(baseUrl, model, apiVersion) {
|
|
95
|
-
const endpoint = normalizeAzureEndpoint(baseUrl);
|
|
96
|
-
return `${endpoint}/openai/deployments/${model}/chat/completions?api-version=${apiVersion}`;
|
|
97
|
-
}
|
|
98
|
-
function buildOpenAIResponseApiUrl(baseUrl) {
|
|
99
|
-
const url = baseUrl.replace(/\/+$/, "");
|
|
100
|
-
if (url.endsWith("/responses")) {
|
|
101
|
-
return url;
|
|
102
|
-
}
|
|
103
|
-
if (/\/v\d+$/.test(url)) {
|
|
104
|
-
return url + "/responses";
|
|
105
|
-
}
|
|
106
|
-
return url + "/v1/responses";
|
|
107
|
-
}
|
|
108
|
-
var resolveProviderEndpoint = import_endpoint_resolver.resolveProviderEndpoint;
|
|
109
|
-
function buildProviderApiUrl(provider, options = {}) {
|
|
110
|
-
const format = resolveApiFormat(provider);
|
|
111
|
-
const { baseUrl } = resolveProviderEndpoint(provider);
|
|
112
|
-
switch (format) {
|
|
113
|
-
case "anthropic":
|
|
114
|
-
return buildAnthropicApiUrl(baseUrl);
|
|
115
|
-
case "google":
|
|
116
|
-
return buildGeminiApiUrl(baseUrl, options.model || "", options.stream || false);
|
|
117
|
-
case "azure-openai":
|
|
118
|
-
return buildAzureOpenAIApiUrl(baseUrl, options.model || "", provider.apiVersion || "2024-08-01-preview");
|
|
119
|
-
case "openai-response":
|
|
120
|
-
return buildOpenAIResponseApiUrl(baseUrl);
|
|
121
|
-
case "openai":
|
|
122
|
-
default:
|
|
123
|
-
return buildOpenAIApiUrl(baseUrl);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
127
|
-
0 && (module.exports = {
|
|
128
|
-
buildAnthropicApiUrl,
|
|
129
|
-
buildAzureOpenAIApiUrl,
|
|
130
|
-
buildGeminiApiUrl,
|
|
131
|
-
buildGeminiModelActionUrl,
|
|
132
|
-
buildOpenAIApiUrl,
|
|
133
|
-
buildOpenAIResponseApiUrl,
|
|
134
|
-
buildProviderApiUrl,
|
|
135
|
-
normalizeAzureEndpoint,
|
|
136
|
-
resolveApiFormat,
|
|
137
|
-
resolveProviderEndpoint
|
|
138
|
-
});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunkA2YMUCBTcjs = require('../chunk-A2YMUCBT.cjs');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
exports.buildAnthropicApiUrl = _chunkA2YMUCBTcjs.buildAnthropicApiUrl; exports.buildAzureOpenAIApiUrl = _chunkA2YMUCBTcjs.buildAzureOpenAIApiUrl; exports.buildGeminiApiUrl = _chunkA2YMUCBTcjs.buildGeminiApiUrl; exports.buildGeminiModelActionUrl = _chunkA2YMUCBTcjs.buildGeminiModelActionUrl; exports.buildOpenAIApiUrl = _chunkA2YMUCBTcjs.buildOpenAIApiUrl; exports.buildOpenAIResponseApiUrl = _chunkA2YMUCBTcjs.buildOpenAIResponseApiUrl; exports.buildProviderApiUrl = _chunkA2YMUCBTcjs.buildProviderApiUrl; exports.normalizeAzureEndpoint = _chunkA2YMUCBTcjs.normalizeAzureEndpoint; exports.resolveApiFormat = _chunkA2YMUCBTcjs.resolveApiFormat; exports.resolveProviderEndpoint = _chunkA2YMUCBTcjs.resolveProviderEndpoint;
|
|
@@ -1,95 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (provider.apiType === "google") {
|
|
14
|
-
return "google";
|
|
15
|
-
}
|
|
16
|
-
return "openai";
|
|
17
|
-
}
|
|
18
|
-
function buildOpenAIApiUrl(baseUrl) {
|
|
19
|
-
const url = baseUrl.replace(/\/+$/, "");
|
|
20
|
-
if (url.endsWith("/chat/completions")) {
|
|
21
|
-
return url;
|
|
22
|
-
}
|
|
23
|
-
if (/\/v\d+$/.test(url)) {
|
|
24
|
-
return url + "/chat/completions";
|
|
25
|
-
}
|
|
26
|
-
if (url.includes("/chat/completions")) {
|
|
27
|
-
return url;
|
|
28
|
-
}
|
|
29
|
-
return url + "/v1/chat/completions";
|
|
30
|
-
}
|
|
31
|
-
function buildAnthropicApiUrl(baseUrl) {
|
|
32
|
-
const url = baseUrl.replace(/\/+$/, "");
|
|
33
|
-
if (url.endsWith("/messages")) {
|
|
34
|
-
return url;
|
|
35
|
-
}
|
|
36
|
-
if (url.includes("/messages")) {
|
|
37
|
-
return url;
|
|
38
|
-
}
|
|
39
|
-
if (/\/v\d+$/.test(url)) {
|
|
40
|
-
return url + "/messages";
|
|
41
|
-
}
|
|
42
|
-
return url + "/v1/messages";
|
|
43
|
-
}
|
|
44
|
-
function buildGeminiModelActionUrl(baseUrl, model, action) {
|
|
45
|
-
let url = baseUrl.replace(/\/+$/, "");
|
|
46
|
-
if (url.includes("/models/")) {
|
|
47
|
-
return url;
|
|
48
|
-
}
|
|
49
|
-
if (!/\/v\d+(?:beta)?(?:$|\/)/.test(url)) {
|
|
50
|
-
url += "/v1beta";
|
|
51
|
-
}
|
|
52
|
-
return `${url}/models/${model}:${action}`;
|
|
53
|
-
}
|
|
54
|
-
function buildGeminiApiUrl(baseUrl, model, stream) {
|
|
55
|
-
const action = stream ? "streamGenerateContent?alt=sse" : "generateContent";
|
|
56
|
-
return buildGeminiModelActionUrl(baseUrl, model, action);
|
|
57
|
-
}
|
|
58
|
-
function normalizeAzureEndpoint(endpoint) {
|
|
59
|
-
return endpoint.replace(/\/+$/, "").replace(/\/openai(\/v\d+)?$/, "");
|
|
60
|
-
}
|
|
61
|
-
function buildAzureOpenAIApiUrl(baseUrl, model, apiVersion) {
|
|
62
|
-
const endpoint = normalizeAzureEndpoint(baseUrl);
|
|
63
|
-
return `${endpoint}/openai/deployments/${model}/chat/completions?api-version=${apiVersion}`;
|
|
64
|
-
}
|
|
65
|
-
function buildOpenAIResponseApiUrl(baseUrl) {
|
|
66
|
-
const url = baseUrl.replace(/\/+$/, "");
|
|
67
|
-
if (url.endsWith("/responses")) {
|
|
68
|
-
return url;
|
|
69
|
-
}
|
|
70
|
-
if (/\/v\d+$/.test(url)) {
|
|
71
|
-
return url + "/responses";
|
|
72
|
-
}
|
|
73
|
-
return url + "/v1/responses";
|
|
74
|
-
}
|
|
75
|
-
var resolveProviderEndpoint = resolveProviderEndpointShared;
|
|
76
|
-
function buildProviderApiUrl(provider, options = {}) {
|
|
77
|
-
const format = resolveApiFormat(provider);
|
|
78
|
-
const { baseUrl } = resolveProviderEndpoint(provider);
|
|
79
|
-
switch (format) {
|
|
80
|
-
case "anthropic":
|
|
81
|
-
return buildAnthropicApiUrl(baseUrl);
|
|
82
|
-
case "google":
|
|
83
|
-
return buildGeminiApiUrl(baseUrl, options.model || "", options.stream || false);
|
|
84
|
-
case "azure-openai":
|
|
85
|
-
return buildAzureOpenAIApiUrl(baseUrl, options.model || "", provider.apiVersion || "2024-08-01-preview");
|
|
86
|
-
case "openai-response":
|
|
87
|
-
return buildOpenAIResponseApiUrl(baseUrl);
|
|
88
|
-
case "openai":
|
|
89
|
-
default:
|
|
90
|
-
return buildOpenAIApiUrl(baseUrl);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
buildAnthropicApiUrl,
|
|
3
|
+
buildAzureOpenAIApiUrl,
|
|
4
|
+
buildGeminiApiUrl,
|
|
5
|
+
buildGeminiModelActionUrl,
|
|
6
|
+
buildOpenAIApiUrl,
|
|
7
|
+
buildOpenAIResponseApiUrl,
|
|
8
|
+
buildProviderApiUrl,
|
|
9
|
+
normalizeAzureEndpoint,
|
|
10
|
+
resolveApiFormat,
|
|
11
|
+
resolveProviderEndpoint
|
|
12
|
+
} from "../chunk-H5JUT3KV.js";
|
|
93
13
|
export {
|
|
94
14
|
buildAnthropicApiUrl,
|
|
95
15
|
buildAzureOpenAIApiUrl,
|