@openrouter/sdk 0.13.46 → 0.13.48
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/index.d.ts +1 -0
- package/esm/models/index.js +1 -0
- package/esm/models/pricingoverride.d.ts +44 -0
- package/esm/models/pricingoverride.js +30 -0
- package/esm/models/publicendpoint.d.ts +5 -0
- package/esm/models/publicendpoint.js +2 -0
- package/esm/models/publicpricing.d.ts +5 -0
- package/esm/models/publicpricing.js +2 -0
- package/jsr.json +1 -1
- package/package.json +9 -9
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.13.
|
|
52
|
+
readonly sdkVersion: "0.13.48";
|
|
53
53
|
readonly genVersion: "2.884.4";
|
|
54
|
-
readonly userAgent: "speakeasy-sdk/typescript 0.13.
|
|
54
|
+
readonly userAgent: "speakeasy-sdk/typescript 0.13.48 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.13.
|
|
29
|
+
sdkVersion: "0.13.48",
|
|
30
30
|
genVersion: "2.884.4",
|
|
31
|
-
userAgent: "speakeasy-sdk/typescript 0.13.
|
|
31
|
+
userAgent: "speakeasy-sdk/typescript 0.13.48 2.884.4 1.0.0 @openrouter/sdk",
|
|
32
32
|
};
|
|
33
33
|
//# sourceMappingURL=config.js.map
|
package/esm/models/index.d.ts
CHANGED
|
@@ -402,6 +402,7 @@ export * from "./presetwithdesignatedversion.js";
|
|
|
402
402
|
export * from "./preview20250311websearchservertool.js";
|
|
403
403
|
export * from "./previewwebsearchservertool.js";
|
|
404
404
|
export * from "./previewwebsearchuserlocation.js";
|
|
405
|
+
export * from "./pricingoverride.js";
|
|
405
406
|
export * from "./promptcachebreakpoint.js";
|
|
406
407
|
export * from "./promptcacheoptions.js";
|
|
407
408
|
export * from "./promptinjectionscanscope.js";
|
package/esm/models/index.js
CHANGED
|
@@ -406,6 +406,7 @@ export * from "./presetwithdesignatedversion.js";
|
|
|
406
406
|
export * from "./preview20250311websearchservertool.js";
|
|
407
407
|
export * from "./previewwebsearchservertool.js";
|
|
408
408
|
export * from "./previewwebsearchuserlocation.js";
|
|
409
|
+
export * from "./pricingoverride.js";
|
|
409
410
|
export * from "./promptcachebreakpoint.js";
|
|
410
411
|
export * from "./promptcacheoptions.js";
|
|
411
412
|
export * from "./promptinjectionscanscope.js";
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
* A conditional override of the base pricing. An entry applies only when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per price key; price keys absent from an entry inherit the base price.
|
|
6
|
+
*/
|
|
7
|
+
export type PricingOverride = {
|
|
8
|
+
/**
|
|
9
|
+
* Overridden price in USD per audio input token
|
|
10
|
+
*/
|
|
11
|
+
audio?: string | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Overridden price in USD per token for completion (output) generation
|
|
14
|
+
*/
|
|
15
|
+
completion?: string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Overridden price in USD per cached audio input token
|
|
18
|
+
*/
|
|
19
|
+
inputAudioCache?: string | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Overridden price in USD per cached input token (read)
|
|
22
|
+
*/
|
|
23
|
+
inputCacheRead?: string | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Overridden price in USD per cache-write token
|
|
26
|
+
*/
|
|
27
|
+
inputCacheWrite?: string | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Overridden price in USD per 1-hour cache-write token
|
|
30
|
+
*/
|
|
31
|
+
inputCacheWrite1h?: string | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Condition: the entry applies when the total prompt tokens of a request are strictly greater than this threshold
|
|
34
|
+
*/
|
|
35
|
+
minPromptTokens?: number | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Overridden price in USD per token for prompt (input) processing
|
|
38
|
+
*/
|
|
39
|
+
prompt?: string | undefined;
|
|
40
|
+
};
|
|
41
|
+
/** @internal */
|
|
42
|
+
export declare const PricingOverride$inboundSchema: z.ZodType<PricingOverride, unknown>;
|
|
43
|
+
export declare function pricingOverrideFromJSON(jsonString: string): SafeParseResult<PricingOverride, SDKValidationError>;
|
|
44
|
+
//# sourceMappingURL=pricingoverride.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: b1116f9327ef
|
|
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 PricingOverride$inboundSchema = z.object({
|
|
10
|
+
audio: z.string().optional(),
|
|
11
|
+
completion: z.string().optional(),
|
|
12
|
+
input_audio_cache: z.string().optional(),
|
|
13
|
+
input_cache_read: z.string().optional(),
|
|
14
|
+
input_cache_write: z.string().optional(),
|
|
15
|
+
input_cache_write_1h: z.string().optional(),
|
|
16
|
+
min_prompt_tokens: z.number().optional(),
|
|
17
|
+
prompt: z.string().optional(),
|
|
18
|
+
}).transform((v) => {
|
|
19
|
+
return remap$(v, {
|
|
20
|
+
"input_audio_cache": "inputAudioCache",
|
|
21
|
+
"input_cache_read": "inputCacheRead",
|
|
22
|
+
"input_cache_write": "inputCacheWrite",
|
|
23
|
+
"input_cache_write_1h": "inputCacheWrite1h",
|
|
24
|
+
"min_prompt_tokens": "minPromptTokens",
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
export function pricingOverrideFromJSON(jsonString) {
|
|
28
|
+
return safeParse(jsonString, (x) => PricingOverride$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PricingOverride' from JSON`);
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=pricingoverride.js.map
|
|
@@ -5,6 +5,7 @@ import { EndpointStatus } from "./endpointstatus.js";
|
|
|
5
5
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
6
6
|
import { Parameter } from "./parameter.js";
|
|
7
7
|
import { PercentileStats } from "./percentilestats.js";
|
|
8
|
+
import { PricingOverride } from "./pricingoverride.js";
|
|
8
9
|
import { ProviderName } from "./providername.js";
|
|
9
10
|
export type Pricing = {
|
|
10
11
|
/**
|
|
@@ -55,6 +56,10 @@ export type Pricing = {
|
|
|
55
56
|
* Price in USD per internal reasoning token
|
|
56
57
|
*/
|
|
57
58
|
internalReasoning?: string | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Conditional overrides of the base pricing (e.g. long-context pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions.
|
|
61
|
+
*/
|
|
62
|
+
overrides?: Array<PricingOverride> | undefined;
|
|
58
63
|
/**
|
|
59
64
|
* Price in USD per token for prompt (input) processing
|
|
60
65
|
*/
|
|
@@ -9,6 +9,7 @@ import * as openEnums from "../types/enums.js";
|
|
|
9
9
|
import { EndpointStatus$inboundSchema, } from "./endpointstatus.js";
|
|
10
10
|
import { Parameter$inboundSchema } from "./parameter.js";
|
|
11
11
|
import { PercentileStats$inboundSchema, } from "./percentilestats.js";
|
|
12
|
+
import { PricingOverride$inboundSchema, } from "./pricingoverride.js";
|
|
12
13
|
import { ProviderName$inboundSchema } from "./providername.js";
|
|
13
14
|
export const PublicEndpointQuantization = {
|
|
14
15
|
Int4: "int4",
|
|
@@ -35,6 +36,7 @@ export const Pricing$inboundSchema = z.object({
|
|
|
35
36
|
input_cache_write: z.string().optional(),
|
|
36
37
|
input_cache_write_1h: z.string().optional(),
|
|
37
38
|
internal_reasoning: z.string().optional(),
|
|
39
|
+
overrides: z.array(PricingOverride$inboundSchema).optional(),
|
|
38
40
|
prompt: z.string(),
|
|
39
41
|
request: z.string().optional(),
|
|
40
42
|
web_search: z.string().optional(),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
2
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
3
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
4
|
+
import { PricingOverride } from "./pricingoverride.js";
|
|
4
5
|
/**
|
|
5
6
|
* Pricing information for the model
|
|
6
7
|
*/
|
|
@@ -53,6 +54,10 @@ export type PublicPricing = {
|
|
|
53
54
|
* Price in USD per internal reasoning token
|
|
54
55
|
*/
|
|
55
56
|
internalReasoning?: string | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Conditional overrides of the base pricing (e.g. long-context pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions.
|
|
59
|
+
*/
|
|
60
|
+
overrides?: Array<PricingOverride> | undefined;
|
|
56
61
|
/**
|
|
57
62
|
* Price in USD per token for prompt (input) processing
|
|
58
63
|
*/
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
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
|
+
import { PricingOverride$inboundSchema, } from "./pricingoverride.js";
|
|
8
9
|
/** @internal */
|
|
9
10
|
export const PublicPricing$inboundSchema = z
|
|
10
11
|
.object({
|
|
@@ -20,6 +21,7 @@ export const PublicPricing$inboundSchema = z
|
|
|
20
21
|
input_cache_write: z.string().optional(),
|
|
21
22
|
input_cache_write_1h: z.string().optional(),
|
|
22
23
|
internal_reasoning: z.string().optional(),
|
|
24
|
+
overrides: z.array(PricingOverride$inboundSchema).optional(),
|
|
23
25
|
prompt: z.string(),
|
|
24
26
|
request: z.string().optional(),
|
|
25
27
|
web_search: z.string().optional(),
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrouter/sdk",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.48",
|
|
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",
|
|
75
75
|
"prepublishOnly": "npm run build",
|
|
76
|
-
"
|
|
77
|
-
"
|
|
76
|
+
"test:e2e": "vitest --run --project e2e",
|
|
77
|
+
"test:transit": "exit 0",
|
|
78
78
|
"typecheck": "tsc --noEmit",
|
|
79
|
-
"
|
|
79
|
+
"compile": "tsc",
|
|
80
80
|
"postinstall": "node scripts/check-types.js || true",
|
|
81
|
+
"prepare": "npm run build",
|
|
81
82
|
"test": "vitest --run --project unit",
|
|
82
|
-
"test:
|
|
83
|
-
"
|
|
84
|
-
"test:watch": "vitest --watch --project unit"
|
|
83
|
+
"test:watch": "vitest --watch --project unit",
|
|
84
|
+
"typecheck:transit": "exit 0"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {},
|
|
87
87
|
"devDependencies": {
|