@openrouter/sdk 1.2.140 → 1.2.141

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.
@@ -15,5 +15,5 @@ import { Result } from "../types/fp.js";
15
15
  * @remarks
16
16
  * Submits a Decisions request to the Decisions router
17
17
  */
18
- export declare function decisionsDecisions(client: OpenRouterCore, request: operations.CreateApiAlphaDecisionsRequest, options?: RequestOptions): APIPromise<Result<models.DecisionsResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.PaymentRequiredResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.PayloadTooLargeResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | errors.ServiceUnavailableResponseError | errors.EdgeNetworkTimeoutResponseError | errors.ProviderOverloadedResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
19
- //# sourceMappingURL=decisionsDecisions.d.ts.map
18
+ export declare function decisionsCreate(client: OpenRouterCore, request: operations.CreateApiAlphaDecisionsRequest, options?: RequestOptions): APIPromise<Result<models.DecisionsResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.PaymentRequiredResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.PayloadTooLargeResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | errors.ServiceUnavailableResponseError | errors.EdgeNetworkTimeoutResponseError | errors.ProviderOverloadedResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
19
+ //# sourceMappingURL=decisionsCreate.d.ts.map
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
- * @generated-id: fe612844275a
3
+ * @generated-id: 7779a2be874c
4
4
  */
5
5
  import { encodeJSON, encodeSimple } from "../lib/encodings.js";
6
6
  import { matchStatusCode } from "../lib/http.js";
@@ -19,7 +19,7 @@ import { APIPromise } from "../types/async.js";
19
19
  * @remarks
20
20
  * Submits a Decisions request to the Decisions router
21
21
  */
22
- export function decisionsDecisions(client, request, options) {
22
+ export function decisionsCreate(client, request, options) {
23
23
  return new APIPromise($do(client, request, options));
24
24
  }
25
25
  async function $do(client, request, options) {
@@ -95,4 +95,4 @@ async function $do(client, request, options) {
95
95
  }
96
96
  return [result, { status: "complete", request: req, response }];
97
97
  }
98
- //# sourceMappingURL=decisionsDecisions.js.map
98
+ //# sourceMappingURL=decisionsCreate.js.map
@@ -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.2.140";
53
+ readonly sdkVersion: "1.2.141";
54
54
  readonly genVersion: "2.914.0";
55
- readonly userAgent: "speakeasy-sdk/typescript 1.2.140 2.914.0 1.0.0 @openrouter/sdk";
55
+ readonly userAgent: "speakeasy-sdk/typescript 1.2.141 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.2.140",
32
+ sdkVersion: "1.2.141",
33
33
  genVersion: "2.914.0",
34
- userAgent: "speakeasy-sdk/typescript 1.2.140 2.914.0 1.0.0 @openrouter/sdk",
34
+ userAgent: "speakeasy-sdk/typescript 1.2.141 2.914.0 1.0.0 @openrouter/sdk",
35
35
  };
36
36
  //# sourceMappingURL=config.js.map
@@ -8,6 +8,12 @@ import { TraceConfig, TraceConfig$Outbound } from "./traceconfig.js";
8
8
  * A Decisions question using a boolean, choice, or ordered score evaluation.
9
9
  */
10
10
  export type Questions = DecisionsChoiceQuestion | DecisionsNoulQuestion | DecisionsScoreQuestion;
