> ## Documentation Index
> Fetch the complete documentation index at: https://openrouter.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# PrivateEndpoints

> Private Endpoints endpoints

## Overview

Private Endpoints endpoints

### Available Operations

* [list](#list) - List private endpoints
* [create](#create) - Create a private endpoint
* [delete](#delete) - Delete a private endpoint
* [get](#get) - Get a private endpoint
* [update](#update) - Update a draft private endpoint
* [activate](#activate) - Activate a validated private endpoint
* [disable](#disable) - Disable a private endpoint
* [enable](#enable) - Enable a private endpoint
* [updatePricing](#updatepricing) - Set private endpoint pricing
* [validate](#validate) - Validate a draft private endpoint

## list

List the organization's private endpoints, including drafts. Requires the private endpoints entitlement. [Management key](/docs/client-sdks/typescript/docs/guides/overview/auth/management-api-keys) required.

### Example Usage

```typescript theme={null}
import { OpenRouter } from "@openrouter/sdk";

const openRouter = new OpenRouter({
  httpReferer: "<value>",
  appTitle: "<value>",
  appCategories: "<value>",
  apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
});

async function run() {
  const result = await openRouter.privateEndpoints.list();

  console.log(result);
}

run();
```

### Standalone function

The standalone function version of this method:

```typescript theme={null}
import { OpenRouterCore } from "@openrouter/sdk/core.js";
import { privateEndpointsList } from "@openrouter/sdk/funcs/privateEndpointsList.js";

// Use `OpenRouterCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const openRouter = new OpenRouterCore({
  httpReferer: "<value>",
  appTitle: "<value>",
  appCategories: "<value>",
  apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
});

async function run() {
  const res = await privateEndpointsList(openRouter);
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("privateEndpointsList failed:", res.error);
  }
}

run();
```

### Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `request` | [operations.ListPrivateEndpointsRequest](../../models/operations/listprivateendpointsrequest.mdx) | :heavy\_check\_mark: | The request object to use for the request. |
| `options` | RequestOptions | :heavy\_minus\_sign: | Used to set various options for making HTTP requests. |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy\_minus\_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.mdx) | :heavy\_minus\_sign: | Enables retrying HTTP requests under certain failure conditions. |

### Response

**Promise\<[models.ListPrivateEndpointsResponse](../../models/listprivateendpointsresponse.mdx)>**

### Errors

| Error Type | Status Code | Content Type |
| - | - | - |
| errors.UnauthorizedResponseError | 401 | application/json |
| errors.ForbiddenResponseError | 403 | application/json |
| errors.RequestTimeoutResponseError | 408 | application/json |
| errors.InternalServerResponseError | 500 | application/json |
| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* |

## create

Create a private endpoint as a draft. Drafts are not routable: validate one with `POST /private-endpoints/{id}/validate`, then activate it with `POST /private-endpoints/{id}/activate`. Pass `activate` to do all three in one call; if validation fails the draft is kept and returned with the failed checks. Send an `Idempotency-Key` header to make retries safe: a repeated key with the same request returns the endpoint the first request created; reusing it with different fields returns 422 `idempotency_key_reused`. [Management key](/docs/client-sdks/typescript/docs/guides/overview/auth/management-api-keys) required.

### Example Usage

```typescript theme={null}
import { OpenRouter } from "@openrouter/sdk";

const openRouter = new OpenRouter({
  httpReferer: "<value>",
  appTitle: "<value>",
  appCategories: "<value>",
  apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
});

async function run() {
  const result = await openRouter.privateEndpoints.create({
    createPrivateEndpointRequest: {
      modelPermaslug: "openai/gpt-4o-2024-08-06",
      providerSlug: "azure",
      upstreamModelId: "gpt-4o-prod",
    },
  });

  console.log(result);
}

run();
```

### Standalone function

The standalone function version of this method:

```typescript theme={null}
import { OpenRouterCore } from "@openrouter/sdk/core.js";
import { privateEndpointsCreate } from "@openrouter/sdk/funcs/privateEndpointsCreate.js";

// Use `OpenRouterCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const openRouter = new OpenRouterCore({
  httpReferer: "<value>",
  appTitle: "<value>",
  appCategories: "<value>",
  apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
});

async function run() {
  const res = await privateEndpointsCreate(openRouter, {
    createPrivateEndpointRequest: {
      modelPermaslug: "openai/gpt-4o-2024-08-06",
      providerSlug: "azure",
      upstreamModelId: "gpt-4o-prod",
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("privateEndpointsCreate failed:", res.error);
  }
}

run();
```

### Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `request` | [operations.CreatePrivateEndpointRequest](../../models/operations/createprivateendpointrequest.mdx) | :heavy\_check\_mark: | The request object to use for the request. |
| `options` | RequestOptions | :heavy\_minus\_sign: | Used to set various options for making HTTP requests. |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy\_minus\_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.mdx) | :heavy\_minus\_sign: | Enables retrying HTTP requests under certain failure conditions. |

### Response

**Promise\<[models.ManagedPrivateEndpointResponse](../../models/managedprivateendpointresponse.mdx)>**

### Errors

| Error Type | Status Code | Content Type |
| - | - | - |
| errors.BadRequestResponseError | 400 | application/json |
| errors.UnauthorizedResponseError | 401 | application/json |
| errors.ForbiddenResponseError | 403 | application/json |
| errors.CreatePrivateEndpointValidationFailedResponseError | 404 | application/json |
| errors.NotFoundResponseError | 404 | application/json |
| errors.RequestTimeoutResponseError | 408 | application/json |
| errors.CreatePrivateEndpointValidationFailedResponseError | 409 | application/json |
| errors.ConflictResponseError | 409 | application/json |
| errors.CreatePrivateEndpointValidationFailedResponseError | 422 | application/json |
| errors.UnprocessableEntityResponseError | 422 | application/json |
| errors.CreatePrivateEndpointValidationFailedResponseError | 500 | application/json |
| errors.InternalServerResponseError | 500 | application/json |
| errors.CreatePrivateEndpointValidationFailedResponseError | 502 | application/json |
| errors.BadGatewayResponseError | 502 | application/json |
| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* |

## delete

Delete a private endpoint and stop routing to it. Pass `draft_only=true` to refuse (409) when the endpoint has been activated. [Management key](/docs/client-sdks/typescript/docs/guides/overview/auth/management-api-keys) required.

### Example Usage

```typescript theme={null}
import { OpenRouter } from "@openrouter/sdk";

const openRouter = new OpenRouter({
  httpReferer: "<value>",
  appTitle: "<value>",
  appCategories: "<value>",
  apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
});

async function run() {
  const result = await openRouter.privateEndpoints.delete({
    id: "5b1c4c4e-7d0a-4a8e-9f3a-2d6c1b0e8a11",
  });

  console.log(result);
}

run();
```

### Standalone function

The standalone function version of this method:

```typescript theme={null}
import { OpenRouterCore } from "@openrouter/sdk/core.js";
import { privateEndpointsDelete } from "@openrouter/sdk/funcs/privateEndpointsDelete.js";

// Use `OpenRouterCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const openRouter = new OpenRouterCore({
  httpReferer: "<value>",
  appTitle: "<value>",
  appCategories: "<value>",
  apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
});

async function run() {
  const res = await privateEndpointsDelete(openRouter, {
    id: "5b1c4c4e-7d0a-4a8e-9f3a-2d6c1b0e8a11",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("privateEndpointsDelete failed:", res.error);
  }
}

run();
```

### Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `request` | [operations.DeletePrivateEndpointRequest](../../models/operations/deleteprivateendpointrequest.mdx) | :heavy\_check\_mark: | The request object to use for the request. |
| `options` | RequestOptions | :heavy\_minus\_sign: | Used to set various options for making HTTP requests. |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy\_minus\_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.mdx) | :heavy\_minus\_sign: | Enables retrying HTTP requests under certain failure conditions. |

### Response

**Promise\<[models.DeletePrivateEndpointResponse](../../models/deleteprivateendpointresponse.mdx)>**

### Errors

| Error Type | Status Code | Content Type |
| - | - | - |
| errors.BadRequestResponseError | 400 | application/json |
| errors.UnauthorizedResponseError | 401 | application/json |
| errors.ForbiddenResponseError | 403 | application/json |
| errors.NotFoundResponseError | 404 | application/json |
| errors.RequestTimeoutResponseError | 408 | application/json |
| errors.ConflictResponseError | 409 | application/json |
| errors.UnprocessableEntityResponseError | 422 | application/json |
| errors.InternalServerResponseError | 500 | application/json |
| errors.BadGatewayResponseError | 502 | application/json |
| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* |

## get

Get one private endpoint with its upstream configuration and current pricing. [Management key](/docs/client-sdks/typescript/docs/guides/overview/auth/management-api-keys) required.

### Example Usage

```typescript theme={null}
import { OpenRouter } from "@openrouter/sdk";

const openRouter = new OpenRouter({
  httpReferer: "<value>",
  appTitle: "<value>",
  appCategories: "<value>",
  apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
});

async function run() {
  const result = await openRouter.privateEndpoints.get({
    id: "5b1c4c4e-7d0a-4a8e-9f3a-2d6c1b0e8a11",
  });

  console.log(result);
}

run();
```

### Standalone function

The standalone function version of this method:

```typescript theme={null}
import { OpenRouterCore } from "@openrouter/sdk/core.js";
import { privateEndpointsGet } from "@openrouter/sdk/funcs/privateEndpointsGet.js";

// Use `OpenRouterCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const openRouter = new OpenRouterCore({
  httpReferer: "<value>",
  appTitle: "<value>",
  appCategories: "<value>",
  apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
});

async function run() {
  const res = await privateEndpointsGet(openRouter, {
    id: "5b1c4c4e-7d0a-4a8e-9f3a-2d6c1b0e8a11",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("privateEndpointsGet failed:", res.error);
  }
}

run();
```

### Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `request` | [operations.GetPrivateEndpointRequest](../../models/operations/getprivateendpointrequest.mdx) | :heavy\_check\_mark: | The request object to use for the request. |
| `options` | RequestOptions | :heavy\_minus\_sign: | Used to set various options for making HTTP requests. |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy\_minus\_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.mdx) | :heavy\_minus\_sign: | Enables retrying HTTP requests under certain failure conditions. |

### Response

**Promise\<[models.PrivateEndpointResponse](../../models/privateendpointresponse.mdx)>**

### Errors

| Error Type | Status Code | Content Type |
| - | - | - |
| errors.UnauthorizedResponseError | 401 | application/json |
| errors.ForbiddenResponseError | 403 | application/json |
| errors.NotFoundResponseError | 404 | application/json |
| errors.RequestTimeoutResponseError | 408 | application/json |
| errors.InternalServerResponseError | 500 | application/json |
| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* |

## update

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/client-sdks/typescript/docs/guides/overview/auth/management-api-keys) required.

### Example Usage

```typescript theme={null}
import { OpenRouter } from "@openrouter/sdk";

const openRouter = new OpenRouter({
  httpReferer: "<value>",
  appTitle: "<value>",
  appCategories: "<value>",
  apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
});

async function run() {
  const result = await openRouter.privateEndpoints.update({
    id: "5b1c4c4e-7d0a-4a8e-9f3a-2d6c1b0e8a11",
    updatePrivateEndpointRequest: {
      upstreamModelId: "gpt-4o-prod",
    },
  });

  console.log(result);
}

run();
```

### Standalone function

The standalone function version of this method:

```typescript theme={null}
import { OpenRouterCore } from "@openrouter/sdk/core.js";
import { privateEndpointsUpdate } from "@openrouter/sdk/funcs/privateEndpointsUpdate.js";

// Use `OpenRouterCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const openRouter = new OpenRouterCore({
  httpReferer: "<value>",
  appTitle: "<value>",
  appCategories: "<value>",
  apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
});

async function run() {
  const res = await privateEndpointsUpdate(openRouter, {
    id: "5b1c4c4e-7d0a-4a8e-9f3a-2d6c1b0e8a11",
    updatePrivateEndpointRequest: {
      upstreamModelId: "gpt-4o-prod",
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("privateEndpointsUpdate failed:", res.error);
  }
}

run();
```

### Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `request` | [operations.UpdatePrivateEndpointRequest](../../models/operations/updateprivateendpointrequest.mdx) | :heavy\_check\_mark: | The request object to use for the request. |
| `options` | RequestOptions | :heavy\_minus\_sign: | Used to set various options for making HTTP requests. |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy\_minus\_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.mdx) | :heavy\_minus\_sign: | Enables retrying HTTP requests under certain failure conditions. |

### Response

**Promise\<[models.PrivateEndpointResponse](../../models/privateendpointresponse.mdx)>**

### Errors

| Error Type | Status Code | Content Type |
| - | - | - |
| errors.BadRequestResponseError | 400 | application/json |
| errors.UnauthorizedResponseError | 401 | application/json |
| errors.ForbiddenResponseError | 403 | application/json |
| errors.NotFoundResponseError | 404 | application/json |
| errors.RequestTimeoutResponseError | 408 | application/json |
| errors.ConflictResponseError | 409 | application/json |
| errors.UnprocessableEntityResponseError | 422 | application/json |
| errors.InternalServerResponseError | 500 | application/json |
| errors.BadGatewayResponseError | 502 | application/json |
| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* |

## activate

Make a validated draft routable. Returns 409 when the endpoint was never validated, the validation is stale, or it is already active. [Management key](/docs/client-sdks/typescript/docs/guides/overview/auth/management-api-keys) required.

### Example Usage

```typescript theme={null}
import { OpenRouter } from "@openrouter/sdk";

const openRouter = new OpenRouter({
  httpReferer: "<value>",
  appTitle: "<value>",
  appCategories: "<value>",
  apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
});

async function run() {
  const result = await openRouter.privateEndpoints.activate({
    id: "5b1c4c4e-7d0a-4a8e-9f3a-2d6c1b0e8a11",
  });

  console.log(result);
}

run();
```

### Standalone function

The standalone function version of this method:

```typescript theme={null}
import { OpenRouterCore } from "@openrouter/sdk/core.js";
import { privateEndpointsActivate } from "@openrouter/sdk/funcs/privateEndpointsActivate.js";

// Use `OpenRouterCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const openRouter = new OpenRouterCore({
  httpReferer: "<value>",
  appTitle: "<value>",
  appCategories: "<value>",
  apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
});

async function run() {
  const res = await privateEndpointsActivate(openRouter, {
    id: "5b1c4c4e-7d0a-4a8e-9f3a-2d6c1b0e8a11",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("privateEndpointsActivate failed:", res.error);
  }
}

run();
```

### Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `request` | [operations.ActivatePrivateEndpointRequest](../../models/operations/activateprivateendpointrequest.mdx) | :heavy\_check\_mark: | The request object to use for the request. |
| `options` | RequestOptions | :heavy\_minus\_sign: | Used to set various options for making HTTP requests. |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy\_minus\_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.mdx) | :heavy\_minus\_sign: | Enables retrying HTTP requests under certain failure conditions. |

### Response

**Promise\<[models.ManagedPrivateEndpointResponse](../../models/managedprivateendpointresponse.mdx)>**

### Errors

| Error Type | Status Code | Content Type |
| - | - | - |
| errors.BadRequestResponseError | 400 | application/json |
| errors.UnauthorizedResponseError | 401 | application/json |
| errors.ForbiddenResponseError | 403 | application/json |
| errors.NotFoundResponseError | 404 | application/json |
| errors.RequestTimeoutResponseError | 408 | application/json |
| errors.ConflictResponseError | 409 | application/json |
| errors.UnprocessableEntityResponseError | 422 | application/json |
| errors.InternalServerResponseError | 500 | application/json |
| errors.BadGatewayResponseError | 502 | application/json |
| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* |

## disable

Stop routing to an active endpoint without deleting it. [Management key](/docs/client-sdks/typescript/docs/guides/overview/auth/management-api-keys) required.

### Example Usage

```typescript theme={null}
import { OpenRouter } from "@openrouter/sdk";

const openRouter = new OpenRouter({
  httpReferer: "<value>",
  appTitle: "<value>",
  appCategories: "<value>",
  apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
});

async function run() {
  const result = await openRouter.privateEndpoints.disable({
    id: "5b1c4c4e-7d0a-4a8e-9f3a-2d6c1b0e8a11",
  });

  console.log(result);
}

run();
```

### Standalone function

The standalone function version of this method:

```typescript theme={null}
import { OpenRouterCore } from "@openrouter/sdk/core.js";
import { privateEndpointsDisable } from "@openrouter/sdk/funcs/privateEndpointsDisable.js";

// Use `OpenRouterCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const openRouter = new OpenRouterCore({
  httpReferer: "<value>",
  appTitle: "<value>",
  appCategories: "<value>",
  apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
});

async function run() {
  const res = await privateEndpointsDisable(openRouter, {
    id: "5b1c4c4e-7d0a-4a8e-9f3a-2d6c1b0e8a11",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("privateEndpointsDisable failed:", res.error);
  }
}

run();
```

### Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `request` | [operations.DisablePrivateEndpointRequest](../../models/operations/disableprivateendpointrequest.mdx) | :heavy\_check\_mark: | The request object to use for the request. |
| `options` | RequestOptions | :heavy\_minus\_sign: | Used to set various options for making HTTP requests. |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy\_minus\_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.mdx) | :heavy\_minus\_sign: | Enables retrying HTTP requests under certain failure conditions. |

### Response

**Promise\<[models.ManagedPrivateEndpointResponse](../../models/managedprivateendpointresponse.mdx)>**

### Errors

| Error Type | Status Code | Content Type |
| - | - | - |
| errors.BadRequestResponseError | 400 | application/json |
| errors.UnauthorizedResponseError | 401 | application/json |
| errors.ForbiddenResponseError | 403 | application/json |
| errors.NotFoundResponseError | 404 | application/json |
| errors.RequestTimeoutResponseError | 408 | application/json |
| errors.ConflictResponseError | 409 | application/json |
| errors.UnprocessableEntityResponseError | 422 | application/json |
| errors.InternalServerResponseError | 500 | application/json |
| errors.BadGatewayResponseError | 502 | application/json |
| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* |

## enable

Resume routing to a disabled endpoint. [Management key](/docs/client-sdks/typescript/docs/guides/overview/auth/management-api-keys) required.

### Example Usage

```typescript theme={null}
import { OpenRouter } from "@openrouter/sdk";

const openRouter = new OpenRouter({
  httpReferer: "<value>",
  appTitle: "<value>",
  appCategories: "<value>",
  apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
});

async function run() {
  const result = await openRouter.privateEndpoints.enable({
    id: "5b1c4c4e-7d0a-4a8e-9f3a-2d6c1b0e8a11",
  });

  console.log(result);
}

run();
```

### Standalone function

The standalone function version of this method:

```typescript theme={null}
import { OpenRouterCore } from "@openrouter/sdk/core.js";
import { privateEndpointsEnable } from "@openrouter/sdk/funcs/privateEndpointsEnable.js";

// Use `OpenRouterCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const openRouter = new OpenRouterCore({
  httpReferer: "<value>",
  appTitle: "<value>",
  appCategories: "<value>",
  apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
});

async function run() {
  const res = await privateEndpointsEnable(openRouter, {
    id: "5b1c4c4e-7d0a-4a8e-9f3a-2d6c1b0e8a11",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("privateEndpointsEnable failed:", res.error);
  }
}

run();
```

### Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `request` | [operations.EnablePrivateEndpointRequest](../../models/operations/enableprivateendpointrequest.mdx) | :heavy\_check\_mark: | The request object to use for the request. |
| `options` | RequestOptions | :heavy\_minus\_sign: | Used to set various options for making HTTP requests. |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy\_minus\_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.mdx) | :heavy\_minus\_sign: | Enables retrying HTTP requests under certain failure conditions. |

### Response

**Promise\<[models.ManagedPrivateEndpointResponse](../../models/managedprivateendpointresponse.mdx)>**

### Errors

| Error Type | Status Code | Content Type |
| - | - | - |
| errors.BadRequestResponseError | 400 | application/json |
| errors.UnauthorizedResponseError | 401 | application/json |
| errors.ForbiddenResponseError | 403 | application/json |
| errors.NotFoundResponseError | 404 | application/json |
| errors.RequestTimeoutResponseError | 408 | application/json |
| errors.ConflictResponseError | 409 | application/json |
| errors.UnprocessableEntityResponseError | 422 | application/json |
| errors.InternalServerResponseError | 500 | application/json |
| errors.BadGatewayResponseError | 502 | application/json |
| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* |

## updatePricing

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. [Management key](/docs/client-sdks/typescript/docs/guides/overview/auth/management-api-keys) required.

### Example Usage

```typescript theme={null}
import { OpenRouter } from "@openrouter/sdk";

const openRouter = new OpenRouter({
  httpReferer: "<value>",
  appTitle: "<value>",
  appCategories: "<value>",
  apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
});

async function run() {
  const result = await openRouter.privateEndpoints.updatePricing({
    id: "5b1c4c4e-7d0a-4a8e-9f3a-2d6c1b0e8a11",
    updatePrivateEndpointPricingRequest: {
      pricing: {
        completion: "0.00001",
        prompt: "0.0000025",
      },
    },
  });

  console.log(result);
}

run();
```

### Standalone function

The standalone function version of this method:

```typescript theme={null}
import { OpenRouterCore } from "@openrouter/sdk/core.js";
import { privateEndpointsUpdatePricing } from "@openrouter/sdk/funcs/privateEndpointsUpdatePricing.js";

// Use `OpenRouterCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const openRouter = new OpenRouterCore({
  httpReferer: "<value>",
  appTitle: "<value>",
  appCategories: "<value>",
  apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
});

async function run() {
  const res = await privateEndpointsUpdatePricing(openRouter, {
    id: "5b1c4c4e-7d0a-4a8e-9f3a-2d6c1b0e8a11",
    updatePrivateEndpointPricingRequest: {
      pricing: {
        completion: "0.00001",
        prompt: "0.0000025",
      },
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("privateEndpointsUpdatePricing failed:", res.error);
  }
}

run();
```

### Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `request` | [operations.UpdatePrivateEndpointPricingRequest](../../models/operations/updateprivateendpointpricingrequest.mdx) | :heavy\_check\_mark: | The request object to use for the request. |
| `options` | RequestOptions | :heavy\_minus\_sign: | Used to set various options for making HTTP requests. |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy\_minus\_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.mdx) | :heavy\_minus\_sign: | Enables retrying HTTP requests under certain failure conditions. |

### Response

**Promise\<[models.PrivateEndpointResponse](../../models/privateendpointresponse.mdx)>**

### Errors

| Error Type | Status Code | Content Type |
| - | - | - |
| errors.BadRequestResponseError | 400 | application/json |
| errors.UnauthorizedResponseError | 401 | application/json |
| errors.ForbiddenResponseError | 403 | application/json |
| errors.NotFoundResponseError | 404 | application/json |
| errors.RequestTimeoutResponseError | 408 | application/json |
| errors.ConflictResponseError | 409 | application/json |
| errors.UnprocessableEntityResponseError | 422 | application/json |
| errors.InternalServerResponseError | 500 | application/json |
| errors.BadGatewayResponseError | 502 | application/json |
| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* |

## validate

Send a live test request to the draft endpoint using the given workspace's BYOK credential for its provider. A passing validation is required before activation. Failed checks return 200 with `passed: false`. [Management key](/docs/client-sdks/typescript/docs/guides/overview/auth/management-api-keys) required.

### Example Usage

```typescript theme={null}
import { OpenRouter } from "@openrouter/sdk";

const openRouter = new OpenRouter({
  httpReferer: "<value>",
  appTitle: "<value>",
  appCategories: "<value>",
  apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
});

async function run() {
  const result = await openRouter.privateEndpoints.validate({
    id: "5b1c4c4e-7d0a-4a8e-9f3a-2d6c1b0e8a11",
    validatePrivateEndpointRequest: {
      workspaceId: "550e8400-e29b-41d4-a716-446655440000",
    },
  });

  console.log(result);
}

run();
```

### Standalone function

The standalone function version of this method:

```typescript theme={null}
import { OpenRouterCore } from "@openrouter/sdk/core.js";
import { privateEndpointsValidate } from "@openrouter/sdk/funcs/privateEndpointsValidate.js";

// Use `OpenRouterCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const openRouter = new OpenRouterCore({
  httpReferer: "<value>",
  appTitle: "<value>",
  appCategories: "<value>",
  apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
});

async function run() {
  const res = await privateEndpointsValidate(openRouter, {
    id: "5b1c4c4e-7d0a-4a8e-9f3a-2d6c1b0e8a11",
    validatePrivateEndpointRequest: {
      workspaceId: "550e8400-e29b-41d4-a716-446655440000",
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("privateEndpointsValidate failed:", res.error);
  }
}

run();
```

### Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `request` | [operations.ValidatePrivateEndpointRequest](../../models/operations/validateprivateendpointrequest.mdx) | :heavy\_check\_mark: | The request object to use for the request. |
| `options` | RequestOptions | :heavy\_minus\_sign: | Used to set various options for making HTTP requests. |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy\_minus\_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.mdx) | :heavy\_minus\_sign: | Enables retrying HTTP requests under certain failure conditions. |

### Response

**Promise\<[models.PrivateEndpointValidationResponse](../../models/privateendpointvalidationresponse.mdx)>**

### Errors

| Error Type | Status Code | Content Type |
| - | - | - |
| errors.BadRequestResponseError | 400 | application/json |
| errors.UnauthorizedResponseError | 401 | application/json |
| errors.ForbiddenResponseError | 403 | application/json |
| errors.NotFoundResponseError | 404 | application/json |
| errors.RequestTimeoutResponseError | 408 | application/json |
| errors.ConflictResponseError | 409 | application/json |
| errors.UnprocessableEntityResponseError | 422 | application/json |
| errors.InternalServerResponseError | 500 | application/json |
| errors.BadGatewayResponseError | 502 | application/json |
| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* |
