@openrouter/sdk 1.0.21 → 1.1.6

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.
@@ -1,28 +1,11 @@
1
- import { OpenRouterCore } from "../core.js";
2
- import { RequestOptions } from "../lib/sdks.js";
3
- import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
4
- import * as errors from "../models/errors/index.js";
5
- import { OpenRouterError } from "../models/errors/openroutererror.js";
6
- import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
7
- import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
8
- import * as operations from "../models/operations/index.js";
9
- import { APIPromise } from "../types/async.js";
10
- import { Result } from "../types/fp.js";
1
+ import { responsesSend } from "./responsesSend.js";
11
2
  /**
12
3
  * Create a response
13
4
  *
14
- * @remarks
15
- * Creates a streaming or non-streaming response using OpenResponses API format
5
+ * @deprecated Renamed to `responsesSend` now that the Responses API is GA. This
6
+ * alias is kept for the `beta.responses` deprecation window and will be removed
7
+ * on the sunset date (TBD). Import
8
+ * `@openrouter/sdk/funcs/responsesSend.js` instead.
16
9
  */
17
- export declare function betaResponsesSend(client: OpenRouterCore, request: operations.CreateResponsesRequest & {
18
- responsesRequest: {
19
- stream?: false;
20
- };
21
- }, options?: RequestOptions): APIPromise<Result<operations.CreateResponsesResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.PaymentRequiredResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.RequestTimeoutResponseError | errors.PayloadTooLargeResponseError | errors.UnprocessableEntityResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | errors.ServiceUnavailableResponseError | errors.EdgeNetworkTimeoutResponseError | errors.ProviderOverloadedResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
22
- export declare function betaResponsesSend(client: OpenRouterCore, request: operations.CreateResponsesRequest & {
23
- responsesRequest: {
24
- stream: true;
25
- };
26
- }, options?: RequestOptions): APIPromise<Result<operations.CreateResponsesResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.PaymentRequiredResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.RequestTimeoutResponseError | errors.PayloadTooLargeResponseError | errors.UnprocessableEntityResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | errors.ServiceUnavailableResponseError | errors.EdgeNetworkTimeoutResponseError | errors.ProviderOverloadedResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
27
- export declare function betaResponsesSend(client: OpenRouterCore, request: operations.CreateResponsesRequest, options?: RequestOptions): APIPromise<Result<operations.CreateResponsesResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.PaymentRequiredResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.RequestTimeoutResponseError | errors.PayloadTooLargeResponseError | errors.UnprocessableEntityResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | errors.ServiceUnavailableResponseError | errors.EdgeNetworkTimeoutResponseError | errors.ProviderOverloadedResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
10
+ export declare const betaResponsesSend: typeof responsesSend;
28
11
  //# sourceMappingURL=betaResponsesSend.d.ts.map
@@ -1,94 +1,11 @@
1
- /*
2
- * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
- * @generated-id: c5c4ab0c3f76
1
+ import { responsesSend } from "./responsesSend.js";
2
+ /**
3
+ * Create a response
4
+ *
5
+ * @deprecated Renamed to `responsesSend` now that the Responses API is GA. This
6
+ * alias is kept for the `beta.responses` deprecation window and will be removed
7
+ * on the sunset date (TBD). Import
8
+ * `@openrouter/sdk/funcs/responsesSend.js` instead.
4
9
  */