11
+ /**
12
+ * The content to evaluate: a plain string, or a JSON object or array of related context.
13
+ */
14
+ export type State = string | {
15
+ [k: string]: any;
16
+ } | Array<any>;
11
17
  export type DecisionsRequest = {
12
18
  model: string;
13
19
  provider?: ProviderPreferences | null | undefined;
@@ -18,7 +24,12 @@ export type DecisionsRequest = {
18
24
  * A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters.
19
25
  */
20
26
  sessionId?: string | undefined;
21
- state: any;
27
+ /**
28
+ * The content to evaluate: a plain string, or a JSON object or array of related context.
29
+ */
30
+ state: string | {
31
+ [k: string]: any;
32
+ } | Array<any>;
22
33
  /**
23
34
  * Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.
24
35
  */
@@ -31,6 +42,13 @@ export type Questions$Outbound = DecisionsChoiceQuestion$Outbound | DecisionsNou
31
42
  export declare const Questions$outboundSchema: z.ZodType<Questions$Outbound, Questions>;
32
43
  export declare function questionsToJSON(questions: Questions): string;
33
44
  /** @internal */
45
+ export type State$Outbound = string | {
46
+ [k: string]: any;
47
+ } | Array<any>;
48
+ /** @internal */
49
+ export declare const State$outboundSchema: z.ZodType<State$Outbound, State>;
50
+ export declare function stateToJSON(state: State): string;
51
+ /** @internal */
34
52
  export type DecisionsRequest$Outbound = {
35
53
  model: string;
36
54
  provider?: ProviderPreferences$Outbound | null | undefined;
@@ -38,7 +56,9 @@ export type DecisionsRequest$Outbound = {
38
56
  [k: string]: DecisionsChoiceQuestion$Outbound | DecisionsNoulQuestion$Outbound | DecisionsScoreQuestion$Outbound;
39
57
  };
40
58
  session_id?: string | undefined;
41
- state: any;
59
+ state: string | {
60
+ [k: string]: any;
61
+ } | Array<any>;
42
62
  trace?: TraceConfig$Outbound | undefined;
43
63
  user?: string | undefined;
44
64
  };
@@ -19,6 +19,15 @@ export function questionsToJSON(questions) {
19
19
  return JSON.stringify(Questions$outboundSchema.parse(questions));
20
20
  }
21
21
  /** @internal */
22
+ export const State$outboundSchema = z.union([
23
+ z.string(),
24
+ z.record(z.string(), z.any()),
25
+ z.array(z.any()),
26
+ ]);
27
+ export function stateToJSON(state) {
28
+ return JSON.stringify(State$outboundSchema.parse(state));
29
+ }
30
+ /** @internal */
22
31
  export const DecisionsRequest$outboundSchema = z.object({
23
32
  model: z.string(),
24
33
  provider: z.nullable(ProviderPreferences$outboundSchema).optional(),
@@ -28,7 +37,7 @@ export const DecisionsRequest$outboundSchema = z.object({
28
37
  DecisionsScoreQuestion$outboundSchema,
29
38
  ])),
30
39
  sessionId: z.string().optional(),
31
- state: z.any(),
40
+ state: z.union([z.string(), z.record(z.string(), z.any()), z.array(z.any())]),
32
41
  trace: TraceConfig$outboundSchema.optional(),
33
42
  user: z.string().optional(),
34
43
  }).transform((v) => {
@@ -8,6 +8,6 @@ export declare class Decisions extends ClientSDK {
8
8
  * @remarks
9
9
  * Submits a Decisions request to the Decisions router
10
10
  */
11
- decisions(request: operations.CreateApiAlphaDecisionsRequest, options?: RequestOptions): Promise<models.DecisionsResponse>;
11
+ create(request: operations.CreateApiAlphaDecisionsRequest, options?: RequestOptions): Promise<models.DecisionsResponse>;
12
12
  }
13
13
  //# sourceMappingURL=decisions.d.ts.map
@@ -2,7 +2,7 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  * @generated-id: 0e5d2e557690
4
4
  */
5
- import { decisionsDecisions } from "../funcs/decisionsDecisions.js";
5
+ import { decisionsCreate } from "../funcs/decisionsCreate.js";
6
6
  import { ClientSDK } from "../lib/sdks.js";
7
7
  import { unwrapAsync } from "../types/fp.js";
8
8
  export class Decisions extends ClientSDK {
@@ -12,8 +12,8 @@ export class Decisions extends ClientSDK {
12
12
  * @remarks
13
13
  * Submits a Decisions request to the Decisions router
14
14
  */
15
- async decisions(request, options) {
16
- return unwrapAsync(decisionsDecisions(this, request, options));
15
+ async create(request, options) {
16
+ return unwrapAsync(decisionsCreate(this, request, options));
17
17
  }
18
18
  }
19
19
  //# sourceMappingURL=decisions.js.map
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@openrouter/sdk",
5
- "version": "1.2.140",
5
+ "version": "1.2.141",
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.2.140",
3
+ "version": "1.2.141",
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
- "test": "vitest --run --project unit",
77
- "test:transit": "exit 0",
78
- "test:watch": "vitest --watch --project unit",
79
- "postinstall": "node scripts/check-types.js || true",
80
- "test:e2e": "vitest --run --project e2e",
81
- "typecheck": "tsc --noEmit",
82
76
  "typecheck:transit": "exit 0",
83
77
  "compile": "tsc",
84
- "prepare": "npm run build"
78
+ "postinstall": "node scripts/check-types.js || true",
79
+ "test:transit": "exit 0",
80
+ "prepare": "npm run build",
81
+ "test": "vitest --run --project unit",
82
+ "test:e2e": "vitest --run --project e2e",
83
+ "test:watch": "vitest --watch --project unit",
84
+ "typecheck": "tsc --noEmit"
85
85
  },
86
86
  "peerDependencies": {},
87
87
  "devDependencies": {