@openrouter/sdk 1.5.18 → 1.5.20

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.
Files changed (74) hide show
  1. package/esm/funcs/modelsList.d.ts +1 -1
  2. package/esm/funcs/modelsList.js +2 -2
  3. package/esm/funcs/modelsListForUser.d.ts +1 -1
  4. package/esm/funcs/modelsListForUser.js +2 -2
  5. package/esm/funcs/privateEndpointsUpdate.d.ts +2 -2
  6. package/esm/funcs/privateEndpointsUpdate.js +2 -2
  7. package/esm/funcs/privateEndpointsUpdateParameters.d.ts +4 -2
  8. package/esm/funcs/privateEndpointsUpdateParameters.js +4 -2
  9. package/esm/funcs/privateEndpointsUpdatePricing.d.ts +4 -2
  10. package/esm/funcs/privateEndpointsUpdatePricing.js +4 -2
  11. package/esm/funcs/privateProvidersCreate.d.ts +18 -0
  12. package/esm/funcs/privateProvidersCreate.js +99 -0
  13. package/esm/funcs/privateProvidersDelete.d.ts +18 -0
  14. package/esm/funcs/privateProvidersDelete.js +102 -0
  15. package/esm/funcs/privateProvidersGet.d.ts +18 -0
  16. package/esm/funcs/privateProvidersGet.js +102 -0
  17. package/esm/funcs/privateProvidersList.d.ts +18 -0
  18. package/esm/funcs/privateProvidersList.js +96 -0
  19. package/esm/funcs/privateProvidersUpdate.d.ts +18 -0
  20. package/esm/funcs/privateProvidersUpdate.js +105 -0
  21. package/esm/lib/config.d.ts +3 -3
  22. package/esm/lib/config.js +3 -3
  23. package/esm/models/createguardrailrequest.d.ts +5 -0
  24. package/esm/models/createguardrailrequest.js +2 -0
  25. package/esm/models/createprivateendpointrequest.d.ts +6 -0
  26. package/esm/models/createprivateendpointrequest.js +2 -0
  27. package/esm/models/createprivateproviderrequest.d.ts +36 -0
  28. package/esm/models/createprivateproviderrequest.js +25 -0
  29. package/esm/models/guardrail.d.ts +4 -0
  30. package/esm/models/guardrail.js +2 -0
  31. package/esm/models/index.d.ts +8 -0
  32. package/esm/models/index.js +8 -0
  33. package/esm/models/operations/createprivateprovider.d.ts +67 -0
  34. package/esm/models/operations/createprivateprovider.js +31 -0
  35. package/esm/models/operations/deleteprivateprovider.d.ts +75 -0
  36. package/esm/models/operations/deleteprivateprovider.js +36 -0
  37. package/esm/models/operations/getprivateprovider.d.ts +67 -0
  38. package/esm/models/operations/getprivateprovider.js +30 -0
  39. package/esm/models/operations/index.d.ts +5 -0
  40. package/esm/models/operations/index.js +5 -0
  41. package/esm/models/operations/listprivateproviders.d.ts +65 -0
  42. package/esm/models/operations/listprivateproviders.js +29 -0
  43. package/esm/models/operations/updateprivateprovider.d.ts +69 -0
  44. package/esm/models/operations/updateprivateprovider.js +32 -0
  45. package/esm/models/organizationsettings.d.ts +1 -1
  46. package/esm/models/privateendpoint.d.ts +5 -0
  47. package/esm/models/privateendpoint.js +2 -0
  48. package/esm/models/privateendpointquantization.d.ts +28 -0
  49. package/esm/models/privateendpointquantization.js +27 -0
  50. package/esm/models/privateendpointreasoningreturnmechanism.d.ts +20 -0
  51. package/esm/models/privateendpointreasoningreturnmechanism.js +19 -0
  52. package/esm/models/privateendpointsettings.d.ts +142 -0
  53. package/esm/models/privateendpointsettings.js +112 -0
  54. package/esm/models/privateprovider.d.ts +47 -0
  55. package/esm/models/privateprovider.js +41 -0
  56. package/esm/models/privateproviderdatapolicy.d.ts +28 -0
  57. package/esm/models/privateproviderdatapolicy.js +21 -0
  58. package/esm/models/updateguardrailrequest.d.ts +5 -0
  59. package/esm/models/updateguardrailrequest.js +2 -0
  60. package/esm/models/updateorganizationsettingsrequest.d.ts +1 -1
  61. package/esm/models/updateprivateendpointrequest.d.ts +17 -2
  62. package/esm/models/updateprivateendpointrequest.js +9 -1
  63. package/esm/models/updateprivateendpointsettingsrequest.d.ts +177 -0
  64. package/esm/models/updateprivateendpointsettingsrequest.js +111 -0
  65. package/esm/models/updateprivateproviderrequest.d.ts +42 -0
  66. package/esm/models/updateprivateproviderrequest.js +36 -0
  67. package/esm/sdk/privateendpoints.d.ts +10 -6
  68. package/esm/sdk/privateendpoints.js +10 -6
  69. package/esm/sdk/privateproviders.d.ts +40 -0
  70. package/esm/sdk/privateproviders.js +59 -0
  71. package/esm/sdk/sdk.d.ts +3 -0
  72. package/esm/sdk/sdk.js +4 -0
  73. package/jsr.json +1 -1
  74. package/package.json +8 -8
@@ -12,7 +12,7 @@ import { PageIterator } from "../types/operations.js";
12
12
  /**
13
13
  * List all models and their properties
14
14
  */
