@openrouter/sdk 1.5.57 → 1.5.58
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/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/decisionsresponse.d.ts +12 -0
- package/esm/models/decisionsresponse.js +5 -0
- package/jsr.json +1 -1
- package/package.json +7 -7
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.5.
|
|
53
|
+
readonly sdkVersion: "1.5.58";
|
|
54
54
|
readonly genVersion: "2.950.13";
|
|
55
|
-
readonly userAgent: "speakeasy-sdk/typescript 1.5.
|
|
55
|
+
readonly userAgent: "speakeasy-sdk/typescript 1.5.58 2.950.13 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.5.
|
|
32
|
+
sdkVersion: "1.5.58",
|
|
33
33
|
genVersion: "2.950.13",
|
|
34
|
-
userAgent: "speakeasy-sdk/typescript 1.5.
|
|
34
|
+
userAgent: "speakeasy-sdk/typescript 1.5.58 2.950.13 1.0.0 @openrouter/sdk",
|
|
35
35
|
};
|
|
36
36
|
//# sourceMappingURL=config.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
2
|
import * as discriminatedUnionTypes from "../types/discriminatedUnion.js";
|
|
3
3
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
|
+
import { CostDetails } from "./costdetails.js";
|
|
4
5
|
import { DecisionsBoxAnswer } from "./decisionsboxanswer.js";
|
|
5
6
|
import { DecisionsChoiceAnswer } from "./decisionschoiceanswer.js";
|
|
6
7
|
import { DecisionsNoulAnswer } from "./decisionsnoulanswer.js";
|
|
@@ -14,12 +15,23 @@ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
|
14
15
|
*/
|
|
15
16
|
export type DecisionsResponseAnswers = DecisionsBoxAnswer | DecisionsChoiceAnswer | DecisionsNoulAnswer | DecisionsRefusalAnswer | DecisionsScoreAnswer | discriminatedUnionTypes.Unknown<"type">;
|
|
16
17
|
export type DecisionsResponseUsage = {
|
|
18
|
+
/**
|
|
19
|
+
* What OpenRouter charges for the request, in credits. On a BYOK request this is the OpenRouter fee only.
|
|
20
|
+
*/
|
|
17
21
|
cost?: number | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Breakdown of upstream inference costs
|
|
24
|
+
*/
|
|
25
|
+
costDetails?: CostDetails | null | undefined;
|
|
18
26
|
inputTokens: number;
|
|
19
27
|
/**
|
|
20
28
|
* Of `input_tokens`, those the provider served from its prompt cache.
|
|
21
29
|
*/
|
|
22
30
|
inputTokensDetails?: DecisionsUsageInputTokensDetails | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Whether a request was made using a Bring Your Own Key configuration
|
|
33
|
+
*/
|
|
34
|
+
isByok?: boolean | undefined;
|
|
23
35
|
outputTokens: number;
|
|
24
36
|
};
|
|
25
37
|
export type DecisionsResponse = {
|
|
@@ -6,6 +6,7 @@ import * as z from "zod/v4";
|
|
|
6
6
|
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
7
|
import { safeParse } from "../lib/schemas.js";
|
|
8
8
|
import { discriminatedUnion } from "../types/discriminatedUnion.js";
|
|
9
|
+
import { CostDetails$inboundSchema } from "./costdetails.js";
|
|
9
10
|
import { DecisionsBoxAnswer$inboundSchema, } from "./decisionsboxanswer.js";
|
|
10
11
|
import { DecisionsChoiceAnswer$inboundSchema, } from "./decisionschoiceanswer.js";
|
|
11
12
|
import { DecisionsNoulAnswer$inboundSchema, } from "./decisionsnoulanswer.js";
|
|
@@ -27,14 +28,18 @@ export function decisionsResponseAnswersFromJSON(jsonString) {
|
|
|
27
28
|
/** @internal */
|
|
28
29
|
export const DecisionsResponseUsage$inboundSchema = z.object({
|
|
29
30
|
cost: z.number().optional(),
|
|
31
|
+
cost_details: z.nullable(CostDetails$inboundSchema).optional(),
|
|
30
32
|
input_tokens: z.int(),
|
|
31
33
|
input_tokens_details: DecisionsUsageInputTokensDetails$inboundSchema
|
|
32
34
|
.optional(),
|
|
35
|
+
is_byok: z.boolean().optional(),
|
|
33
36
|
output_tokens: z.int(),
|
|
34
37
|
}).transform((v) => {
|
|
35
38
|
return remap$(v, {
|
|
39
|
+
"cost_details": "costDetails",
|
|
36
40
|
"input_tokens": "inputTokens",
|
|
37
41
|
"input_tokens_details": "inputTokensDetails",
|
|
42
|
+
"is_byok": "isByok",
|
|
38
43
|
"output_tokens": "outputTokens",
|
|
39
44
|
});
|
|
40
45
|
});
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrouter/sdk",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.58",
|
|
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": [
|
|
@@ -74,14 +74,14 @@
|
|
|
74
74
|
"build": "tsc && node scripts/unbarrel-imports.js",
|
|
75
75
|
"prepublishOnly": "npm run build",
|
|
76
76
|
"prepare": "npm run build",
|
|
77
|
-
"test:transit": "exit 0",
|
|
78
|
-
"test:watch": "vitest --watch --project unit",
|
|
79
|
-
"typecheck:transit": "exit 0",
|
|
80
|
-
"compile": "tsc && node scripts/unbarrel-imports.js",
|
|
81
77
|
"test": "vitest --run --project unit",
|
|
82
|
-
"test:
|
|
78
|
+
"test:watch": "vitest --watch --project unit",
|
|
83
79
|
"typecheck": "tsc --noEmit",
|
|
84
|
-
"postinstall": "node scripts/check-types.js || true"
|
|
80
|
+
"postinstall": "node scripts/check-types.js || true",
|
|
81
|
+
"test:e2e": "vitest --run --project e2e",
|
|
82
|
+
"test:transit": "exit 0",
|
|
83
|
+
"typecheck:transit": "exit 0",
|
|
84
|
+
"compile": "tsc && node scripts/unbarrel-imports.js"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
|