@openrouter/sdk 1.0.10 → 1.0.12

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.
@@ -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: "1.0.10";
52
+ readonly sdkVersion: "1.0.12";
53
53
  readonly genVersion: "2.914.0";
54
- readonly userAgent: "speakeasy-sdk/typescript 1.0.10 2.914.0 1.0.0 @openrouter/sdk";
54
+ readonly userAgent: "speakeasy-sdk/typescript 1.0.12 2.914.0 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: "1.0.10",
29
+ sdkVersion: "1.0.12",
30
30
  genVersion: "2.914.0",
31
- userAgent: "speakeasy-sdk/typescript 1.0.10 2.914.0 1.0.0 @openrouter/sdk",
31
+ userAgent: "speakeasy-sdk/typescript 1.0.12 2.914.0 1.0.0 @openrouter/sdk",
32
32
  };
33
33
  //# sourceMappingURL=config.js.map
@@ -13,6 +13,10 @@ export type AutoRouterPlugin = {
13
13
  */
14
14
  enabled?: boolean | undefined;
15
15
  id: "auto-router";
16
+ /**
17
+ * When true, reuses the model from the most recent assistant message's `model` attribute for subsequent turns. Defaults to false.
18
+ */
19
+ pinModel?: boolean | undefined;
16
20
  };
17
21
  /** @internal */