15
- export declare function modelsList(client: OpenRouterCore, request?: operations.GetModelsRequest | undefined, options?: RequestOptions): APIPromise<PageIterator<Result<operations.GetModelsResponse, errors.BadRequestResponseError | errors.ForbiddenResponseError | errors.InternalServerResponseError | errors.ServiceUnavailableResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>, {
15
+ export declare function modelsList(client: OpenRouterCore, request?: operations.GetModelsRequest | undefined, options?: RequestOptions): APIPromise<PageIterator<Result<operations.GetModelsResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.RequestTimeoutResponseError | errors.ConflictResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.ServiceUnavailableResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>, {
16
16
  offset: number;
17
17
  }>>;
18
18
  //# sourceMappingURL=modelsList.d.ts.map
@@ -9,7 +9,7 @@ import { compactMap } from "../lib/primitives.js";
9
9
  import { safeParse } from "../lib/schemas.js";
10
10
  import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
11
11
  import { pathToFunc } from "../lib/url.js";
12
- import { BadRequestResponseError$inboundSchema as errors_BadRequestResponseError$inboundSchema } from "../models/errors/badrequestresponseerror.js"; import { ForbiddenResponseError$inboundSchema as errors_ForbiddenResponseError$inboundSchema } from "../models/errors/forbiddenresponseerror.js"; import { InternalServerResponseError$inboundSchema as errors_InternalServerResponseError$inboundSchema } from "../models/errors/internalserverresponseerror.js"; import { ServiceUnavailableResponseError$inboundSchema as errors_ServiceUnavailableResponseError$inboundSchema } from "../models/errors/serviceunavailableresponseerror.js";
12
+ import { BadRequestResponseError$inboundSchema as errors_BadRequestResponseError$inboundSchema } from "../models/errors/badrequestresponseerror.js"; import { ConflictResponseError$inboundSchema as errors_ConflictResponseError$inboundSchema } from "../models/errors/conflictresponseerror.js"; import { ForbiddenResponseError$inboundSchema as errors_ForbiddenResponseError$inboundSchema } from "../models/errors/forbiddenresponseerror.js"; import { InternalServerResponseError$inboundSchema as errors_InternalServerResponseError$inboundSchema } from "../models/errors/internalserverresponseerror.js"; import { NotFoundResponseError$inboundSchema as errors_NotFoundResponseError$inboundSchema } from "../models/errors/notfoundresponseerror.js"; import { RequestTimeoutResponseError$inboundSchema as errors_RequestTimeoutResponseError$inboundSchema } from "../models/errors/requesttimeoutresponseerror.js"; import { ServiceUnavailableResponseError$inboundSchema as errors_ServiceUnavailableResponseError$inboundSchema } from "../models/errors/serviceunavailableresponseerror.js"; import { TooManyRequestsResponseError$inboundSchema as errors_TooManyRequestsResponseError$inboundSchema } from "../models/errors/toomanyrequestsresponseerror.js"; import { UnauthorizedResponseError$inboundSchema as errors_UnauthorizedResponseError$inboundSchema } from "../models/errors/unauthorizedresponseerror.js";
13
13
  import { GetModelsRequest$outboundSchema as operations_GetModelsRequest$outboundSchema, GetModelsResponse$inboundSchema as operations_GetModelsResponse$inboundSchema } from "../models/operations/getmodels.js";
14
14
  import { APIPromise } from "../types/async.js";
15
15
  import { createPageIterator, haltIterator, } from "../types/operations.js";
@@ -117,7 +117,7 @@ async function $do(client, request, options) {
117
117
  const responseFields = {
118
118
  HttpMeta: { Response: response, Request: req },
119
119
  };
120
- const [result, raw] = await M.match(M.json(200, operations_GetModelsResponse$inboundSchema, { key: "Result" }), M.jsonErr(400, errors_BadRequestResponseError$inboundSchema), M.jsonErr(403, errors_ForbiddenResponseError$inboundSchema), M.jsonErr(500, errors_InternalServerResponseError$inboundSchema), M.jsonErr(503, errors_ServiceUnavailableResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
120
+ const [result, raw] = await M.match(M.json(200, operations_GetModelsResponse$inboundSchema, { key: "Result" }), M.jsonErr(400, errors_BadRequestResponseError$inboundSchema), M.jsonErr(401, errors_UnauthorizedResponseError$inboundSchema), M.jsonErr(403, errors_ForbiddenResponseError$inboundSchema), M.jsonErr(404, errors_NotFoundResponseError$inboundSchema), M.jsonErr(408, errors_RequestTimeoutResponseError$inboundSchema), M.jsonErr(409, errors_ConflictResponseError$inboundSchema), M.jsonErr(429, errors_TooManyRequestsResponseError$inboundSchema), M.jsonErr(500, errors_InternalServerResponseError$inboundSchema), M.jsonErr(503, errors_ServiceUnavailableResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
121
121
  if (!result.ok) {
122
122
  return [haltIterator(result), {
123
123
  status: "complete",
@@ -15,7 +15,7 @@ import { PageIterator } from "../types/operations.js";
15
15
  * @remarks
16
16
  * List models filtered by user provider preferences, [privacy settings](https://openrouter.ai/docs/guides/privacy/provider-logging), and [guardrails](https://openrouter.ai/docs/guides/features/guardrails). Returns text-output models by default; pass `output_modalities` (a comma-separated list of `text`, `image`, `embeddings`, `audio`, `video`, `rerank`, `speech`, `transcription`, or `all`) to include other modalities. If requesting through a regional hostname, the results will be filtered to models that satisfy in-region routing for that region.
17
17
  */
18
- export declare function modelsListForUser(client: OpenRouterCore, security: operations.ListModelsUserSecurity, request?: operations.ListModelsUserRequest | undefined, options?: RequestOptions): APIPromise<PageIterator<Result<operations.ListModelsUserResponse, errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.InternalServerResponseError | errors.ServiceUnavailableResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>, {
18
+ export declare function modelsListForUser(client: OpenRouterCore, security: operations.ListModelsUserSecurity, request?: operations.ListModelsUserRequest | undefined, options?: RequestOptions): APIPromise<PageIterator<Result<operations.ListModelsUserResponse, errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.RequestTimeoutResponseError | errors.ConflictResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.ServiceUnavailableResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>, {
19
19
  offset: number;
20
20
  }>>;
21
21
  //# sourceMappingURL=modelsListForUser.d.ts.map
@@ -9,7 +9,7 @@ import { compactMap } from "../lib/primitives.js";
9
9
  import { safeParse } from "../lib/schemas.js";
10
10
  import { resolveSecurity } from "../lib/security.js";
11
11
  import { pathToFunc } from "../lib/url.js";
12
- import { ForbiddenResponseError$inboundSchema as errors_ForbiddenResponseError$inboundSchema } from "../models/errors/forbiddenresponseerror.js"; import { InternalServerResponseError$inboundSchema as errors_InternalServerResponseError$inboundSchema } from "../models/errors/internalserverresponseerror.js"; import { NotFoundResponseError$inboundSchema as errors_NotFoundResponseError$inboundSchema } from "../models/errors/notfoundresponseerror.js"; import { ServiceUnavailableResponseError$inboundSchema as errors_ServiceUnavailableResponseError$inboundSchema } from "../models/errors/serviceunavailableresponseerror.js"; import { UnauthorizedResponseError$inboundSchema as errors_UnauthorizedResponseError$inboundSchema } from "../models/errors/unauthorizedresponseerror.js";
12
+ import { ConflictResponseError$inboundSchema as errors_ConflictResponseError$inboundSchema } from "../models/errors/conflictresponseerror.js"; import { ForbiddenResponseError$inboundSchema as errors_ForbiddenResponseError$inboundSchema } from "../models/errors/forbiddenresponseerror.js"; import { InternalServerResponseError$inboundSchema as errors_InternalServerResponseError$inboundSchema } from "../models/errors/internalserverresponseerror.js"; import { NotFoundResponseError$inboundSchema as errors_NotFoundResponseError$inboundSchema } from "../models/errors/notfoundresponseerror.js"; import { RequestTimeoutResponseError$inboundSchema as errors_RequestTimeoutResponseError$inboundSchema } from "../models/errors/requesttimeoutresponseerror.js"; import { ServiceUnavailableResponseError$inboundSchema as errors_ServiceUnavailableResponseError$inboundSchema } from "../models/errors/serviceunavailableresponseerror.js"; import { TooManyRequestsResponseError$inboundSchema as errors_TooManyRequestsResponseError$inboundSchema } from "../models/errors/toomanyrequestsresponseerror.js"; import { UnauthorizedResponseError$inboundSchema as errors_UnauthorizedResponseError$inboundSchema } from "../models/errors/unauthorizedresponseerror.js";
13
13
  import { ListModelsUserRequest$outboundSchema as operations_ListModelsUserRequest$outboundSchema, ListModelsUserResponse$inboundSchema as operations_ListModelsUserResponse$inboundSchema } from "../models/operations/listmodelsuser.js";
14
14
  import { APIPromise } from "../types/async.js";
15
15
  import { createPageIterator, haltIterator, } from "../types/operations.js";
@@ -101,7 +101,7 @@ async function $do(client, security, request, options) {
101
101
  };
102
102
  const [result, raw] = await M.match(M.json(200, operations_ListModelsUserResponse$inboundSchema, {
103
103
  key: "Result",
104
- }), M.jsonErr(401, errors_UnauthorizedResponseError$inboundSchema), M.jsonErr(403, errors_ForbiddenResponseError$inboundSchema), M.jsonErr(404, errors_NotFoundResponseError$inboundSchema), M.jsonErr(500, errors_InternalServerResponseError$inboundSchema), M.jsonErr(503, errors_ServiceUnavailableResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
104
+ }), M.jsonErr(401, errors_UnauthorizedResponseError$inboundSchema), M.jsonErr(403, errors_ForbiddenResponseError$inboundSchema), M.jsonErr(404, errors_NotFoundResponseError$inboundSchema), M.jsonErr(408, errors_RequestTimeoutResponseError$inboundSchema), M.jsonErr(409, errors_ConflictResponseError$inboundSchema), M.jsonErr(429, errors_TooManyRequestsResponseError$inboundSchema), M.jsonErr(500, errors_InternalServerResponseError$inboundSchema), M.jsonErr(503, errors_ServiceUnavailableResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
105
105
  if (!result.ok) {
106
106
  return [haltIterator(result), {
107
107
  status: "complete",
@@ -10,10 +10,10 @@ 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
- * Update a draft private endpoint
13
+ * Update a private endpoint
14
14
  *
15
15
  * @remarks
16
- * Replace a draft endpoint's upstream configuration: send `upstream_model_id`, and `base_url` to change it (an omitted `base_url` keeps the stored one). Omitted data-policy declarations are kept while the upstream is unchanged and cleared when it changes. Any change clears earlier validation. Active endpoints return 409; delete and re-create them instead. [Management key](/docs/guides/overview/auth/management-api-keys) required.
16
+ * Change any of the endpoint fields you own in one call; only the fields present change, and the response is the whole endpoint. `pricing` and `declared_parameters` replace their stored value, `settings` changes only the fields it names (`null` clears a limit or restores the provider default); routing picks these up for subsequent requests on drafts and active endpoints alike. `upstream_model_id`, `base_url`, `declared_zdr` and `declared_region` re-point a draft: an omitted `upstream_model_id` or `base_url` keeps the stored one, omitted data-policy declarations are kept while the upstream is unchanged and cleared when it changes, and any upstream change clears earlier validation. Naming an upstream field on an active endpoint returns 409 `already_active` and writes nothing; delete and re-create instead. Every group is checked before anything is written: 400 `parameters_invalid` when `tool_choice` is declared without `tools` tested or declared, 400 `settings_invalid` when `max_prompt_tokens` exceeds the context length, both completion APIs are off, or `excluded_parameters` names a tested parameter, 422 `pricing_invalid` for rates the provider strategy cannot represent. [Management key](/docs/guides/overview/auth/management-api-keys) required.
17
17
  */
18
18
  export declare function privateEndpointsUpdate(client: OpenRouterCore, request: operations.UpdatePrivateEndpointRequest, options?: RequestOptions): APIPromise<Result<models.PrivateEndpointResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.RequestTimeoutResponseError | errors.ConflictResponseError | errors.UnprocessableEntityResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
19
19
  //# sourceMappingURL=privateEndpointsUpdate.d.ts.map
@@ -14,10 +14,10 @@ import { PrivateEndpointResponse$inboundSchema as models_PrivateEndpointResponse
14
14
  import { UpdatePrivateEndpointRequest$outboundSchema as operations_UpdatePrivateEndpointRequest$outboundSchema } from "../models/operations/updateprivateendpoint.js";
15
15
  import { APIPromise } from "../types/async.js";
16
16
  /**
17
- * Update a draft private endpoint
17
+ * Update a private endpoint
18
18
  *
19
19
  * @remarks
20
- * Replace a draft endpoint's upstream configuration: send `upstream_model_id`, and `base_url` to change it (an omitted `base_url` keeps the stored one). Omitted data-policy declarations are kept while the upstream is unchanged and cleared when it changes. Any change clears earlier validation. Active endpoints return 409; delete and re-create them instead. [Management key](/docs/guides/overview/auth/management-api-keys) required.
20
+ * Change any of the endpoint fields you own in one call; only the fields present change, and the response is the whole endpoint. `pricing` and `declared_parameters` replace their stored value, `settings` changes only the fields it names (`null` clears a limit or restores the provider default); routing picks these up for subsequent requests on drafts and active endpoints alike. `upstream_model_id`, `base_url`, `declared_zdr` and `declared_region` re-point a draft: an omitted `upstream_model_id` or `base_url` keeps the stored one, omitted data-policy declarations are kept while the upstream is unchanged and cleared when it changes, and any upstream change clears earlier validation. Naming an upstream field on an active endpoint returns 409 `already_active` and writes nothing; delete and re-create instead. Every group is checked before anything is written: 400 `parameters_invalid` when `tool_choice` is declared without `tools` tested or declared, 400 `settings_invalid` when `max_prompt_tokens` exceeds the context length, both completion APIs are off, or `excluded_parameters` names a tested parameter, 422 `pricing_invalid` for rates the provider strategy cannot represent. [Management key](/docs/guides/overview/auth/management-api-keys) required.
21
21
  */
22
22
  export function privateEndpointsUpdate(client, request, options) {
23
23
  return new APIPromise($do(client, request, options));
@@ -10,10 +10,12 @@ 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
- * Set private endpoint supported parameters
13
+ * Set private endpoint supported parameters (deprecated)
14
14
  *
15
15
  * @remarks
16
- * Declare which request parameters the upstream supports beyond the ones validation proved. Applies to drafts and active endpoints; routing picks the change up for subsequent requests. The body replaces the earlier declaration and is read as a set: order and repeated names do not matter, but the list holds at most as many entries as there are declarable parameters, repeats included. `tested_parameters` stay. Returns 400 `parameters_invalid` when `tool_choice` is declared without `tools` being tested or declared. [Management key](/docs/guides/overview/auth/management-api-keys) required.
16
+ * Deprecated: send `declared_parameters` to `PATCH /private-endpoints/{id}` instead; this route behaves exactly like that call and will be removed. The body replaces the earlier declaration and is read as a set; `tested_parameters` stay. Returns 400 `parameters_invalid` when `tool_choice` is declared without `tools` being tested or declared. [Management key](/docs/guides/overview/auth/management-api-keys) required.
17
+ *
18
+ * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible.
17
19
  */
18
20
  export declare function privateEndpointsUpdateParameters(client: OpenRouterCore, request: operations.UpdatePrivateEndpointParametersRequest, options?: RequestOptions): APIPromise<Result<models.PrivateEndpointResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.RequestTimeoutResponseError | errors.ConflictResponseError | errors.UnprocessableEntityResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
19
21
  //# sourceMappingURL=privateEndpointsUpdateParameters.d.ts.map
@@ -14,10 +14,12 @@ import { PrivateEndpointResponse$inboundSchema as models_PrivateEndpointResponse
14
14
  import { UpdatePrivateEndpointParametersRequest$outboundSchema as operations_UpdatePrivateEndpointParametersRequest$outboundSchema } from "../models/operations/updateprivateendpointparameters.js";
15
15
  import { APIPromise } from "../types/async.js";
16
16
  /**
17
- * Set private endpoint supported parameters
17
+ * Set private endpoint supported parameters (deprecated)
18
18
  *
19
19
  * @remarks
20
- * Declare which request parameters the upstream supports beyond the ones validation proved. Applies to drafts and active endpoints; routing picks the change up for subsequent requests. The body replaces the earlier declaration and is read as a set: order and repeated names do not matter, but the list holds at most as many entries as there are declarable parameters, repeats included. `tested_parameters` stay. Returns 400 `parameters_invalid` when `tool_choice` is declared without `tools` being tested or declared. [Management key](/docs/guides/overview/auth/management-api-keys) required.
20
+ * Deprecated: send `declared_parameters` to `PATCH /private-endpoints/{id}` instead; this route behaves exactly like that call and will be removed. The body replaces the earlier declaration and is read as a set; `tested_parameters` stay. Returns 400 `parameters_invalid` when `tool_choice` is declared without `tools` being tested or declared. [Management key](/docs/guides/overview/auth/management-api-keys) required.
21
+ *
22
+ * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible.
21
23
  */
22
24
  export function privateEndpointsUpdateParameters(client, request, options) {
23
25
  return new APIPromise($do(client, request, options));
@@ -10,10 +10,12 @@ 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
- * Set private endpoint pricing
13
+ * Set private endpoint pricing (deprecated)
14
14
  *
15
15
  * @remarks
16
- * Set the negotiated per-token rates reported for requests routed to this endpoint. Applies to drafts and active endpoints; new rates take effect for subsequent requests. The body replaces the whole pricing object: omitting `cache_read` or `cache_write` reverts that rate to the provider pricing strategy's default, even if it was set before. [Management key](/docs/guides/overview/auth/management-api-keys) required.
16
+ * Deprecated: send `pricing` to `PATCH /private-endpoints/{id}` instead; this route behaves exactly like that call and will be removed. The body replaces the whole pricing object: omitting `cache_read` or `cache_write` reverts that rate to the provider pricing strategy default. [Management key](/docs/guides/overview/auth/management-api-keys) required.
17
+ *
18
+ * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible.
17
19
  */
18
20
  export declare function privateEndpointsUpdatePricing(client: OpenRouterCore, request: operations.UpdatePrivateEndpointPricingRequest, options?: RequestOptions): APIPromise<Result<models.PrivateEndpointResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.RequestTimeoutResponseError | errors.ConflictResponseError | errors.UnprocessableEntityResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
19
21
  //# sourceMappingURL=privateEndpointsUpdatePricing.d.ts.map
@@ -14,10 +14,12 @@ import { PrivateEndpointResponse$inboundSchema as models_PrivateEndpointResponse
14
14
  import { UpdatePrivateEndpointPricingRequest$outboundSchema as operations_UpdatePrivateEndpointPricingRequest$outboundSchema } from "../models/operations/updateprivateendpointpricing.js";
15
15
  import { APIPromise } from "../types/async.js";
16
16
  /**
17
- * Set private endpoint pricing
17
+ * Set private endpoint pricing (deprecated)
18
18
  *
19
19
  * @remarks
20
- * Set the negotiated per-token rates reported for requests routed to this endpoint. Applies to drafts and active endpoints; new rates take effect for subsequent requests. The body replaces the whole pricing object: omitting `cache_read` or `cache_write` reverts that rate to the provider pricing strategy's default, even if it was set before. [Management key](/docs/guides/overview/auth/management-api-keys) required.
20
+ * Deprecated: send `pricing` to `PATCH /private-endpoints/{id}` instead; this route behaves exactly like that call and will be removed. The body replaces the whole pricing object: omitting `cache_read` or `cache_write` reverts that rate to the provider pricing strategy default. [Management key](/docs/guides/overview/auth/management-api-keys) required.
21
+ *
22
+ * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible.
21
23
  */
22
24
  export function privateEndpointsUpdatePricing(client, request, options) {
23
25
  return new APIPromise($do(client, request, options));
@@ -0,0 +1,18 @@
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 private provider
13
+ *
14
+ * @remarks
15
+ * Create a private, bring-your-own-key provider visible only to your organization. Use its slug as `provider_slug` when creating private endpoints. Requires both the private endpoints and the private providers entitlements. [Management key](/docs/guides/overview/auth/management-api-keys) required.
16
+ */
17
+ export declare function privateProvidersCreate(client: OpenRouterCore, request: operations.CreatePrivateProviderRequest, options?: RequestOptions): APIPromise<Result<operations.CreatePrivateProviderResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.RequestTimeoutResponseError | errors.ConflictResponseError | errors.UnprocessableEntityResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
18
+ //# sourceMappingURL=privateProvidersCreate.d.ts.map
@@ -0,0 +1,99 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: dbc181e55583
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 { BadGatewayResponseError$inboundSchema as errors_BadGatewayResponseError$inboundSchema } from "../models/errors/badgatewayresponseerror.js"; import { BadRequestResponseError$inboundSchema as errors_BadRequestResponseError$inboundSchema } from "../models/errors/badrequestresponseerror.js"; import { ConflictResponseError$inboundSchema as errors_ConflictResponseError$inboundSchema } from "../models/errors/conflictresponseerror.js"; import { ForbiddenResponseError$inboundSchema as errors_ForbiddenResponseError$inboundSchema } from "../models/errors/forbiddenresponseerror.js"; import { InternalServerResponseError$inboundSchema as errors_InternalServerResponseError$inboundSchema } from "../models/errors/internalserverresponseerror.js"; import { NotFoundResponseError$inboundSchema as errors_NotFoundResponseError$inboundSchema } from "../models/errors/notfoundresponseerror.js"; import { RequestTimeoutResponseError$inboundSchema as errors_RequestTimeoutResponseError$inboundSchema } from "../models/errors/requesttimeoutresponseerror.js"; import { TooManyRequestsResponseError$inboundSchema as errors_TooManyRequestsResponseError$inboundSchema } from "../models/errors/toomanyrequestsresponseerror.js"; import { UnauthorizedResponseError$inboundSchema as errors_UnauthorizedResponseError$inboundSchema } from "../models/errors/unauthorizedresponseerror.js"; import { UnprocessableEntityResponseError$inboundSchema as errors_UnprocessableEntityResponseError$inboundSchema } from "../models/errors/unprocessableentityresponseerror.js";
13
+ import { CreatePrivateProviderRequest$outboundSchema as operations_CreatePrivateProviderRequest$outboundSchema, CreatePrivateProviderResponse$inboundSchema as operations_CreatePrivateProviderResponse$inboundSchema } from "../models/operations/createprivateprovider.js";
14
+ import { APIPromise } from "../types/async.js";
15
+ /**
16
+ * Create a private provider
17
+ *
18
+ * @remarks
19
+ * Create a private, bring-your-own-key provider visible only to your organization. Use its slug as `provider_slug` when creating private endpoints. Requires both the private endpoints and the private providers entitlements. [Management key](/docs/guides/overview/auth/management-api-keys) required.
20
+ */
21
+ export function privateProvidersCreate(client, request, options) {
22
+ return new APIPromise($do(client, request, options));
23
+ }
24
+ async function $do(client, request, options) {
25
+ const parsed = safeParse(request, (value) => operations_CreatePrivateProviderRequest$outboundSchema.parse(value), "Input validation failed");
26
+ if (!parsed.ok) {
27
+ return [parsed, { status: "invalid" }];
28
+ }
29
+ const payload = parsed.value;
30
+ const body = encodeJSON("body", payload.CreatePrivateProviderRequest, {
31
+ explode: true,
32
+ });
33
+ const path = pathToFunc("/private-providers")();
34
+ const headers = new Headers(compactMap({
35
+ "Content-Type": "application/json",
36
+ Accept: "application/json",
37
+ "HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
38
+ "X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
39
+ "X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
40
+ }));
41
+ const secConfig = await extractSecurity(client._options.apiKey);
42
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
43
+ const requestSecurity = resolveGlobalSecurity(securityInput);
44
+ const context = {
45
+ options: client._options,
46
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
47
+ operationID: "createPrivateProvider",
48
+ oAuth2Scopes: null,
49
+ resolvedSecurity: requestSecurity,
50
+ securitySource: client._options.apiKey,
51
+ retryConfig: options?.retries
52
+ || client._options.retryConfig
53
+ || {
54
+ strategy: "backoff",
55
+ backoff: {
56
+ initialInterval: 500,
57
+ maxInterval: 60000,
58
+ exponent: 1.5,
59
+ maxElapsedTime: 3600000,
60
+ },
61
+ retryConnectionErrors: true,
62
+ }
63
+ || { strategy: "none" },
64
+ retryCodes: options?.retryCodes || ["5XX"],
65
+ };
66
+ const requestRes = client._createRequest(context, {
67
+ security: requestSecurity,
68
+ method: "POST",
69
+ baseURL: options?.serverURL,
70
+ path: path,
71
+ headers: headers,
72
+ body: body,
73
+ userAgent: client._options.userAgent,
74
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
75
+ }, options);
76
+ if (!requestRes.ok) {
77
+ return [requestRes, { status: "invalid" }];
78
+ }
79
+ const req = requestRes.value;
80
+ const doResult = await client._do(req, {
81
+ context,
82
+ isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
83
+ retryConfig: context.retryConfig,
84
+ retryCodes: context.retryCodes,
85
+ });
86
+ if (!doResult.ok) {
87
+ return [doResult, { status: "request-error", request: req }];
88
+ }
89
+ const response = doResult.value;
90
+ const responseFields = {
91
+ HttpMeta: { Response: response, Request: req },
92
+ };
93
+ const [result] = await M.match(M.json(201, operations_CreatePrivateProviderResponse$inboundSchema), M.jsonErr(400, errors_BadRequestResponseError$inboundSchema), M.jsonErr(401, errors_UnauthorizedResponseError$inboundSchema), M.jsonErr(403, errors_ForbiddenResponseError$inboundSchema), M.jsonErr(404, errors_NotFoundResponseError$inboundSchema), M.jsonErr(408, errors_RequestTimeoutResponseError$inboundSchema), M.jsonErr(409, errors_ConflictResponseError$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.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
94
+ if (!result.ok) {
95
+ return [result, { status: "complete", request: req, response }];
96
+ }
97
+ return [result, { status: "complete", request: req, response }];
98
+ }
99
+ //# sourceMappingURL=privateProvidersCreate.js.map
@@ -0,0 +1,18 @@
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
+ * Delete a private provider
13
+ *
14
+ * @remarks
15
+ * Delete a private provider. Refuses (409) while any private endpoint still runs under it. [Management key](/docs/guides/overview/auth/management-api-keys) required.
16
+ */
17
+ export declare function privateProvidersDelete(client: OpenRouterCore, request: operations.DeletePrivateProviderRequest, options?: RequestOptions): APIPromise<Result<operations.DeletePrivateProviderResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.RequestTimeoutResponseError | errors.ConflictResponseError | errors.UnprocessableEntityResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
18
+ //# sourceMappingURL=privateProvidersDelete.d.ts.map
@@ -0,0 +1,102 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 1058dd5d1d38
4
+ */
5
+ import { 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 { BadGatewayResponseError$inboundSchema as errors_BadGatewayResponseError$inboundSchema } from "../models/errors/badgatewayresponseerror.js"; import { BadRequestResponseError$inboundSchema as errors_BadRequestResponseError$inboundSchema } from "../models/errors/badrequestresponseerror.js"; import { ConflictResponseError$inboundSchema as errors_ConflictResponseError$inboundSchema } from "../models/errors/conflictresponseerror.js"; import { ForbiddenResponseError$inboundSchema as errors_ForbiddenResponseError$inboundSchema } from "../models/errors/forbiddenresponseerror.js"; import { InternalServerResponseError$inboundSchema as errors_InternalServerResponseError$inboundSchema } from "../models/errors/internalserverresponseerror.js"; import { NotFoundResponseError$inboundSchema as errors_NotFoundResponseError$inboundSchema } from "../models/errors/notfoundresponseerror.js"; import { RequestTimeoutResponseError$inboundSchema as errors_RequestTimeoutResponseError$inboundSchema } from "../models/errors/requesttimeoutresponseerror.js"; import { TooManyRequestsResponseError$inboundSchema as errors_TooManyRequestsResponseError$inboundSchema } from "../models/errors/toomanyrequestsresponseerror.js"; import { UnauthorizedResponseError$inboundSchema as errors_UnauthorizedResponseError$inboundSchema } from "../models/errors/unauthorizedresponseerror.js"; import { UnprocessableEntityResponseError$inboundSchema as errors_UnprocessableEntityResponseError$inboundSchema } from "../models/errors/unprocessableentityresponseerror.js";
13
+ import { DeletePrivateProviderRequest$outboundSchema as operations_DeletePrivateProviderRequest$outboundSchema, DeletePrivateProviderResponse$inboundSchema as operations_DeletePrivateProviderResponse$inboundSchema } from "../models/operations/deleteprivateprovider.js";
14
+ import { APIPromise } from "../types/async.js";
15
+ /**
16
+ * Delete a private provider
17
+ *
18
+ * @remarks
19
+ * Delete a private provider. Refuses (409) while any private endpoint still runs under it. [Management key](/docs/guides/overview/auth/management-api-keys) required.
20
+ */
21
+ export function privateProvidersDelete(client, request, options) {
22
+ return new APIPromise($do(client, request, options));
23
+ }
24
+ async function $do(client, request, options) {
25
+ const parsed = safeParse(request, (value) => operations_DeletePrivateProviderRequest$outboundSchema.parse(value), "Input validation failed");
26
+ if (!parsed.ok) {
27
+ return [parsed, { status: "invalid" }];
28
+ }
29
+ const payload = parsed.value;
30
+ const body = null;
31
+ const pathParams = {
32
+ slug: encodeSimple("slug", payload.slug, {
33
+ explode: false,
34
+ charEncoding: "percent",
35
+ }),
36
+ };
37
+ const path = pathToFunc("/private-providers/{slug}")(pathParams);
38
+ const headers = new Headers(compactMap({
39
+ Accept: "application/json",
40
+ "HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
41
+ "X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
42
+ "X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
43
+ }));
44
+ const secConfig = await extractSecurity(client._options.apiKey);
45
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
46
+ const requestSecurity = resolveGlobalSecurity(securityInput);
47
+ const context = {
48
+ options: client._options,
49
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
50
+ operationID: "deletePrivateProvider",
51
+ oAuth2Scopes: null,
52
+ resolvedSecurity: requestSecurity,
53
+ securitySource: client._options.apiKey,
54
+ retryConfig: options?.retries
55
+ || client._options.retryConfig
56
+ || {
57
+ strategy: "backoff",
58
+ backoff: {
59
+ initialInterval: 500,
60
+ maxInterval: 60000,
61
+ exponent: 1.5,
62
+ maxElapsedTime: 3600000,
63
+ },
64
+ retryConnectionErrors: true,
65
+ }
66
+ || { strategy: "none" },
67
+ retryCodes: options?.retryCodes || ["5XX"],
68
+ };
69
+ const requestRes = client._createRequest(context, {
70
+ security: requestSecurity,
71
+ method: "DELETE",
72
+ baseURL: options?.serverURL,
73
+ path: path,
74
+ headers: headers,
75
+ body: body,
76
+ userAgent: client._options.userAgent,
77
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
78
+ }, options);
79
+ if (!requestRes.ok) {
80
+ return [requestRes, { status: "invalid" }];
81
+ }
82
+ const req = requestRes.value;
83
+ const doResult = await client._do(req, {
84
+ context,
85
+ isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
86
+ retryConfig: context.retryConfig,
87
+ retryCodes: context.retryCodes,
88
+ });
89
+ if (!doResult.ok) {
90
+ return [doResult, { status: "request-error", request: req }];
91
+ }
92
+ const response = doResult.value;
93
+ const responseFields = {
94
+ HttpMeta: { Response: response, Request: req },
95
+ };
96
+ const [result] = await M.match(M.json(200, operations_DeletePrivateProviderResponse$inboundSchema), M.jsonErr(400, errors_BadRequestResponseError$inboundSchema), M.jsonErr(401, errors_UnauthorizedResponseError$inboundSchema), M.jsonErr(403, errors_ForbiddenResponseError$inboundSchema), M.jsonErr(404, errors_NotFoundResponseError$inboundSchema), M.jsonErr(408, errors_RequestTimeoutResponseError$inboundSchema), M.jsonErr(409, errors_ConflictResponseError$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.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
97
+ if (!result.ok) {
98
+ return [result, { status: "complete", request: req, response }];
99
+ }
100
+ return [result, { status: "complete", request: req, response }];
101
+ }
102
+ //# sourceMappingURL=privateProvidersDelete.js.map
@@ -0,0 +1,18 @@
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
+ * Get a private provider
13
+ *
14
+ * @remarks
15
+ * Get one of the organization’s private providers by slug. [Management key](/docs/guides/overview/auth/management-api-keys) required.
16
+ */
17
+ export declare function privateProvidersGet(client: OpenRouterCore, request: operations.GetPrivateProviderRequest, options?: RequestOptions): APIPromise<Result<operations.GetPrivateProviderResponse, errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
18
+ //# sourceMappingURL=privateProvidersGet.d.ts.map
@@ -0,0 +1,102 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 344c6f06e04b
4
+ */
5
+ import { 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 { ForbiddenResponseError$inboundSchema as errors_ForbiddenResponseError$inboundSchema } from "../models/errors/forbiddenresponseerror.js"; import { InternalServerResponseError$inboundSchema as errors_InternalServerResponseError$inboundSchema } from "../models/errors/internalserverresponseerror.js"; import { NotFoundResponseError$inboundSchema as errors_NotFoundResponseError$inboundSchema } from "../models/errors/notfoundresponseerror.js"; import { UnauthorizedResponseError$inboundSchema as errors_UnauthorizedResponseError$inboundSchema } from "../models/errors/unauthorizedresponseerror.js";
13
+ import { GetPrivateProviderRequest$outboundSchema as operations_GetPrivateProviderRequest$outboundSchema, GetPrivateProviderResponse$inboundSchema as operations_GetPrivateProviderResponse$inboundSchema } from "../models/operations/getprivateprovider.js";
14
+ import { APIPromise } from "../types/async.js";
15
+ /**
16
+ * Get a private provider
17
+ *
18
+ * @remarks
19
+ * Get one of the organization’s private providers by slug. [Management key](/docs/guides/overview/auth/management-api-keys) required.
20
+ */
21
+ export function privateProvidersGet(client, request, options) {
22
+ return new APIPromise($do(client, request, options));
23
+ }
24
+ async function $do(client, request, options) {
25
+ const parsed = safeParse(request, (value) => operations_GetPrivateProviderRequest$outboundSchema.parse(value), "Input validation failed");
26
+ if (!parsed.ok) {
27
+ return [parsed, { status: "invalid" }];
28
+ }
29
+ const payload = parsed.value;
30
+ const body = null;
31
+ const pathParams = {
32
+ slug: encodeSimple("slug", payload.slug, {
33
+ explode: false,
34
+ charEncoding: "percent",
35
+ }),
36
+ };
37
+ const path = pathToFunc("/private-providers/{slug}")(pathParams);
38
+ const headers = new Headers(compactMap({
39
+ Accept: "application/json",
40
+ "HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
41
+ "X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
42
+ "X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
43
+ }));
44
+ const secConfig = await extractSecurity(client._options.apiKey);
45
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
46
+ const requestSecurity = resolveGlobalSecurity(securityInput);
47
+ const context = {
48
+ options: client._options,
49
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
50
+ operationID: "getPrivateProvider",
51
+ oAuth2Scopes: null,
52
+ resolvedSecurity: requestSecurity,
53
+ securitySource: client._options.apiKey,
54
+ retryConfig: options?.retries
55
+ || client._options.retryConfig
56
+ || {
57
+ strategy: "backoff",
58
+ backoff: {
59
+ initialInterval: 500,
60
+ maxInterval: 60000,
61
+ exponent: 1.5,
62
+ maxElapsedTime: 3600000,
63
+ },
64
+ retryConnectionErrors: true,
65
+ }
66
+ || { strategy: "none" },
67
+ retryCodes: options?.retryCodes || ["5XX"],
68
+ };
69
+ const requestRes = client._createRequest(context, {
70
+ security: requestSecurity,
71
+ method: "GET",
72
+ baseURL: options?.serverURL,
73
+ path: path,
74
+ headers: headers,
75
+ body: body,
76
+ userAgent: client._options.userAgent,
77
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
78
+ }, options);
79
+ if (!requestRes.ok) {
80
+ return [requestRes, { status: "invalid" }];
81
+ }
82
+ const req = requestRes.value;
83
+ const doResult = await client._do(req, {
84
+ context,
85
+ isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
86
+ retryConfig: context.retryConfig,
87
+ retryCodes: context.retryCodes,
88
+ });
89
+ if (!doResult.ok) {
90
+ return [doResult, { status: "request-error", request: req }];
91
+ }
92
+ const response = doResult.value;
93
+ const responseFields = {
94
+ HttpMeta: { Response: response, Request: req },
95
+ };
96
+ const [result] = await M.match(M.json(200, operations_GetPrivateProviderResponse$inboundSchema), M.jsonErr(401, errors_UnauthorizedResponseError$inboundSchema), M.jsonErr(403, errors_ForbiddenResponseError$inboundSchema), M.jsonErr(404, errors_NotFoundResponseError$inboundSchema), M.jsonErr(500, errors_InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
97
+ if (!result.ok) {
98
+ return [result, { status: "complete", request: req, response }];
99
+ }
100
+ return [result, { status: "complete", request: req, response }];
101
+ }
102
+ //# sourceMappingURL=privateProvidersGet.js.map
@@ -0,0 +1,18 @@
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
+ * List private providers
13
+ *
14
+ * @remarks
15
+ * List the organization's private providers. Requires the private endpoints entitlement. [Management key](/docs/guides/overview/auth/management-api-keys) required.
16
+ */
17
+ export declare function privateProvidersList(client: OpenRouterCore, request?: operations.ListPrivateProvidersRequest | undefined, options?: RequestOptions): APIPromise<Result<operations.ListPrivateProvidersResponse, errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
18
+ //# sourceMappingURL=privateProvidersList.d.ts.map