@openrouter/sdk 1.2.24 → 1.2.25

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.
@@ -10,7 +10,7 @@ import * as operations from "../models/operations/index.js";
10
10
  import { APIPromise } from "../types/async.js";
11
11
  import { Result } from "../types/fp.js";
12
12
  /**
13
- * Get stored prompt and completion content for a generation
13
+ * Get stored prompt, completion, and error content for a generation
14
14
  */
15
15
  export declare function generationsListGenerationContent(client: OpenRouterCore, request: operations.ListGenerationContentRequest, options?: RequestOptions): APIPromise<Result<models.GenerationContentResponse, errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | errors.EdgeNetworkTimeoutResponseError | errors.ProviderOverloadedResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
16
16
  //# sourceMappingURL=generationsListGenerationContent.d.ts.map
@@ -14,7 +14,7 @@ import * as models from "../models/index.js";
14
14
  import * as operations from "../models/operations/index.js";
15
15
  import { APIPromise } from "../types/async.js";
16
16
  /**
17
- * Get stored prompt and completion content for a generation
17
+ * Get stored prompt, completion, and error content for a generation
18
18
  */
19
19
  export function generationsListGenerationContent(client, request, options) {
20
20
  return new APIPromise($do(client, request, options));
@@ -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.2.24";
52
+ readonly sdkVersion: "1.2.25";
53
53
  readonly genVersion: "2.914.0";
54
- readonly userAgent: "speakeasy-sdk/typescript 1.2.24 2.914.0 1.0.0 @openrouter/sdk";
54
+ readonly userAgent: "speakeasy-sdk/typescript 1.2.25 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.2.24",
29
+ sdkVersion: "1.2.25",
30
30
  genVersion: "2.914.0",
31
- userAgent: "speakeasy-sdk/typescript 1.2.24 2.914.0 1.0.0 @openrouter/sdk",
31
+ userAgent: "speakeasy-sdk/typescript 1.2.25 2.914.0 1.0.0 @openrouter/sdk",
32
32
  };
33
33
  //# sourceMappingURL=config.js.map
@@ -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 { GenerationContentError } from "./generationcontenterror.js";
4
5
  export type Input2 = {
5
6
  messages: Array<any>;
6
7
  };
@@ -25,9 +26,13 @@ export type GenerationContentDataOutput = {
25
26
  reasoning: string | null;
26
27
  };
27
28
  /**
28
- * Stored prompt and completion content
29
+ * Stored prompt and completion content, plus the failure error when one was stored
29
30
  */