5
- import { encodeJSON, encodeSimple } from "../lib/encodings.js";
6
- import { matchStatusCode } from "../lib/http.js";
7
- import * as M from "../lib/matchers.js";
8
- import { compactMap } from "../lib/primitives.js";
9
- import { safeParse } from "../lib/schemas.js";
10
- import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
11
- import { pathToFunc } from "../lib/url.js";
12
- import * as errors from "../models/errors/index.js";
13
- import * as operations from "../models/operations/index.js";
14
- import { APIPromise } from "../types/async.js";
15
- export function betaResponsesSend(client, request, options) {
16
- return new APIPromise($do(client, request, options));
17
- }
18
- async function $do(client, request, options) {
19
- const parsed = safeParse(request, (value) => operations.CreateResponsesRequest$outboundSchema.parse(value), "Input validation failed");
20
- if (!parsed.ok) {
21
- return [parsed, { status: "invalid" }];
22
- }
23
- const payload = parsed.value;
24
- const body = encodeJSON("body", payload.ResponsesRequest, { explode: true });
25
- const path = pathToFunc("/responses")();
26
- const headers = new Headers(compactMap({
27
- "Content-Type": "application/json",
28
- Accept: request?.responsesRequest?.stream
29
- ? "text/event-stream"
30
- : "application/json",
31
- "HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
32
- "X-OpenRouter-Metadata": encodeSimple("X-OpenRouter-Metadata", payload["X-OpenRouter-Metadata"], { explode: false, charEncoding: "none" }),
33
- "X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
34
- "X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
35
- }));
36
- const secConfig = await extractSecurity(client._options.apiKey);
37
- const securityInput = secConfig == null ? {} : { apiKey: secConfig };
38
- const requestSecurity = resolveGlobalSecurity(securityInput);
39
- const context = {
40
- options: client._options,
41
- baseURL: options?.serverURL ?? client._baseURL ?? "",
42
- operationID: "createResponses",
43
- oAuth2Scopes: null,
44
- resolvedSecurity: requestSecurity,
45
- securitySource: client._options.apiKey,
46
- retryConfig: options?.retries
47
- || client._options.retryConfig
48
- || {
49
- strategy: "backoff",
50
- backoff: {
51
- initialInterval: 500,
52
- maxInterval: 60000,
53
- exponent: 1.5,
54
- maxElapsedTime: 3600000,
55
- },
56
- retryConnectionErrors: true,
57
- }
58
- || { strategy: "none" },
59
- retryCodes: options?.retryCodes || ["5XX"],
60
- };
61
- const requestRes = client._createRequest(context, {
62
- security: requestSecurity,
63
- method: "POST",
64
- baseURL: options?.serverURL,
65
- path: path,
66
- headers: headers,
67
- body: body,
68
- userAgent: client._options.userAgent,
69
- timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
70
- }, options);
71
- if (!requestRes.ok) {
72
- return [requestRes, { status: "invalid" }];
73
- }
74
- const req = requestRes.value;
75
- const doResult = await client._do(req, {
76
- context,
77
- isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
78
- retryConfig: context.retryConfig,
79
- retryCodes: context.retryCodes,
80
- });
81
- if (!doResult.ok) {
82
- return [doResult, { status: "request-error", request: req }];
83
- }
84
- const response = doResult.value;
85
- const responseFields = {
86
- HttpMeta: { Response: response, Request: req },
87
- };
88
- const [result] = await M.match(M.json(200, operations.CreateResponsesResponse$inboundSchema), M.sse(200, operations.CreateResponsesResponse$inboundSchema), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(402, errors.PaymentRequiredResponseError$inboundSchema), M.jsonErr(403, errors.ForbiddenResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(408, errors.RequestTimeoutResponseError$inboundSchema), M.jsonErr(413, errors.PayloadTooLargeResponseError$inboundSchema), M.jsonErr(422, errors.UnprocessableEntityResponseError$inboundSchema), M.jsonErr(429, errors.TooManyRequestsResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.jsonErr(502, errors.BadGatewayResponseError$inboundSchema), M.jsonErr(503, errors.ServiceUnavailableResponseError$inboundSchema), M.jsonErr(524, errors.EdgeNetworkTimeoutResponseError$inboundSchema), M.jsonErr(529, errors.ProviderOverloadedResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
89
- if (!result.ok) {
90
- return [result, { status: "complete", request: req, response }];
91
- }
92
- return [result, { status: "complete", request: req, response }];
93
- }
10
+ export const betaResponsesSend = responsesSend;
94
11
  //# sourceMappingURL=betaResponsesSend.js.map
@@ -0,0 +1,28 @@
1
+ import { OpenRouterCore } from "../core.js";
2
+ import { RequestOptions } from "../lib/sdks.js";
3
+ import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
4
+ import * as errors from "../models/errors/index.js";
5
+ import { OpenRouterError } from "../models/errors/openroutererror.js";
6
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
7
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
8
+ import * as operations from "../models/operations/index.js";
9
+ import { APIPromise } from "../types/async.js";
10
+ import { Result } from "../types/fp.js";
11
+ /**
12
+ * Create a response
13
+ *
14
+ * @remarks
15
+ * Creates a streaming or non-streaming response using OpenResponses API format
16
+ */
17
+ export declare function responsesSend(client: OpenRouterCore, request: operations.CreateResponsesRequest & {
18
+ responsesRequest: {
19
+ stream?: false;
20
+ };
21
+ }, options?: RequestOptions): APIPromise<Result<operations.CreateResponsesResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.PaymentRequiredResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.RequestTimeoutResponseError | errors.PayloadTooLargeResponseError | errors.UnprocessableEntityResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | errors.ServiceUnavailableResponseError | errors.EdgeNetworkTimeoutResponseError | errors.ProviderOverloadedResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
22
+ export declare function responsesSend(client: OpenRouterCore, request: operations.CreateResponsesRequest & {
23
+ responsesRequest: {
24
+ stream: true;
25
+ };
26
+ }, options?: RequestOptions): APIPromise<Result<operations.CreateResponsesResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.PaymentRequiredResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.RequestTimeoutResponseError | errors.PayloadTooLargeResponseError | errors.UnprocessableEntityResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | errors.ServiceUnavailableResponseError | errors.EdgeNetworkTimeoutResponseError | errors.ProviderOverloadedResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
27
+ export declare function responsesSend(client: OpenRouterCore, request: operations.CreateResponsesRequest, options?: RequestOptions): APIPromise<Result<operations.CreateResponsesResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.PaymentRequiredResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.RequestTimeoutResponseError | errors.PayloadTooLargeResponseError | errors.UnprocessableEntityResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | errors.ServiceUnavailableResponseError | errors.EdgeNetworkTimeoutResponseError | errors.ProviderOverloadedResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
28
+ //# sourceMappingURL=responsesSend.d.ts.map
@@ -0,0 +1,94 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: c8d9f439840d
4
+ */
5
+ import { encodeJSON, encodeSimple } from "../lib/encodings.js";
6
+ import { matchStatusCode } from "../lib/http.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { safeParse } from "../lib/schemas.js";
10
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
11
+ import { pathToFunc } from "../lib/url.js";
12
+ import * as errors from "../models/errors/index.js";
13
+ import * as operations from "../models/operations/index.js";
14
+ import { APIPromise } from "../types/async.js";
15
+ export function responsesSend(client, request, options) {
16
+ return new APIPromise($do(client, request, options));
17
+ }
18
+ async function $do(client, request, options) {
19
+ const parsed = safeParse(request, (value) => operations.CreateResponsesRequest$outboundSchema.parse(value), "Input validation failed");
20
+ if (!parsed.ok) {
21
+ return [parsed, { status: "invalid" }];
22
+ }
23
+ const payload = parsed.value;
24
+ const body = encodeJSON("body", payload.ResponsesRequest, { explode: true });
25
+ const path = pathToFunc("/responses")();
26
+ const headers = new Headers(compactMap({
27
+ "Content-Type": "application/json",
28
+ Accept: request?.responsesRequest?.stream
29
+ ? "text/event-stream"
30
+ : "application/json",
31
+ "HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
32
+ "X-OpenRouter-Metadata": encodeSimple("X-OpenRouter-Metadata", payload["X-OpenRouter-Metadata"], { explode: false, charEncoding: "none" }),
33
+ "X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
34
+ "X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
35
+ }));
36
+ const secConfig = await extractSecurity(client._options.apiKey);
37
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
38
+ const requestSecurity = resolveGlobalSecurity(securityInput);
39
+ const context = {
40
+ options: client._options,
41
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
42
+ operationID: "createResponses",
43
+ oAuth2Scopes: null,
44
+ resolvedSecurity: requestSecurity,
45
+ securitySource: client._options.apiKey,
46
+ retryConfig: options?.retries
47
+ || client._options.retryConfig
48
+ || {
49
+ strategy: "backoff",
50
+ backoff: {
51
+ initialInterval: 500,
52
+ maxInterval: 60000,
53
+ exponent: 1.5,
54
+ maxElapsedTime: 3600000,
55
+ },
56
+ retryConnectionErrors: true,
57
+ }
58
+ || { strategy: "none" },
59
+ retryCodes: options?.retryCodes || ["5XX"],
60
+ };
61
+ const requestRes = client._createRequest(context, {
62
+ security: requestSecurity,
63
+ method: "POST",
64
+ baseURL: options?.serverURL,
65
+ path: path,
66
+ headers: headers,
67
+ body: body,
68
+ userAgent: client._options.userAgent,
69
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
70
+ }, options);
71
+ if (!requestRes.ok) {
72
+ return [requestRes, { status: "invalid" }];
73
+ }
74
+ const req = requestRes.value;
75
+ const doResult = await client._do(req, {
76
+ context,
77
+ isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
78
+ retryConfig: context.retryConfig,
79
+ retryCodes: context.retryCodes,
80
+ });
81
+ if (!doResult.ok) {
82
+ return [doResult, { status: "request-error", request: req }];
83
+ }
84
+ const response = doResult.value;
85
+ const responseFields = {
86
+ HttpMeta: { Response: response, Request: req },
87
+ };
88
+ const [result] = await M.match(M.json(200, operations.CreateResponsesResponse$inboundSchema), M.sse(200, operations.CreateResponsesResponse$inboundSchema), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(402, errors.PaymentRequiredResponseError$inboundSchema), M.jsonErr(403, errors.ForbiddenResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(408, errors.RequestTimeoutResponseError$inboundSchema), M.jsonErr(413, errors.PayloadTooLargeResponseError$inboundSchema), M.jsonErr(422, errors.UnprocessableEntityResponseError$inboundSchema), M.jsonErr(429, errors.TooManyRequestsResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.jsonErr(502, errors.BadGatewayResponseError$inboundSchema), M.jsonErr(503, errors.ServiceUnavailableResponseError$inboundSchema), M.jsonErr(524, errors.EdgeNetworkTimeoutResponseError$inboundSchema), M.jsonErr(529, errors.ProviderOverloadedResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
89
+ if (!result.ok) {
90
+ return [result, { status: "complete", request: req, response }];
91
+ }
92
+ return [result, { status: "complete", request: req, response }];
93
+ }
94
+ //# sourceMappingURL=responsesSend.js.map
@@ -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.21";
52
+ readonly sdkVersion: "1.1.6";
53
53
  readonly genVersion: "2.914.0";
54
- readonly userAgent: "speakeasy-sdk/typescript 1.0.21 2.914.0 1.0.0 @openrouter/sdk";
54
+ readonly userAgent: "speakeasy-sdk/typescript 1.1.6 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.21",
29
+ sdkVersion: "1.1.6",
30
30
  genVersion: "2.914.0",
31
- userAgent: "speakeasy-sdk/typescript 1.0.21 2.914.0 1.0.0 @openrouter/sdk",
31
+ userAgent: "speakeasy-sdk/typescript 1.1.6 2.914.0 1.0.0 @openrouter/sdk",
32
32
  };
33
33
  //# sourceMappingURL=config.js.map
@@ -1,6 +1,6 @@
1
1
  import { ToolEventBroadcaster } from './tool-event-broadcaster.js';
2
2
  import { ToolContextStore, resolveContext } from './tool-context.js';
3
- import { betaResponsesSend } from '../funcs/betaResponsesSend.js';
3
+ import { responsesSend } from '../funcs/responsesSend.js';
4
4
  import { hasAsyncFunctions, resolveAsyncFunctions, } from './async-params.js';
5
5
  import { appendToMessages, createInitialState, createRejectedResult, createUnsentResult, extractTextFromResponse as extractTextFromResponseState, partitionToolCalls, unsentResultsToAPIFormat, updateState, } from './conversation-state.js';
6
6
  import { ReusableReadableStream } from './reusable-stream.js';
@@ -614,7 +614,7 @@ export class ModelResult {
614
614
  ...this.resolvedRequest,
615
615
  stream: true,
616
616
  };
617
- const newResult = await betaResponsesSend(this.options.client, { responsesRequest: newRequest }, this.options.options);
617
+ const newResult = await responsesSend(this.options.client, { responsesRequest: newRequest }, this.options.options);
618
618
  if (!newResult.ok) {
619
619
  throw newResult.error;
620
620
  }
@@ -779,7 +779,7 @@ export class ModelResult {
779
779
  // Force stream mode for initial request
780
780
  const request = this.resolvedRequest;
781
781
  // Make the API request
782
- const apiResult = await betaResponsesSend(this.options.client, { responsesRequest: request }, this.options.options);
782
+ const apiResult = await responsesSend(this.options.client, { responsesRequest: request }, this.options.options);
783
783
  if (!apiResult.ok) {
784
784
  throw apiResult.error;
785
785
  }
@@ -903,7 +903,7 @@ export class ModelResult {
903
903
  };
904
904
  this.resolvedRequest = request;
905
905
  // Make the API request
906
- const apiResult = await betaResponsesSend(this.options.client, { responsesRequest: request }, this.options.options);
906
+ const apiResult = await responsesSend(this.options.client, { responsesRequest: request }, this.options.options);
907
907
  if (!apiResult.ok) {
908
908
  throw apiResult.error;
909
909
  }
package/esm/sdk/beta.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { ClientSDK } from "../lib/sdks.js";
2
2
  import { BetaAnalytics } from "./betaanalytics.js";
3
- import { Responses } from "./responses.js";
3
+ import { BetaResponses } from "./betaresponses.js";
4
4
  export declare class Beta extends ClientSDK {
5
5
  private _analytics?;
6
6
  get analytics(): BetaAnalytics;
7
7
  private _responses?;
8
- get responses(): Responses;
8
+ get responses(): BetaResponses;
9
9
  }
10
10
  //# sourceMappingURL=beta.d.ts.map
package/esm/sdk/beta.js CHANGED
@@ -4,13 +4,13 @@
4
4
  */
5
5
  import { ClientSDK } from "../lib/sdks.js";
6
6
  import { BetaAnalytics } from "./betaanalytics.js";
7
- import { Responses } from "./responses.js";
7
+ import { BetaResponses } from "./betaresponses.js";
8
8
  export class Beta extends ClientSDK {
9
9
  get analytics() {
10
10
  return (this._analytics ?? (this._analytics = new BetaAnalytics(this._options)));
11
11
  }
12
12
  get responses() {
13
- return (this._responses ?? (this._responses = new Responses(this._options)));
13
+ return (this._responses ?? (this._responses = new BetaResponses(this._options)));
14
14
  }
15
15
  }
16
16
  //# sourceMappingURL=beta.js.map
@@ -0,0 +1,22 @@
1
+ import { ClientSDK, RequestOptions } from "../lib/sdks.js";
2
+ import * as operations from "../models/operations/index.js";
3
+ export declare class BetaResponses extends ClientSDK {
4
+ /**
5
+ * Create a response
6
+ *
7
+ * @remarks
8
+ * Creates a streaming or non-streaming response using OpenResponses API format
9
+ */
10
+ send(request: operations.CreateResponsesRequest & {
11
+ responsesRequest: {
12
+ stream?: false | undefined;
13
+ };
14
+ }, options?: RequestOptions): Promise<operations.CreateResponsesResponse>;
15
+ send(request: operations.CreateResponsesRequest & {
16
+ responsesRequest: {
17
+ stream: true;
18
+ };
19
+ }, options?: RequestOptions): Promise<operations.CreateResponsesResponse>;
20
+ send(request: operations.CreateResponsesRequest, options?: RequestOptions): Promise<operations.CreateResponsesResponse>;
21
+ }
22
+ //# sourceMappingURL=betaresponses.d.ts.map
@@ -0,0 +1,13 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 89c9eab70ae9
4
+ */
5
+ import { responsesSend } from "../funcs/responsesSend.js";
6
+ import { ClientSDK } from "../lib/sdks.js";
7
+ import { unwrapAsync } from "../types/fp.js";
8
+ export class BetaResponses extends ClientSDK {
9
+ async send(request, options) {
10
+ return unwrapAsync(responsesSend(this, request, options));
11
+ }
12
+ }
13
+ //# sourceMappingURL=betaresponses.js.map
@@ -2,12 +2,12 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  * @generated-id: fc4b535757c5
4
4
  */
5
- import { betaResponsesSend } from "../funcs/betaResponsesSend.js";
5
+ import { responsesSend } from "../funcs/responsesSend.js";
6
6
  import { ClientSDK } from "../lib/sdks.js";
7
7
  import { unwrapAsync } from "../types/fp.js";
8
8
  export class Responses extends ClientSDK {
9
9
  async send(request, options) {
10
- return unwrapAsync(betaResponsesSend(this, request, options));
10
+ return unwrapAsync(responsesSend(this, request, options));
11
11
  }
12
12
  }
13
13
  //# sourceMappingURL=responses.js.map
package/esm/sdk/sdk.d.ts CHANGED
@@ -21,6 +21,7 @@ import { Organization } from "./organization.js";
21
21
  import { Presets } from "./presets.js";
22
22
  import { Providers } from "./providers.js";
23
23
  import { Rerank } from "./rerank.js";
24
+ import { Responses } from "./responses.js";
24
25
  import { Stt } from "./stt.js";
25
26
  import { Tts } from "./tts.js";
26
27
  import { VideoGeneration } from "./videogeneration.js";
@@ -80,6 +81,8 @@ export declare class OpenRouter extends ClientSDK {
80
81
  get providers(): Providers;
81
82
  private _rerank?;
82
83
  get rerank(): Rerank;
84
+ private _responses?;
85
+ get responses(): Responses;
83
86
  private _videoGeneration?;
84
87
  get videoGeneration(): VideoGeneration;
85
88
  private _workspaces?;
package/esm/sdk/sdk.js CHANGED
@@ -25,6 +25,7 @@ import { Organization } from "./organization.js";
25
25
  import { Presets } from "./presets.js";
26
26
  import { Providers } from "./providers.js";
27
27
  import { Rerank } from "./rerank.js";
28
+ import { Responses } from "./responses.js";
28
29
  import { Stt } from "./stt.js";
29
30
  import { Tts } from "./tts.js";
30
31
  import { VideoGeneration } from "./videogeneration.js";
@@ -106,6 +107,9 @@ export class OpenRouter extends ClientSDK {
106
107
  get rerank() {
107
108
  return (this._rerank ?? (this._rerank = new Rerank(this._options)));
108
109
  }
110
+ get responses() {
111
+ return (this._responses ?? (this._responses = new Responses(this._options)));
112
+ }
109
113
  get videoGeneration() {
110
114
  return (this._videoGeneration ?? (this._videoGeneration = new VideoGeneration(this._options)));
111
115
  }
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@openrouter/sdk",
5
- "version": "1.0.21",
5
+ "version": "1.1.6",
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.21",
3
+ "version": "1.1.6",
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
+ "postinstall": "node scripts/check-types.js || true",
77
+ "test": "vitest --run --project unit",
76
78
  "test:transit": "exit 0",
77
79
  "test:watch": "vitest --watch --project unit",
78
80
  "typecheck": "tsc --noEmit",
79
81
  "typecheck:transit": "exit 0",
80
- "test:e2e": "vitest --run --project e2e",
81
82
  "compile": "tsc",
82
- "postinstall": "node scripts/check-types.js || true",
83
83
  "prepare": "npm run build",
84
- "test": "vitest --run --project unit"
84
+ "test:e2e": "vitest --run --project e2e"
85
85
  },
86
86
  "peerDependencies": {},
87
87
  "devDependencies": {