@openrouter/sdk 0.1.6 → 0.1.7

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/README.md CHANGED
@@ -73,7 +73,7 @@ const result = await openRouter.chat.send({
73
73
  content: "Hello, how are you?",
74
74
  },
75
75
  ],
76
- model: "openai/gpt-5"
76
+ model: "openai/gpt-5",
77
77
  provider: {
78
78
  zdr: true,
79
79
  sort: "price",
@@ -81,8 +81,8 @@ const result = await openRouter.chat.send({
81
81
  stream: true
82
82
  });
83
83
 
84
- for await (const chunk of stream) {
85
- console.log(hunk.choices[0].delta.content)
84
+ for await (const chunk of result) {
85
+ console.log(chunk.choices[0].delta.content)
86
86
  }
87
87
 
88
88
  ```
@@ -37,8 +37,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
37
37
  export declare const SDK_METADATA: {
38
38
  readonly language: "typescript";
39
39
  readonly openapiDocVersion: "1.0.0";
40
- readonly sdkVersion: "0.1.6";
40
+ readonly sdkVersion: "0.1.7";
41
41
  readonly genVersion: "2.745.2";
42
- readonly userAgent: "speakeasy-sdk/typescript 0.1.6 2.745.2 1.0.0 @openrouter/sdk";
42
+ readonly userAgent: "speakeasy-sdk/typescript 0.1.7 2.745.2 1.0.0 @openrouter/sdk";
43
43
  };
44
44
  //# sourceMappingURL=config.d.ts.map
package/esm/lib/config.js CHANGED
@@ -25,8 +25,8 @@ export function serverURLFromOptions(options) {
25
25
  export const SDK_METADATA = {
26
26
  language: "typescript",
27
27
  openapiDocVersion: "1.0.0",
28
- sdkVersion: "0.1.6",
28
+ sdkVersion: "0.1.7",
29
29
  genVersion: "2.745.2",
30
- userAgent: "speakeasy-sdk/typescript 0.1.6 2.745.2 1.0.0 @openrouter/sdk",
30
+ userAgent: "speakeasy-sdk/typescript 0.1.7 2.745.2 1.0.0 @openrouter/sdk",
31
31
  };
32
32
  //# sourceMappingURL=config.js.map
@@ -124,8 +124,8 @@ export type OpenAIResponsesInputMessage1 = {
124
124
  type: "input_file";
125
125
  })> | string;
126
126
  };
127
- export type OpenAIResponsesInputUnion1 = OpenAIResponsesInputFunctionCallOutput | OpenAIResponsesInputFunctionCall | OutputItemImageGenerationCall | OutputMessage | OpenAIResponsesInputMessage2 | OpenAIResponsesInputMessage1;
128
- export type OpenAIResponsesInputUnion = string | Array<OpenAIResponsesInputFunctionCallOutput | OpenAIResponsesInputFunctionCall | OutputItemImageGenerationCall | OutputMessage | OpenAIResponsesInputMessage2 | OpenAIResponsesInputMessage1> | any;
127
+ export type OpenAIResponsesInputUnion1 = OpenAIResponsesInputFunctionCallOutput | OpenAIResponsesInputFunctionCall | OutputMessage | OpenAIResponsesInputMessage2 | OutputItemImageGenerationCall | OpenAIResponsesInputMessage1;
128
+ export type OpenAIResponsesInputUnion = string | Array<OpenAIResponsesInputFunctionCallOutput | OpenAIResponsesInputFunctionCall | OutputMessage | OpenAIResponsesInputMessage2 | OutputItemImageGenerationCall | OpenAIResponsesInputMessage1> | any;
129
129
  /** @internal */
130
130
  export declare const OpenAIResponsesInputTypeFunctionCall$inboundSchema: z.ZodEnum<typeof OpenAIResponsesInputTypeFunctionCall>;
131
131
  /** @internal */
@@ -234,9 +234,9 @@ export function openAIResponsesInputMessage1FromJSON(jsonString) {
234
234
  export const OpenAIResponsesInputUnion1$inboundSchema = z.union([
235
235
  z.lazy(() => OpenAIResponsesInputFunctionCallOutput$inboundSchema),
236
236
  z.lazy(() => OpenAIResponsesInputFunctionCall$inboundSchema),
237
- OutputItemImageGenerationCall$inboundSchema,
238
237
  OutputMessage$inboundSchema,
239
238
  z.lazy(() => OpenAIResponsesInputMessage2$inboundSchema),
239
+ OutputItemImageGenerationCall$inboundSchema,
240
240
  z.lazy(() => OpenAIResponsesInputMessage1$inboundSchema),
241
241
  ]);
242
242
  export function openAIResponsesInputUnion1FromJSON(jsonString) {
@@ -248,9 +248,9 @@ export const OpenAIResponsesInputUnion$inboundSchema = z.union([
248
248
  z.array(z.union([
249
249
  z.lazy(() => OpenAIResponsesInputFunctionCallOutput$inboundSchema),
250
250
  z.lazy(() => OpenAIResponsesInputFunctionCall$inboundSchema),
251
- OutputItemImageGenerationCall$inboundSchema,
252
251
  OutputMessage$inboundSchema,
253
252
  z.lazy(() => OpenAIResponsesInputMessage2$inboundSchema),
253
+ OutputItemImageGenerationCall$inboundSchema,
254
254
  z.lazy(() => OpenAIResponsesInputMessage1$inboundSchema),
255
255
  ])),
256
256
  z.any(),
@@ -10,18 +10,18 @@ import { ResponsesOutputItemFunctionCall, ResponsesOutputItemFunctionCall$Outbou
10
10
  import { ResponsesOutputItemReasoning, ResponsesOutputItemReasoning$Outbound } from "./responsesoutputitemreasoning.js";
11
11
  import { ResponsesOutputMessage, ResponsesOutputMessage$Outbound } from "./responsesoutputmessage.js";
12
12
  import { ResponsesWebSearchCallOutput, ResponsesWebSearchCallOutput$Outbound } from "./responseswebsearchcalloutput.js";
13
- export type OpenResponsesInput1 = OpenResponsesFunctionToolCall | OpenResponsesFunctionCallOutput | ResponsesOutputMessage | ResponsesOutputItemFunctionCall | ResponsesOutputItemFileSearchCall | ResponsesImageGenerationCall | OpenResponsesReasoning | ResponsesWebSearchCallOutput | OpenResponsesEasyInputMessage | OpenResponsesInputMessageItem | ResponsesOutputItemReasoning;
13
+ export type OpenResponsesInput1 = OpenResponsesFunctionToolCall | OpenResponsesFunctionCallOutput | ResponsesOutputMessage | ResponsesOutputItemFunctionCall | ResponsesOutputItemFileSearchCall | OpenResponsesReasoning | ResponsesWebSearchCallOutput | ResponsesImageGenerationCall | OpenResponsesEasyInputMessage | OpenResponsesInputMessageItem | ResponsesOutputItemReasoning;
14
14
  /**
15
15
  * Input for a response request - can be a string or array of items
16
16
  */
17
- export type OpenResponsesInput = string | Array<OpenResponsesFunctionToolCall | OpenResponsesFunctionCallOutput | ResponsesOutputMessage | ResponsesOutputItemFunctionCall | ResponsesOutputItemFileSearchCall | ResponsesImageGenerationCall | OpenResponsesReasoning | ResponsesWebSearchCallOutput | OpenResponsesEasyInputMessage | OpenResponsesInputMessageItem | ResponsesOutputItemReasoning>;
17
+ export type OpenResponsesInput = string | Array<OpenResponsesFunctionToolCall | OpenResponsesFunctionCallOutput | ResponsesOutputMessage | ResponsesOutputItemFunctionCall | ResponsesOutputItemFileSearchCall | OpenResponsesReasoning | ResponsesWebSearchCallOutput | ResponsesImageGenerationCall | OpenResponsesEasyInputMessage | OpenResponsesInputMessageItem | ResponsesOutputItemReasoning>;
18
18
  /** @internal */
19
- export type OpenResponsesInput1$Outbound = OpenResponsesFunctionToolCall$Outbound | OpenResponsesFunctionCallOutput$Outbound | ResponsesOutputMessage$Outbound | ResponsesOutputItemFunctionCall$Outbound | ResponsesOutputItemFileSearchCall$Outbound | ResponsesImageGenerationCall$Outbound | OpenResponsesReasoning$Outbound | ResponsesWebSearchCallOutput$Outbound | OpenResponsesEasyInputMessage$Outbound | OpenResponsesInputMessageItem$Outbound | ResponsesOutputItemReasoning$Outbound;
19
+ export type OpenResponsesInput1$Outbound = OpenResponsesFunctionToolCall$Outbound | OpenResponsesFunctionCallOutput$Outbound | ResponsesOutputMessage$Outbound | ResponsesOutputItemFunctionCall$Outbound | ResponsesOutputItemFileSearchCall$Outbound | OpenResponsesReasoning$Outbound | ResponsesWebSearchCallOutput$Outbound | ResponsesImageGenerationCall$Outbound | OpenResponsesEasyInputMessage$Outbound | OpenResponsesInputMessageItem$Outbound | ResponsesOutputItemReasoning$Outbound;
20
20
  /** @internal */
21
21
  export declare const OpenResponsesInput1$outboundSchema: z.ZodType<OpenResponsesInput1$Outbound, OpenResponsesInput1>;
22
22
  export declare function openResponsesInput1ToJSON(openResponsesInput1: OpenResponsesInput1): string;
23
23
  /** @internal */
24
- export type OpenResponsesInput$Outbound = string | Array<OpenResponsesFunctionToolCall$Outbound | OpenResponsesFunctionCallOutput$Outbound | ResponsesOutputMessage$Outbound | ResponsesOutputItemFunctionCall$Outbound | ResponsesOutputItemFileSearchCall$Outbound | ResponsesImageGenerationCall$Outbound | OpenResponsesReasoning$Outbound | ResponsesWebSearchCallOutput$Outbound | OpenResponsesEasyInputMessage$Outbound | OpenResponsesInputMessageItem$Outbound | ResponsesOutputItemReasoning$Outbound>;
24
+ export type OpenResponsesInput$Outbound = string | Array<OpenResponsesFunctionToolCall$Outbound | OpenResponsesFunctionCallOutput$Outbound | ResponsesOutputMessage$Outbound | ResponsesOutputItemFunctionCall$Outbound | ResponsesOutputItemFileSearchCall$Outbound | OpenResponsesReasoning$Outbound | ResponsesWebSearchCallOutput$Outbound | ResponsesImageGenerationCall$Outbound | OpenResponsesEasyInputMessage$Outbound | OpenResponsesInputMessageItem$Outbound | ResponsesOutputItemReasoning$Outbound>;
25
25
  /** @internal */
26
26
  export declare const OpenResponsesInput$outboundSchema: z.ZodType<OpenResponsesInput$Outbound, OpenResponsesInput>;
27
27
  export declare function openResponsesInputToJSON(openResponsesInput: OpenResponsesInput): string;
@@ -20,9 +20,9 @@ export const OpenResponsesInput1$outboundSchema = z.union([
20
20
  ResponsesOutputMessage$outboundSchema,
21
21
  ResponsesOutputItemFunctionCall$outboundSchema,
22
22
  ResponsesOutputItemFileSearchCall$outboundSchema,
23
- ResponsesImageGenerationCall$outboundSchema,
24
23
  OpenResponsesReasoning$outboundSchema,
25
24
  ResponsesWebSearchCallOutput$outboundSchema,
25
+ ResponsesImageGenerationCall$outboundSchema,
26
26
  OpenResponsesEasyInputMessage$outboundSchema,
27
27
  OpenResponsesInputMessageItem$outboundSchema,
28
28
  ResponsesOutputItemReasoning$outboundSchema,
@@ -39,9 +39,9 @@ export const OpenResponsesInput$outboundSchema = z.union([
39
39
  ResponsesOutputMessage$outboundSchema,
40
40
  ResponsesOutputItemFunctionCall$outboundSchema,
41
41
  ResponsesOutputItemFileSearchCall$outboundSchema,
42
- ResponsesImageGenerationCall$outboundSchema,
43
42
  OpenResponsesReasoning$outboundSchema,
44
43
  ResponsesWebSearchCallOutput$outboundSchema,
44
+ ResponsesImageGenerationCall$outboundSchema,
45
45
  OpenResponsesEasyInputMessage$outboundSchema,
46
46
  OpenResponsesInputMessageItem$outboundSchema,
47
47
  ResponsesOutputItemReasoning$outboundSchema,
@@ -30,6 +30,10 @@ export type CreateAuthKeysCodeRequest = {
30
30
  * Credit limit for the API key to be created
31
31
  */
32
32
  limit?: number | undefined;
33
+ /**
34
+ * Optional expiration time for the API key to be created
35
+ */
36
+ expiresAt?: Date | null | undefined;
33
37
  };
34
38
  /**
35
39
  * Auth code data
@@ -65,6 +69,7 @@ export type CreateAuthKeysCodeRequest$Outbound = {
65
69
  code_challenge?: string | undefined;
66
70
  code_challenge_method?: string | undefined;
67
71
  limit?: number | undefined;
72
+ expires_at?: string | null | undefined;
68
73
  };
69
74
  /** @internal */
70
75
  export declare const CreateAuthKeysCodeRequest$outboundSchema: z.ZodType<CreateAuthKeysCodeRequest$Outbound, CreateAuthKeysCodeRequest>;
@@ -23,11 +23,13 @@ export const CreateAuthKeysCodeRequest$outboundSchema = z.object({
23
23
  codeChallengeMethod: CreateAuthKeysCodeCodeChallengeMethod$outboundSchema
24
24
  .optional(),
25
25
  limit: z.number().optional(),
26
+ expiresAt: z.nullable(z.date().transform(v => v.toISOString())).optional(),
26
27
  }).transform((v) => {
27
28
  return remap$(v, {
28
29
  callbackUrl: "callback_url",
29
30
  codeChallenge: "code_challenge",
30
31
  codeChallengeMethod: "code_challenge_method",
32
+ expiresAt: "expires_at",
31
33
  });
32
34
  });
33
35
  export function createAuthKeysCodeRequestToJSON(createAuthKeysCodeRequest) {
@@ -10,7 +10,7 @@ export type OutputItemImageGenerationCallType = ClosedEnum<typeof OutputItemImag
10
10
  export type OutputItemImageGenerationCall = {
11
11
  type: OutputItemImageGenerationCallType;
12
12
  id: string;
13
- result: string | null;
13
+ result?: string | null | undefined;
14
14
  status: ImageGenerationStatus;
15
15
  };
16
16
  /** @internal */
@@ -13,7 +13,7 @@ export const OutputItemImageGenerationCallType$inboundSchema = z.enum(OutputItem
13
13
  export const OutputItemImageGenerationCall$inboundSchema = z.object({
14
14
  type: OutputItemImageGenerationCallType$inboundSchema,
15
15
  id: z.string(),
16
- result: z.nullable(z.string()),
16
+ result: z.nullable(z.string()).default(null),
17
17
  status: ImageGenerationStatus$inboundSchema,
18
18
  });
19
19
  export function outputItemImageGenerationCallFromJSON(jsonString) {
@@ -10,7 +10,7 @@ export type ResponsesImageGenerationCallType = ClosedEnum<typeof ResponsesImageG
10
10
  export type ResponsesImageGenerationCall = {
11
11
  type: ResponsesImageGenerationCallType;
12
12
  id: string;
13
- result: string | null;
13
+ result?: string | null | undefined;
14
14
  status: ImageGenerationStatus;
15
15
  };
16
16
  /** @internal */
@@ -15,14 +15,14 @@ export const ResponsesImageGenerationCallType$outboundSchema = ResponsesImageGen
15
15
  export const ResponsesImageGenerationCall$inboundSchema = z.object({
16
16
  type: ResponsesImageGenerationCallType$inboundSchema,
17
17
  id: z.string(),
18
- result: z.nullable(z.string()),
18
+ result: z.nullable(z.string()).default(null),
19
19
  status: ImageGenerationStatus$inboundSchema,
20
20
  });
21
21
  /** @internal */
22
22
  export const ResponsesImageGenerationCall$outboundSchema = z.object({
23
23
  type: ResponsesImageGenerationCallType$outboundSchema,
24
24
  id: z.string(),
25
- result: z.nullable(z.string()),
25
+ result: z.nullable(z.string()).default(null),
26
26
  status: ImageGenerationStatus$outboundSchema,
27
27
  });
28
28
  export function responsesImageGenerationCallToJSON(responsesImageGenerationCall) {
@@ -10,7 +10,7 @@ import { ResponsesWebSearchCallOutput } from "./responseswebsearchcalloutput.js"
10
10
  /**
11
11
  * An output item from the response
12
12
  */
13
- export type ResponsesOutputItem = ResponsesOutputMessage | ResponsesOutputItemFunctionCall | ResponsesOutputItemFileSearchCall | ResponsesImageGenerationCall | ResponsesWebSearchCallOutput | ResponsesOutputItemReasoning;
13
+ export type ResponsesOutputItem = ResponsesOutputMessage | ResponsesOutputItemFunctionCall | ResponsesOutputItemFileSearchCall | ResponsesWebSearchCallOutput | ResponsesImageGenerationCall | ResponsesOutputItemReasoning;
14
14
  /** @internal */
15
15
  export declare const ResponsesOutputItem$inboundSchema: z.ZodType<ResponsesOutputItem, unknown>;
16
16
  export declare function responsesOutputItemFromJSON(jsonString: string): SafeParseResult<ResponsesOutputItem, SDKValidationError>;
@@ -14,8 +14,8 @@ export const ResponsesOutputItem$inboundSchema = z.union([
14
14
  ResponsesOutputMessage$inboundSchema,
15
15
  ResponsesOutputItemFunctionCall$inboundSchema,
16
16
  ResponsesOutputItemFileSearchCall$inboundSchema,
17
- ResponsesImageGenerationCall$inboundSchema,
18
17
  ResponsesWebSearchCallOutput$inboundSchema,
18
+ ResponsesImageGenerationCall$inboundSchema,
19
19
  ResponsesOutputItemReasoning$inboundSchema,
20
20
  ]);
21
21
  export function responsesOutputItemFromJSON(jsonString) {
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@openrouter/sdk",
5
- "version": "0.1.6",
5
+ "version": "0.1.7",
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": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "author": "OpenRouter",
5
5
  "description": "The OpenRouter TypeScript SDK is a type-safe toolkit for building AI applications with access to 300+ language models through a unified API.",
6
6
  "keywords": [