30
31
  export type GenerationContentData = {
32
+ /**
33
+ * The stored failure for this generation, or null when it succeeded
34
+ */
35
+ error: GenerationContentError | null;
31
36
  /**
32
37
  * The input to the generation — either a prompt string or an array of messages
33
38
  */
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import * as z from "zod/v4";
6
6
  import { safeParse } from "../lib/schemas.js";
7
+ import { GenerationContentError$inboundSchema, } from "./generationcontenterror.js";
7
8
  /** @internal */
8
9
  export const Input2$inboundSchema = z.object({
9
10
  messages: z.array(z.any()),
@@ -33,6 +34,7 @@ export function generationContentDataOutputFromJSON(jsonString) {
33
34
  }
34
35
  /** @internal */
35
36
  export const GenerationContentData$inboundSchema = z.object({
37
+ error: z.nullable(GenerationContentError$inboundSchema),
36
38
  input: z.union([
37
39
  z.lazy(() => Input1$inboundSchema),
38
40
  z.lazy(() => Input2$inboundSchema),
@@ -0,0 +1,33 @@
1
+ import * as z from "zod/v4";
2
+ import { Result as SafeParseResult } from "../types/fp.js";
3
+ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
4
+ import { GenerationContentErrorAttempt } from "./generationcontenterrorattempt.js";
5
+ /**
6
+ * The stored failure for this generation, or null when it succeeded
7
+ */
8
+ export type GenerationContentError = {
9
+ /**
10
+ * Error message returned to the client
11
+ */
12
+ message: string | null;
13
+ /**
14
+ * Every upstream attempt that failed before the returned error, in attempt order
15
+ */
16
+ previousErrors: Array<GenerationContentErrorAttempt>;
17
+ /**
18
+ * Provider whose error was returned to the client, when known
19
+ */
20
+ providerName: string | null;
21
+ /**
22
+ * Raw error body behind the returned error, when stored
23
+ */
24
+ raw: string | null;
25
+ /**
26
+ * HTTP status returned to the client
27
+ */
28
+ status: number | null;
29
+ };
30
+ /** @internal */
31
+ export declare const GenerationContentError$inboundSchema: z.ZodType<GenerationContentError, unknown>;
32
+ export declare function generationContentErrorFromJSON(jsonString: string): SafeParseResult<GenerationContentError, SDKValidationError>;
33
+ //# sourceMappingURL=generationcontenterror.d.ts.map
@@ -0,0 +1,25 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 5fb5a3b52853
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
+ import { GenerationContentErrorAttempt$inboundSchema, } from "./generationcontenterrorattempt.js";
9
+ /** @internal */
10
+ export const GenerationContentError$inboundSchema = z.object({
11
+ message: z.nullable(z.string()),
12
+ previous_errors: z.array(GenerationContentErrorAttempt$inboundSchema),
13
+ provider_name: z.nullable(z.string()),
14
+ raw: z.nullable(z.string()),
15
+ status: z.nullable(z.int()),
16
+ }).transform((v) => {
17
+ return remap$(v, {
18
+ "previous_errors": "previousErrors",
19
+ "provider_name": "providerName",
20
+ });
21
+ });
22
+ export function generationContentErrorFromJSON(jsonString) {
23
+ return safeParse(jsonString, (x) => GenerationContentError$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GenerationContentError' from JSON`);
24
+ }
25
+ //# sourceMappingURL=generationcontenterror.js.map
@@ -0,0 +1,28 @@
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 single failed upstream attempt recorded for the generation
6
+ */
7
+ export type GenerationContentErrorAttempt = {
8
+ /**
9
+ * HTTP status returned by this attempt
10
+ */
11
+ code: number;
12
+ /**
13
+ * Error message returned by this attempt
14
+ */
15
+ message: string;
16
+ /**
17
+ * Provider that served this attempt, when known
18
+ */
19
+ providerName: string | null;
20
+ /**
21
+ * Raw error body returned by the provider, when stored
22
+ */
23
+ raw: string | null;
24
+ };
25
+ /** @internal */
26
+ export declare const GenerationContentErrorAttempt$inboundSchema: z.ZodType<GenerationContentErrorAttempt, unknown>;
27
+ export declare function generationContentErrorAttemptFromJSON(jsonString: string): SafeParseResult<GenerationContentErrorAttempt, SDKValidationError>;
28
+ //# sourceMappingURL=generationcontenterrorattempt.d.ts.map
@@ -0,0 +1,22 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 0a3c55570f8e
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 GenerationContentErrorAttempt$inboundSchema = z.object({
10
+ code: z.int(),
11
+ message: z.string(),
12
+ provider_name: z.nullable(z.string()),
13
+ raw: z.nullable(z.string()),
14
+ }).transform((v) => {
15
+ return remap$(v, {
16
+ "provider_name": "providerName",
17
+ });
18
+ });
19
+ export function generationContentErrorAttemptFromJSON(jsonString) {
20
+ return safeParse(jsonString, (x) => GenerationContentErrorAttempt$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GenerationContentErrorAttempt' from JSON`);
21
+ }
22
+ //# sourceMappingURL=generationcontenterrorattempt.js.map
@@ -7,7 +7,7 @@ import { GenerationContentData } from "./generationcontentdata.js";
7
7
  */
8
8
  export type GenerationContentResponse = {
9
9
  /**
10
- * Stored prompt and completion content
10
+ * Stored prompt and completion content, plus the failure error when one was stored
11
11
  */
12
12
  data: GenerationContentData;
13
13
  };
@@ -237,6 +237,8 @@ export * from "./fusionservertoolconfig.js";
237
237
  export * from "./fusionservertoolopenrouter.js";
238
238
  export * from "./fusionsource.js";
239
239
  export * from "./generationcontentdata.js";
240
+ export * from "./generationcontenterror.js";
241
+ export * from "./generationcontenterrorattempt.js";
240
242
  export * from "./generationcontentresponse.js";
241
243
  export * from "./generationresponse.js";
242
244
  export * from "./getbyokkeyresponse.js";
@@ -241,6 +241,8 @@ export * from "./fusionservertoolconfig.js";
241
241
  export * from "./fusionservertoolopenrouter.js";
242
242
  export * from "./fusionsource.js";
243
243
  export * from "./generationcontentdata.js";
244
+ export * from "./generationcontenterror.js";
245
+ export * from "./generationcontenterrorattempt.js";
244
246
  export * from "./generationcontentresponse.js";
245
247
  export * from "./generationresponse.js";
246
248
  export * from "./getbyokkeyresponse.js";
@@ -7,7 +7,7 @@ export declare class Generations extends ClientSDK {
7
7
  */
8
8
  getGeneration(request: operations.GetGenerationRequest, options?: RequestOptions): Promise<models.GenerationResponse>;
9
9
  /**
10
- * Get stored prompt and completion content for a generation
10
+ * Get stored prompt, completion, and error content for a generation
11
11
  */
12
12
  listGenerationContent(request: operations.ListGenerationContentRequest, options?: RequestOptions): Promise<models.GenerationContentResponse>;
13
13
  /**
@@ -15,7 +15,7 @@ export class Generations extends ClientSDK {
15
15
  return unwrapAsync(generationsGetGeneration(this, request, options));
16
16
  }
17
17
  /**
18
- * Get stored prompt and completion content for a generation
18
+ * Get stored prompt, completion, and error content for a generation
19
19
  */
20
20
  async listGenerationContent(request, options) {
21
21
  return unwrapAsync(generationsListGenerationContent(this, request, options));
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@openrouter/sdk",
5
- "version": "1.2.24",
5
+ "version": "1.2.25",
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.24",
3
+ "version": "1.2.25",
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
- "prepare": "npm run build",
77
- "test": "vitest --run --project unit",
78
- "test:transit": "exit 0",
79
- "typecheck": "tsc --noEmit",
80
- "typecheck:transit": "exit 0",
81
76
  "compile": "tsc",
82
77
  "postinstall": "node scripts/check-types.js || true",
78
+ "test": "vitest --run --project unit",
83
79
  "test:e2e": "vitest --run --project e2e",
84
- "test:watch": "vitest --watch --project unit"
80
+ "typecheck": "tsc --noEmit",
81
+ "prepare": "npm run build",
82
+ "test:transit": "exit 0",
83
+ "test:watch": "vitest --watch --project unit",
84
+ "typecheck:transit": "exit 0"
85
85
  },
86
86
  "peerDependencies": {},
87
87
  "devDependencies": {