18
22
  export type AutoRouterPlugin$Outbound = {
@@ -20,6 +24,7 @@ export type AutoRouterPlugin$Outbound = {
20
24
  cost_quality_tradeoff?: number | undefined;
21
25
  enabled?: boolean | undefined;
22
26
  id: "auto-router";
27
+ pin_model?: boolean | undefined;
23
28
  };
24
29
  /** @internal */
25
30
  export declare const AutoRouterPlugin$outboundSchema: z.ZodType<AutoRouterPlugin$Outbound, AutoRouterPlugin>;
@@ -10,10 +10,12 @@ export const AutoRouterPlugin$outboundSchema = z.object({
10
10
  costQualityTradeoff: z.int().optional(),
11
11
  enabled: z.boolean().optional(),
12
12
  id: z.literal("auto-router"),
13
+ pinModel: z.boolean().optional(),
13
14
  }).transform((v) => {
14
15
  return remap$(v, {
15
16
  allowedModels: "allowed_models",
16
17
  costQualityTradeoff: "cost_quality_tradeoff",
18
+ pinModel: "pin_model",
17
19
  });
18
20
  });
19
21
  export function autoRouterPluginToJSON(autoRouterPlugin) {
@@ -31,6 +31,10 @@ export type ChatAssistantMessage = {
31
31
  * Generated images from image generation models
32
32
  */
33
33
  images?: Array<ChatAssistantImages> | undefined;
34
+ /**
35
+ * Model that generated this assistant message
36
+ */
37
+ model?: string | undefined;
34
38
  /**
35
39
  * Optional name for the assistant
36
40
  */
@@ -72,6 +76,7 @@ export type ChatAssistantMessage$Outbound = {
72
76
  audio?: ChatAudioOutput$Outbound | undefined;
73
77
  content?: string | Array<ChatContentItems$Outbound> | null | undefined;
74
78
  images?: Array<ChatAssistantImages$Outbound> | undefined;
79
+ model?: string | undefined;
75
80
  name?: string | undefined;
76
81
  reasoning?: string | null | undefined;
77
82
  reasoning_details?: Array<ReasoningDetailUnion$Outbound> | undefined;
@@ -32,6 +32,7 @@ export const ChatAssistantMessage$inboundSchema = z.object({
32
32
  audio: ChatAudioOutput$inboundSchema.optional(),
33
33
  content: z.nullable(z.union([z.string(), z.array(ChatContentItems$inboundSchema)])).optional(),
34
34
  images: z.array(ChatAssistantImages$inboundSchema).optional(),
35
+ model: z.string().optional(),
35
36
  name: z.string().optional(),
36
37
  reasoning: z.nullable(z.string()).optional(),
37
38
  reasoning_details: z.array(ReasoningDetailUnion$inboundSchema).optional(),
@@ -49,6 +50,7 @@ export const ChatAssistantMessage$outboundSchema = z.object({
49
50
  audio: ChatAudioOutput$outboundSchema.optional(),
50
51
  content: z.nullable(z.union([z.string(), z.array(ChatContentItems$outboundSchema)])).optional(),
51
52
  images: z.array(ChatAssistantImages$outboundSchema).optional(),
53
+ model: z.string().optional(),
52
54
  name: z.string().optional(),
53
55
  reasoning: z.nullable(z.string()).optional(),
54
56
  reasoningDetails: z.array(ReasoningDetailUnion$outboundSchema).optional(),
@@ -1,14 +1,14 @@
1
1
  import * as z from "zod/v4";
2
2
  import { OpenEnum } from "../types/enums.js";
3
3
  /**
4
- * Price source for the Pareto frontier cost axis. "prompt" uses catalog list price (endpoint.pricing.prompt). "weighted_avg" uses traffic-weighted effective input price from ClickHouse, falling back to prompt price for models without traffic data. Defaults to "prompt".
4
+ * Price source for the Pareto frontier cost axis and for enforcing max_price. "prompt" uses catalog list price (endpoint.pricing.prompt). "weighted_avg" uses traffic-weighted effective input price from ClickHouse, falling back to prompt price for models without traffic data. Defaults to "prompt".
5
5
  */
6
6
  export declare const PriceSource: {
7
7
  readonly Prompt: "prompt";
8
8
  readonly WeightedAvg: "weighted_avg";
9
9
  };
10
10
  /**
11
- * Price source for the Pareto frontier cost axis. "prompt" uses catalog list price (endpoint.pricing.prompt). "weighted_avg" uses traffic-weighted effective input price from ClickHouse, falling back to prompt price for models without traffic data. Defaults to "prompt".
11
+ * Price source for the Pareto frontier cost axis and for enforcing max_price. "prompt" uses catalog list price (endpoint.pricing.prompt). "weighted_avg" uses traffic-weighted effective input price from ClickHouse, falling back to prompt price for models without traffic data. Defaults to "prompt".
12
12
  */
13
13
  export type PriceSource = OpenEnum<typeof PriceSource>;
14
14
  export type ParetoRouterPlugin = {
@@ -18,11 +18,15 @@ export type ParetoRouterPlugin = {
18
18
  enabled?: boolean | undefined;
19
19
  id: "pareto-router";
20
20
  /**
21
- * Minimum coding quality score between 0 and 1. Maps to internal quality tiers: >= 0.66 high (top coding models), >= 0.33 medium (strong modern flagships), < 0.33 low (capable coders above the median). Omit to default to the highest tier (equivalent to >= 0.66).
21
+ * Maximum input price in USD per million tokens. When set, quality-tier selection (min_coding_score) is bypassed: the router computes the Pareto frontier over the top coding models and routes to the best-scoring frontier model priced at or below this cap, falling back through cheaper frontier models, then non-frontier models. Enforced against the price source given by price_source. Returns 404 when no candidate satisfies the cap.
22
+ */
23
+ maxPrice?: number | undefined;
24
+ /**
25
+ * Minimum coding quality score between 0 and 1. Maps to internal quality tiers: >= 0.66 → high (top coding models), >= 0.33 → medium (strong modern flagships), < 0.33 → low (capable coders above the median). Omit to default to the highest tier (equivalent to >= 0.66). Not used when max_price is set (price-based selection takes over).
22
26
  */
23
27
  minCodingScore?: number | undefined;
24
28
  /**
25
- * Price source for the Pareto frontier cost axis. "prompt" uses catalog list price (endpoint.pricing.prompt). "weighted_avg" uses traffic-weighted effective input price from ClickHouse, falling back to prompt price for models without traffic data. Defaults to "prompt".
29
+ * Price source for the Pareto frontier cost axis and for enforcing max_price. "prompt" uses catalog list price (endpoint.pricing.prompt). "weighted_avg" uses traffic-weighted effective input price from ClickHouse, falling back to prompt price for models without traffic data. Defaults to "prompt".
26
30
  */
27
31
  priceSource?: PriceSource | undefined;
28
32
  };
@@ -32,6 +36,7 @@ export declare const PriceSource$outboundSchema: z.ZodType<string, PriceSource>;
32
36
  export type ParetoRouterPlugin$Outbound = {
33
37
  enabled?: boolean | undefined;
34
38
  id: "pareto-router";
39
+ max_price?: number | undefined;
35
40
  min_coding_score?: number | undefined;
36
41
  price_source?: string | undefined;
37
42
  };
@@ -6,7 +6,7 @@ import * as z from "zod/v4";
6
6
  import { remap as remap$ } from "../lib/primitives.js";
7
7
  import * as openEnums from "../types/enums.js";
8
8
  /**
9
- * Price source for the Pareto frontier cost axis. "prompt" uses catalog list price (endpoint.pricing.prompt). "weighted_avg" uses traffic-weighted effective input price from ClickHouse, falling back to prompt price for models without traffic data. Defaults to "prompt".
9
+ * Price source for the Pareto frontier cost axis and for enforcing max_price. "prompt" uses catalog list price (endpoint.pricing.prompt). "weighted_avg" uses traffic-weighted effective input price from ClickHouse, falling back to prompt price for models without traffic data. Defaults to "prompt".
10
10
  */
11
11
  export const PriceSource = {
12
12
  Prompt: "prompt",
@@ -18,10 +18,12 @@ export const PriceSource$outboundSchema = openEnums.outboundSchema(PriceSource);
18
18
  export const ParetoRouterPlugin$outboundSchema = z.object({
19
19
  enabled: z.boolean().optional(),
20
20
  id: z.literal("pareto-router"),
21
+ maxPrice: z.number().optional(),
21
22
  minCodingScore: z.number().optional(),
22
23
  priceSource: PriceSource$outboundSchema.optional(),
23
24
  }).transform((v) => {
24
25
  return remap$(v, {
26
+ maxPrice: "max_price",
25
27
  minCodingScore: "min_coding_score",
26
28
  priceSource: "price_source",
27
29
  });
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@openrouter/sdk",
5
- "version": "1.0.10",
5
+ "version": "1.0.12",
6
6
  "exports": {
7
7
  ".": "./src/index.ts",
8
8
  "./models/errors": "./src/models/errors/index.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openrouter/sdk",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
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": [
@@ -73,15 +73,15 @@
73
73
  "lint": "eslint --cache --max-warnings=0 src",
74
74
  "build": "tsc",
75
75
  "prepublishOnly": "npm run build",
76
+ "compile": "tsc",
76
77
  "postinstall": "node scripts/check-types.js || true",
77
78
  "test": "vitest --run --project unit",
78
- "test:e2e": "vitest --run --project e2e",
79
79
  "test:transit": "exit 0",
80
80
  "test:watch": "vitest --watch --project unit",
81
+ "prepare": "npm run build",
82
+ "test:e2e": "vitest --run --project e2e",
81
83
  "typecheck": "tsc --noEmit",
82
- "typecheck:transit": "exit 0",
83
- "compile": "tsc",
84
- "prepare": "npm run build"
84
+ "typecheck:transit": "exit 0"
85
85
  },
86
86
  "peerDependencies": {},
87
87
  "devDependencies": {