@openrouter/sdk 1.3.32 → 1.3.34
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/esm/funcs/embeddingsGenerate.d.ts +1 -1
- package/esm/funcs/embeddingsGenerate.js +2 -2
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/anthropicwebfetchtoolresulterror.d.ts +1 -0
- package/esm/models/anthropicwebfetchtoolresulterror.js +1 -0
- package/esm/models/messagesmessageparam.d.ts +1 -0
- package/esm/models/messagesmessageparam.js +1 -0
- package/esm/models/publicendpoint.d.ts +15 -0
- package/esm/models/publicendpoint.js +10 -0
- package/jsr.json +1 -1
- package/package.json +7 -7
|
@@ -14,5 +14,5 @@ import { Result } from "../types/fp.js";
|
|
|
14
14
|
* @remarks
|
|
15
15
|
* Submits an embedding request to the embeddings router
|
|
16
16
|
*/
|
|
17
|
-
export declare function embeddingsGenerate(client: OpenRouterCore, request: operations.CreateEmbeddingsRequest, options?: RequestOptions): APIPromise<Result<operations.CreateEmbeddingsResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.PaymentRequiredResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.RequestTimeoutResponseError | errors.PayloadTooLargeResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | errors.ServiceUnavailableResponseError | errors.EdgeNetworkTimeoutResponseError | errors.ProviderOverloadedResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
17
|
+
export declare function embeddingsGenerate(client: OpenRouterCore, request: operations.CreateEmbeddingsRequest, options?: RequestOptions): APIPromise<Result<operations.CreateEmbeddingsResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.PaymentRequiredResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.RequestTimeoutResponseError | errors.PayloadTooLargeResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | errors.ServiceUnavailableResponseError | errors.GatewayTimeoutResponseError | errors.EdgeNetworkTimeoutResponseError | errors.ProviderOverloadedResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
18
18
|
//# sourceMappingURL=embeddingsGenerate.d.ts.map
|
|
@@ -9,7 +9,7 @@ import { compactMap } from "../lib/primitives.js";
|
|
|
9
9
|
import { safeParse } from "../lib/schemas.js";
|
|
10
10
|
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
11
|
import { pathToFunc } from "../lib/url.js";
|
|
12
|
-
import { BadGatewayResponseError$inboundSchema as errors_BadGatewayResponseError$inboundSchema } from "../models/errors/badgatewayresponseerror.js"; import { BadRequestResponseError$inboundSchema as errors_BadRequestResponseError$inboundSchema } from "../models/errors/badrequestresponseerror.js"; import { EdgeNetworkTimeoutResponseError$inboundSchema as errors_EdgeNetworkTimeoutResponseError$inboundSchema } from "../models/errors/edgenetworktimeoutresponseerror.js"; import { ForbiddenResponseError$inboundSchema as errors_ForbiddenResponseError$inboundSchema } from "../models/errors/forbiddenresponseerror.js"; import { InternalServerResponseError$inboundSchema as errors_InternalServerResponseError$inboundSchema } from "../models/errors/internalserverresponseerror.js"; import { NotFoundResponseError$inboundSchema as errors_NotFoundResponseError$inboundSchema } from "../models/errors/notfoundresponseerror.js"; import { PayloadTooLargeResponseError$inboundSchema as errors_PayloadTooLargeResponseError$inboundSchema } from "../models/errors/payloadtoolargeresponseerror.js"; import { PaymentRequiredResponseError$inboundSchema as errors_PaymentRequiredResponseError$inboundSchema } from "../models/errors/paymentrequiredresponseerror.js"; import { ProviderOverloadedResponseError$inboundSchema as errors_ProviderOverloadedResponseError$inboundSchema } from "../models/errors/provideroverloadedresponseerror.js"; import { RequestTimeoutResponseError$inboundSchema as errors_RequestTimeoutResponseError$inboundSchema } from "../models/errors/requesttimeoutresponseerror.js"; import { ServiceUnavailableResponseError$inboundSchema as errors_ServiceUnavailableResponseError$inboundSchema } from "../models/errors/serviceunavailableresponseerror.js"; import { TooManyRequestsResponseError$inboundSchema as errors_TooManyRequestsResponseError$inboundSchema } from "../models/errors/toomanyrequestsresponseerror.js"; import { UnauthorizedResponseError$inboundSchema as errors_UnauthorizedResponseError$inboundSchema } from "../models/errors/unauthorizedresponseerror.js";
|
|
12
|
+
import { BadGatewayResponseError$inboundSchema as errors_BadGatewayResponseError$inboundSchema } from "../models/errors/badgatewayresponseerror.js"; import { BadRequestResponseError$inboundSchema as errors_BadRequestResponseError$inboundSchema } from "../models/errors/badrequestresponseerror.js"; import { EdgeNetworkTimeoutResponseError$inboundSchema as errors_EdgeNetworkTimeoutResponseError$inboundSchema } from "../models/errors/edgenetworktimeoutresponseerror.js"; import { ForbiddenResponseError$inboundSchema as errors_ForbiddenResponseError$inboundSchema } from "../models/errors/forbiddenresponseerror.js"; import { GatewayTimeoutResponseError$inboundSchema as errors_GatewayTimeoutResponseError$inboundSchema } from "../models/errors/gatewaytimeoutresponseerror.js"; import { InternalServerResponseError$inboundSchema as errors_InternalServerResponseError$inboundSchema } from "../models/errors/internalserverresponseerror.js"; import { NotFoundResponseError$inboundSchema as errors_NotFoundResponseError$inboundSchema } from "../models/errors/notfoundresponseerror.js"; import { PayloadTooLargeResponseError$inboundSchema as errors_PayloadTooLargeResponseError$inboundSchema } from "../models/errors/payloadtoolargeresponseerror.js"; import { PaymentRequiredResponseError$inboundSchema as errors_PaymentRequiredResponseError$inboundSchema } from "../models/errors/paymentrequiredresponseerror.js"; import { ProviderOverloadedResponseError$inboundSchema as errors_ProviderOverloadedResponseError$inboundSchema } from "../models/errors/provideroverloadedresponseerror.js"; import { RequestTimeoutResponseError$inboundSchema as errors_RequestTimeoutResponseError$inboundSchema } from "../models/errors/requesttimeoutresponseerror.js"; import { ServiceUnavailableResponseError$inboundSchema as errors_ServiceUnavailableResponseError$inboundSchema } from "../models/errors/serviceunavailableresponseerror.js"; import { TooManyRequestsResponseError$inboundSchema as errors_TooManyRequestsResponseError$inboundSchema } from "../models/errors/toomanyrequestsresponseerror.js"; import { UnauthorizedResponseError$inboundSchema as errors_UnauthorizedResponseError$inboundSchema } from "../models/errors/unauthorizedresponseerror.js";
|
|
13
13
|
import { CreateEmbeddingsRequest$outboundSchema as operations_CreateEmbeddingsRequest$outboundSchema, CreateEmbeddingsResponse$inboundSchema as operations_CreateEmbeddingsResponse$inboundSchema } from "../models/operations/createembeddings.js";
|
|
14
14
|
import { APIPromise } from "../types/async.js";
|
|
15
15
|
/**
|
|
@@ -90,7 +90,7 @@ async function $do(client, request, options) {
|
|
|
90
90
|
};
|
|
91
91
|
const [result] = await M.match(M.json(200, operations_CreateEmbeddingsResponse$inboundSchema), M.text(200, operations_CreateEmbeddingsResponse$inboundSchema, {
|
|
92
92
|
ctype: "text/event-stream",
|
|
93
|
-
}), M.jsonErr(400, errors_BadRequestResponseError$inboundSchema), M.jsonErr(401, errors_UnauthorizedResponseError$inboundSchema), M.jsonErr(402, errors_PaymentRequiredResponseError$inboundSchema), M.jsonErr(403, errors_ForbiddenResponseError$inboundSchema), M.jsonErr(404, errors_NotFoundResponseError$inboundSchema), M.jsonErr(408, errors_RequestTimeoutResponseError$inboundSchema), M.jsonErr(413, errors_PayloadTooLargeResponseError$inboundSchema), M.jsonErr(429, errors_TooManyRequestsResponseError$inboundSchema), M.jsonErr(500, errors_InternalServerResponseError$inboundSchema), M.jsonErr(502, errors_BadGatewayResponseError$inboundSchema), M.jsonErr(503, errors_ServiceUnavailableResponseError$inboundSchema), M.jsonErr(524, errors_EdgeNetworkTimeoutResponseError$inboundSchema), M.jsonErr(529, errors_ProviderOverloadedResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
93
|
+
}), M.jsonErr(400, errors_BadRequestResponseError$inboundSchema), M.jsonErr(401, errors_UnauthorizedResponseError$inboundSchema), M.jsonErr(402, errors_PaymentRequiredResponseError$inboundSchema), M.jsonErr(403, errors_ForbiddenResponseError$inboundSchema), M.jsonErr(404, errors_NotFoundResponseError$inboundSchema), M.jsonErr(408, errors_RequestTimeoutResponseError$inboundSchema), M.jsonErr(413, errors_PayloadTooLargeResponseError$inboundSchema), M.jsonErr(429, errors_TooManyRequestsResponseError$inboundSchema), M.jsonErr(500, errors_InternalServerResponseError$inboundSchema), M.jsonErr(502, errors_BadGatewayResponseError$inboundSchema), M.jsonErr(503, errors_ServiceUnavailableResponseError$inboundSchema), M.jsonErr(504, errors_GatewayTimeoutResponseError$inboundSchema), M.jsonErr(524, errors_EdgeNetworkTimeoutResponseError$inboundSchema), M.jsonErr(529, errors_ProviderOverloadedResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
94
94
|
if (!result.ok) {
|
|
95
95
|
return [result, { status: "complete", request: req, response }];
|
|
96
96
|
}
|
package/esm/lib/config.d.ts
CHANGED
|
@@ -50,8 +50,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
50
50
|
export declare const SDK_METADATA: {
|
|
51
51
|
readonly language: "typescript";
|
|
52
52
|
readonly openapiDocVersion: "1.0.0";
|
|
53
|
-
readonly sdkVersion: "1.3.
|
|
53
|
+
readonly sdkVersion: "1.3.34";
|
|
54
54
|
readonly genVersion: "2.914.0";
|
|
55
|
-
readonly userAgent: "speakeasy-sdk/typescript 1.3.
|
|
55
|
+
readonly userAgent: "speakeasy-sdk/typescript 1.3.34 2.914.0 1.0.0 @openrouter/sdk";
|
|
56
56
|
};
|
|
57
57
|
//# sourceMappingURL=config.d.ts.map
|
package/esm/lib/config.js
CHANGED
|
@@ -29,8 +29,8 @@ export function serverURLFromOptions(options) {
|
|
|
29
29
|
export const SDK_METADATA = {
|
|
30
30
|
language: "typescript",
|
|
31
31
|
openapiDocVersion: "1.0.0",
|
|
32
|
-
sdkVersion: "1.3.
|
|
32
|
+
sdkVersion: "1.3.34",
|
|
33
33
|
genVersion: "2.914.0",
|
|
34
|
-
userAgent: "speakeasy-sdk/typescript 1.3.
|
|
34
|
+
userAgent: "speakeasy-sdk/typescript 1.3.34 2.914.0 1.0.0 @openrouter/sdk",
|
|
35
35
|
};
|
|
36
36
|
//# sourceMappingURL=config.js.map
|
|
@@ -6,6 +6,7 @@ export declare const AnthropicWebFetchToolResultErrorErrorCode: {
|
|
|
6
6
|
readonly InvalidToolInput: "invalid_tool_input";
|
|
7
7
|
readonly UrlTooLong: "url_too_long";
|
|
8
8
|
readonly UrlNotAllowed: "url_not_allowed";
|
|
9
|
+
readonly UrlNotInPriorContext: "url_not_in_prior_context";
|
|
9
10
|
readonly UrlNotAccessible: "url_not_accessible";
|
|
10
11
|
readonly UnsupportedContentType: "unsupported_content_type";
|
|
11
12
|
readonly TooManyRequests: "too_many_requests";
|
|
@@ -10,6 +10,7 @@ export const AnthropicWebFetchToolResultErrorErrorCode = {
|
|
|
10
10
|
InvalidToolInput: "invalid_tool_input",
|
|
11
11
|
UrlTooLong: "url_too_long",
|
|
12
12
|
UrlNotAllowed: "url_not_allowed",
|
|
13
|
+
UrlNotInPriorContext: "url_not_in_prior_context",
|
|
13
14
|
UrlNotAccessible: "url_not_accessible",
|
|
14
15
|
UnsupportedContentType: "unsupported_content_type",
|
|
15
16
|
TooManyRequests: "too_many_requests",
|
|
@@ -28,6 +28,7 @@ export declare const MessagesMessageParamErrorCode: {
|
|
|
28
28
|
readonly MaxUsesExceeded: "max_uses_exceeded";
|
|
29
29
|
readonly TooManyRequests: "too_many_requests";
|
|
30
30
|
readonly QueryTooLong: "query_too_long";
|
|
31
|
+
readonly RequestTooLarge: "request_too_large";
|
|
31
32
|
};
|
|
32
33
|
export type MessagesMessageParamErrorCode = OpenEnum<typeof MessagesMessageParamErrorCode>;
|
|
33
34
|
export declare const MessagesMessageParamTypeWebSearchToolResultError: {
|
|
@@ -24,6 +24,7 @@ export const MessagesMessageParamErrorCode = {
|
|
|
24
24
|
MaxUsesExceeded: "max_uses_exceeded",
|
|
25
25
|
TooManyRequests: "too_many_requests",
|
|
26
26
|
QueryTooLong: "query_too_long",
|
|
27
|
+
RequestTooLarge: "request_too_large",
|
|
27
28
|
};
|
|
28
29
|
export const MessagesMessageParamTypeWebSearchToolResultError = {
|
|
29
30
|
WebSearchToolResultError: "web_search_tool_result_error",
|
|
@@ -8,6 +8,12 @@ import { PricingOverride } from "./pricingoverride.js";
|
|
|
8
8
|
import { ProviderName } from "./providername.js";
|
|
9
9
|
import { Quantization } from "./quantization.js";
|
|
10
10
|
import { ToolChoiceSupport } from "./toolchoicesupport.js";
|
|
11
|
+
export type NativeTools = {
|
|
12
|
+
/**
|
|
13
|
+
* The provider tool type the request is translated to when this tool runs natively, e.g. `web_search_20260209` on Anthropic or `google_search` on Gemini.
|
|
14
|
+
*/
|
|
15
|
+
type: string;
|
|
16
|
+
};
|
|
11
17
|
export type Decisions = {
|
|
12
18
|
latency: PercentileStats | null;
|
|
13
19
|
/**
|
|
@@ -180,6 +186,12 @@ export type PublicEndpoint = {
|
|
|
180
186
|
modelId: string;
|
|
181
187
|
modelName: string;
|
|
182
188
|
name: string;
|
|
189
|
+
/**
|
|
190
|
+
* The server tools this endpoint accepts as the provider's own built-in tool (`engine: "native"`) instead of an OpenRouter engine, keyed by canonical `openrouter:*` name. Each value names the provider tool type the request is translated to. Where that tool runs (provider-side, or returned to the client as with Anthropic bash) is documented per tool. Empty when the provider has none.
|
|
191
|
+
*/
|
|
192
|
+
nativeTools: {
|
|
193
|
+
[k: string]: NativeTools;
|
|
194
|
+
};
|
|
183
195
|
/**
|
|
184
196
|
* Endpoint performance over the last 30 minutes, keyed by the kind of request served (e.g. `text_generation`, `image_generation`). Additive to the legacy singular latency and throughput fields; image and video generation report end-to-end latency. Only visible when authenticated with an API key or cookie.
|
|
185
197
|
*/
|
|
@@ -219,6 +231,9 @@ export type PublicEndpoint = {
|
|
|
219
231
|
uptimeLast5m: number | null;
|
|
220
232
|
};
|
|
221
233
|
/** @internal */
|
|
234
|
+
export declare const NativeTools$inboundSchema: z.ZodType<NativeTools, unknown>;
|
|
235
|
+
export declare function nativeToolsFromJSON(jsonString: string): SafeParseResult<NativeTools, SDKValidationError>;
|
|
236
|
+
/** @internal */
|
|
222
237
|
export declare const Decisions$inboundSchema: z.ZodType<Decisions, unknown>;
|
|
223
238
|
export declare function decisionsFromJSON(jsonString: string): SafeParseResult<Decisions, SDKValidationError>;
|
|
224
239
|
/** @internal */
|
|
@@ -13,6 +13,14 @@ import { ProviderName$inboundSchema } from "./providername.js";
|
|
|
13
13
|
import { Quantization$inboundSchema } from "./quantization.js";
|
|
14
14
|
import { ToolChoiceSupport$inboundSchema, } from "./toolchoicesupport.js";
|
|
15
15
|
/** @internal */
|
|
16
|
+
export const NativeTools$inboundSchema = z
|
|
17
|
+
.object({
|
|
18
|
+
type: z.string(),
|
|
19
|
+
});
|
|
20
|
+
export function nativeToolsFromJSON(jsonString) {
|
|
21
|
+
return safeParse(jsonString, (x) => NativeTools$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'NativeTools' from JSON`);
|
|
22
|
+
}
|
|
23
|
+
/** @internal */
|
|
16
24
|
export const Decisions$inboundSchema = z.object({
|
|
17
25
|
latency: z.nullable(PercentileStats$inboundSchema),
|
|
18
26
|
request_count: z.nullable(z.int()),
|
|
@@ -194,6 +202,7 @@ export const PublicEndpoint$inboundSchema = z.object({
|
|
|
194
202
|
model_id: z.string(),
|
|
195
203
|
model_name: z.string(),
|
|
196
204
|
name: z.string(),
|
|
205
|
+
native_tools: z.record(z.string(), z.lazy(() => NativeTools$inboundSchema)),
|
|
197
206
|
perf_last_30m_by_workload: z.lazy(() => PerfLast30mByWorkload$inboundSchema)
|
|
198
207
|
.optional(),
|
|
199
208
|
pricing: z.lazy(() => Pricing$inboundSchema),
|
|
@@ -219,6 +228,7 @@ export const PublicEndpoint$inboundSchema = z.object({
|
|
|
219
228
|
"max_prompt_tokens": "maxPromptTokens",
|
|
220
229
|
"model_id": "modelId",
|
|
221
230
|
"model_name": "modelName",
|
|
231
|
+
"native_tools": "nativeTools",
|
|
222
232
|
"perf_last_30m_by_workload": "perfLast30mByWorkload",
|
|
223
233
|
"provider_name": "providerName",
|
|
224
234
|
"supported_parameters": "supportedParameters",
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrouter/sdk",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.34",
|
|
4
4
|
"author": "OpenRouter",
|
|
5
5
|
"description": "The OpenRouter TypeScript SDK is a type-safe toolkit for building AI applications with access to 400+ language models through a unified API.",
|
|
6
6
|
"keywords": [
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"packageManager": "pnpm@10.22.0",
|
|
23
23
|
"publishConfig": {
|
|
24
|
-
"
|
|
25
|
-
"
|
|
24
|
+
"provenance": true,
|
|
25
|
+
"access": "public"
|
|
26
26
|
},
|
|
27
27
|
"type": "module",
|
|
28
28
|
"main": "./esm/index.js",
|
|
@@ -73,15 +73,15 @@
|
|
|
73
73
|
"lint": "eslint --cache --max-warnings=0 src",
|
|
74
74
|
"build": "tsc && node scripts/unbarrel-imports.js",
|
|
75
75
|
"prepublishOnly": "npm run build",
|
|
76
|
-
"
|
|
77
|
-
"test:transit": "exit 0",
|
|
78
|
-
"test:watch": "vitest --watch --project unit",
|
|
76
|
+
"typecheck": "tsc --noEmit",
|
|
79
77
|
"typecheck:transit": "exit 0",
|
|
80
78
|
"compile": "tsc && node scripts/unbarrel-imports.js",
|
|
81
79
|
"postinstall": "node scripts/check-types.js || true",
|
|
82
80
|
"prepare": "npm run build",
|
|
83
81
|
"test": "vitest --run --project unit",
|
|
84
|
-
"
|
|
82
|
+
"test:e2e": "vitest --run --project e2e",
|
|
83
|
+
"test:transit": "exit 0",
|
|
84
|
+
"test:watch": "vitest --watch --project unit"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
|