@openrouter/sdk 1.2.140 → 1.2.142

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.142";
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.142 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.142",
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.142 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) => {
@@ -504,6 +504,10 @@ export type VideoGenerationRequest = {
504
504
  */
505
505
  inputReferences?: Array<InputReference> | undefined;
506
506
  model: string;
507
+ /**
508
+ * ID of a completed video job to edit or extend, as returned by the submit response. The new job runs on the same model and endpoint that produced the previous one. Only models that support continuation accept this field.
509
+ */
510
+ previousJobId?: string | undefined;
507
511
  /**
508
512
  * Text prompt describing the video to generate. Optional for models that support generating a video from image input alone; required by all other models.
509
513
  */
@@ -994,6 +998,7 @@ export type VideoGenerationRequest$Outbound = {
994
998
  generate_audio?: boolean | undefined;
995
999
  input_references?: Array<InputReference$Outbound> | undefined;
996
1000
  model: string;
1001
+ previous_job_id?: string | undefined;
997
1002
  prompt?: string | undefined;
998
1003
  provider?: VideoGenerationRequestProvider$Outbound | undefined;
999
1004
  resolution?: string | undefined;
@@ -237,6 +237,7 @@ export const VideoGenerationRequest$outboundSchema = z.object({
237
237
  generateAudio: z.boolean().optional(),
238
238
  inputReferences: z.array(InputReference$outboundSchema).optional(),
239
239
  model: z.string(),
240
+ previousJobId: z.string().optional(),
240
241
  prompt: z.string().optional(),
241
242
  provider: z.lazy(() => VideoGenerationRequestProvider$outboundSchema)
242
243
  .optional(),
@@ -254,6 +255,7 @@ export const VideoGenerationRequest$outboundSchema = z.object({
254
255
  frameImages: "frame_images",
255
256
  generateAudio: "generate_audio",
256
257
  inputReferences: "input_references",
258
+ previousJobId: "previous_job_id",
257
259
  sessionId: "session_id",
258
260
  upscaleFactor: "upscale_factor",
259
261
  });
@@ -18,6 +18,9 @@ export type VideoGenerationResponse = {
18
18
  * The generation ID associated with this video generation job. Available once the job has been processed.
19
19
  */
20
20
  generationId?: string | undefined;
21
+ /**
22
+ * The video job ID, in the `gen-vid-<timestamp>-<20 alphanumerics>` generation ID format. Pass it as `previous_job_id` to continue the generation.
23
+ */
21
24
  id: string;
22
25
  pollingUrl: string;
23
26
  status: VideoGenerationResponseStatus;
@@ -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.142",
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.142",
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",
76
+ "prepare": "npm run build",
77
+ "test:e2e": "vitest --run --project e2e",
77
78
  "test:transit": "exit 0",
78
- "test:watch": "vitest --watch --project unit",
79
+ "typecheck:transit": "exit 0",
79
80
  "postinstall": "node scripts/check-types.js || true",
80
- "test:e2e": "vitest --run --project e2e",
81
+ "test": "vitest --run --project unit",
82
+ "test:watch": "vitest --watch --project unit",
81
83
  "typecheck": "tsc --noEmit",
82
- "typecheck:transit": "exit 0",
83
- "compile": "tsc",
84
- "prepare": "npm run build"
84
+ "compile": "tsc"
85
85
  },
86
86
  "peerDependencies": {},
87
87
  "devDependencies": {