For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://modelgates.ai/docs/_mcp/server.
Guardrails - TypeScript SDK
The TypeScript SDK and docs are currently in beta. Report issues on GitHub.
Overview
Guardrails endpoints
Available Operations
- list - List guardrails
- create - Create a guardrail
- delete - Delete a guardrail
- get - Get a guardrail
- update - Update a guardrail
- listGuardrailKeyAssignments - List key assignments for a guardrail
- bulkAssignKeys - Bulk assign keys to a guardrail
- bulkUnassignKeys - Bulk unassign keys from a guardrail
- listGuardrailMemberAssignments - List member assignments for a guardrail
- bulkAssignMembers - Bulk assign members to a guardrail
- bulkUnassignMembers - Bulk unassign members from a guardrail
- listKeyAssignments - List all key assignments
- listMemberAssignments - List all member assignments
list
List all guardrails for the authenticated user. Management key required.
Example Usage
import { ModelGates } from "@modelgates/sdk"; const modelgates = new ModelGates({ httpReferer: "<value>", appTitle: "<value>", appCategories: "<value>", apiKey: process.env["MODELGATES_API_KEY"] ?? "",}); async function run() { const result = await modelgates.guardrails.list(); for await (const page of result) { console.log(page); }} run();Standalone function
The standalone function version of this method:
import { ModelGatesCore } from "@modelgates/sdk/core.js";import { guardrailsList } from "@modelgates/sdk/funcs/guardrailsList.js"; // Use `ModelGatesCore` for best tree-shaking performance.// You can create one instance of it to use across an application.const modelgates = new ModelGatesCore({ httpReferer: "<value>", appTitle: "<value>", appCategories: "<value>", apiKey: process.env["MODELGATES_API_KEY"] ?? "",}); async function run() { const res = await guardrailsList(modelgates); if (res.ok) { const { value: result } = res; for await (const page of result) { console.log(page); } } else { console.log("guardrailsList failed:", res.error); }} run();Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.ListGuardrailsRequest | :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 | :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 | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<operations.ListGuardrailsResponse>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.UnauthorizedResponseError | 401 | application/json |
| errors.InternalServerResponseError | 500 | application/json |
| errors.ModelGatesDefaultError | 4XX, 5XX | */* |
create
Create a new guardrail for the authenticated user. Management key required.
Example Usage
import { ModelGates } from "@modelgates/sdk"; const modelgates = new ModelGates({ httpReferer: "<value>", appTitle: "<value>", appCategories: "<value>", apiKey: process.env["MODELGATES_API_KEY"] ?? "",}); async function run() { const result = await modelgates.guardrails.create({ createGuardrailRequest: { allowedModels: null, allowedProviders: [ "openai", "anthropic", "deepseek", ], description: "A guardrail for limiting API usage", enforceZdrAnthropic: true, enforceZdrGoogle: false, enforceZdrOpenai: true, enforceZdrOther: false, ignoredModels: null, ignoredProviders: null, limitUsd: 50, name: "My New Guardrail", resetInterval: "monthly", }, }); console.log(result);} run();Standalone function
The standalone function version of this method:
import { ModelGatesCore } from "@modelgates/sdk/core.js";import { guardrailsCreate } from "@modelgates/sdk/funcs/guardrailsCreate.js"; // Use `ModelGatesCore` for best tree-shaking performance.// You can create one instance of it to use across an application.const modelgates = new ModelGatesCore({ httpReferer: "<value>", appTitle: "<value>", appCategories: "<value>", apiKey: process.env["MODELGATES_API_KEY"] ?? "",}); async function run() { const res = await guardrailsCreate(modelgates, { createGuardrailRequest: { allowedModels: null, allowedProviders: [ "openai", "anthropic", "deepseek", ], description: "A guardrail for limiting API usage", enforceZdrAnthropic: true, enforceZdrGoogle: false, enforceZdrOpenai: true, enforceZdrOther: false, ignoredModels: null, ignoredProviders: null, limitUsd: 50, name: "My New Guardrail", resetInterval: "monthly", }, }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("guardrailsCreate failed:", res.error); }} run();Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.CreateGuardrailRequest | :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 | :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 | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<models.CreateGuardrailResponse>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.BadRequestResponseError | 400 | application/json |
| errors.UnauthorizedResponseError | 401 | application/json |
| errors.ForbiddenResponseError | 403 | application/json |
| errors.InternalServerResponseError | 500 | application/json |
| errors.ModelGatesDefaultError | 4XX, 5XX | */* |
delete
Delete an existing guardrail. Management key required.
Example Usage
import { ModelGates } from "@modelgates/sdk"; const modelgates = new ModelGates({ httpReferer: "<value>", appTitle: "<value>", appCategories: "<value>", apiKey: process.env["MODELGATES_API_KEY"] ?? "",}); async function run() { const result = await modelgates.guardrails.delete({ id: "550e8400-e29b-41d4-a716-446655440000", }); console.log(result);} run();Standalone function
The standalone function version of this method:
import { ModelGatesCore } from "@modelgates/sdk/core.js";import { guardrailsDelete } from "@modelgates/sdk/funcs/guardrailsDelete.js"; // Use `ModelGatesCore` for best tree-shaking performance.// You can create one instance of it to use across an application.const modelgates = new ModelGatesCore({ httpReferer: "<value>", appTitle: "<value>", appCategories: "<value>", apiKey: process.env["MODELGATES_API_KEY"] ?? "",}); async function run() { const res = await guardrailsDelete(modelgates, { id: "550e8400-e29b-41d4-a716-446655440000", }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("guardrailsDelete failed:", res.error); }} run();Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.DeleteGuardrailRequest | :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 | :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 | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<models.DeleteGuardrailResponse>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.UnauthorizedResponseError | 401 | application/json |
| errors.NotFoundResponseError | 404 | application/json |
| errors.InternalServerResponseError | 500 | application/json |
| errors.ModelGatesDefaultError | 4XX, 5XX | */* |
get
Get a single guardrail by ID. Management key required.
Example Usage
import { ModelGates } from "@modelgates/sdk"; const modelgates = new ModelGates({ httpReferer: "<value>", appTitle: "<value>", appCategories: "<value>", apiKey: process.env["MODELGATES_API_KEY"] ?? "",}); async function run() { const result = await modelgates.guardrails.get({ id: "550e8400-e29b-41d4-a716-446655440000", }); console.log(result);} run();Standalone function
The standalone function version of this method:
import { ModelGatesCore } from "@modelgates/sdk/core.js";import { guardrailsGet } from "@modelgates/sdk/funcs/guardrailsGet.js"; // Use `ModelGatesCore` for best tree-shaking performance.// You can create one instance of it to use across an application.const modelgates = new ModelGatesCore({ httpReferer: "<value>", appTitle: "<value>", appCategories: "<value>", apiKey: process.env["MODELGATES_API_KEY"] ?? "",}); async function run() { const res = await guardrailsGet(modelgates, { id: "550e8400-e29b-41d4-a716-446655440000", }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("guardrailsGet failed:", res.error); }} run();Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.GetGuardrailRequest | :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 | :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 | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<models.GetGuardrailResponse>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.UnauthorizedResponseError | 401 | application/json |
| errors.NotFoundResponseError | 404 | application/json |
| errors.InternalServerResponseError | 500 | application/json |
| errors.ModelGatesDefaultError | 4XX, 5XX | */* |
update
Update an existing guardrail. Management key required.
Example Usage
import { ModelGates } from "@modelgates/sdk"; const modelgates = new ModelGates({ httpReferer: "<value>", appTitle: "<value>", appCategories: "<value>", apiKey: process.env["MODELGATES_API_KEY"] ?? "",}); async function run() { const result = await modelgates.guardrails.update({ id: "550e8400-e29b-41d4-a716-446655440000", updateGuardrailRequest: { description: "Updated description", limitUsd: 75, name: "Updated Guardrail Name", resetInterval: "weekly", }, }); console.log(result);} run();Standalone function
The standalone function version of this method:
import { ModelGatesCore } from "@modelgates/sdk/core.js";import { guardrailsUpdate } from "@modelgates/sdk/funcs/guardrailsUpdate.js"; // Use `ModelGatesCore` for best tree-shaking performance.// You can create one instance of it to use across an application.const modelgates = new ModelGatesCore({ httpReferer: "<value>", appTitle: "<value>", appCategories: "<value>", apiKey: process.env["MODELGATES_API_KEY"] ?? "",}); async function run() { const res = await guardrailsUpdate(modelgates, { id: "550e8400-e29b-41d4-a716-446655440000", updateGuardrailRequest: { description: "Updated description", limitUsd: 75, name: "Updated Guardrail Name", resetInterval: "weekly", }, }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("guardrailsUpdate failed:", res.error); }} run();Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.UpdateGuardrailRequest | :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 | :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 | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<models.UpdateGuardrailResponse>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.BadRequestResponseError | 400 | application/json |
| errors.UnauthorizedResponseError | 401 | application/json |
| errors.NotFoundResponseError | 404 | application/json |
| errors.InternalServerResponseError | 500 | application/json |
| errors.ModelGatesDefaultError | 4XX, 5XX | */* |
listGuardrailKeyAssignments
List all API key assignments for a specific guardrail. Management key required.
Example Usage
import { ModelGates } from "@modelgates/sdk"; const modelgates = new ModelGates({ httpReferer: "<value>", appTitle: "<value>", appCategories: "<value>", apiKey: process.env["MODELGATES_API_KEY"] ?? "",}); async function run() { const result = await modelgates.guardrails.listGuardrailKeyAssignments({ id: "550e8400-e29b-41d4-a716-446655440000", }); for await (const page of result) { console.log(page); }} run();Standalone function
The standalone function version of this method:
import { ModelGatesCore } from "@modelgates/sdk/core.js";import { guardrailsListGuardrailKeyAssignments } from "@modelgates/sdk/funcs/guardrailsListGuardrailKeyAssignments.js"; // Use `ModelGatesCore` for best tree-shaking performance.// You can create one instance of it to use across an application.const modelgates = new ModelGatesCore({ httpReferer: "<value>", appTitle: "<value>", appCategories: "<value>", apiKey: process.env["MODELGATES_API_KEY"] ?? "",}); async function run() { const res = await guardrailsListGuardrailKeyAssignments(modelgates, { id: "550e8400-e29b-41d4-a716-446655440000", }); if (res.ok) { const { value: result } = res; for await (const page of result) { console.log(page); } } else { console.log("guardrailsListGuardrailKeyAssignments failed:", res.error); }} run();Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.ListGuardrailKeyAssignmentsRequest | :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 | :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 | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<operations.ListGuardrailKeyAssignmentsResponse>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.UnauthorizedResponseError | 401 | application/json |
| errors.NotFoundResponseError | 404 | application/json |
| errors.InternalServerResponseError | 500 | application/json |
| errors.ModelGatesDefaultError | 4XX, 5XX | */* |
bulkAssignKeys
Assign multiple API keys to a specific guardrail. Management key required.
Example Usage
import { ModelGates } from "@modelgates/sdk"; const modelgates = new ModelGates({ httpReferer: "<value>", appTitle: "<value>", appCategories: "<value>", apiKey: process.env["MODELGATES_API_KEY"] ?? "",}); async function run() { const result = await modelgates.guardrails.bulkAssignKeys({ id: "550e8400-e29b-41d4-a716-446655440000", bulkAssignKeysRequest: { keyHashes: [ "c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93", ], }, }); console.log(result);} run();Standalone function
The standalone function version of this method:
import { ModelGatesCore } from "@modelgates/sdk/core.js";import { guardrailsBulkAssignKeys } from "@modelgates/sdk/funcs/guardrailsBulkAssignKeys.js"; // Use `ModelGatesCore` for best tree-shaking performance.// You can create one instance of it to use across an application.const modelgates = new ModelGatesCore({ httpReferer: "<value>", appTitle: "<value>", appCategories: "<value>", apiKey: process.env["MODELGATES_API_KEY"] ?? "",}); async function run() { const res = await guardrailsBulkAssignKeys(modelgates, { id: "550e8400-e29b-41d4-a716-446655440000", bulkAssignKeysRequest: { keyHashes: [ "c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93", ], }, }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("guardrailsBulkAssignKeys failed:", res.error); }} run();Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.BulkAssignKeysToGuardrailRequest | :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 | :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 | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<models.BulkAssignKeysResponse>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.BadRequestResponseError | 400 | application/json |
| errors.UnauthorizedResponseError | 401 | application/json |
| errors.NotFoundResponseError | 404 | application/json |
| errors.InternalServerResponseError | 500 | application/json |
| errors.ModelGatesDefaultError | 4XX, 5XX | */* |
bulkUnassignKeys
Unassign multiple API keys from a specific guardrail. Management key required.
Example Usage
import { ModelGates } from "@modelgates/sdk"; const modelgates = new ModelGates({ httpReferer: "<value>", appTitle: "<value>", appCategories: "<value>", apiKey: process.env["MODELGATES_API_KEY"] ?? "",}); async function run() { const result = await modelgates.guardrails.bulkUnassignKeys({ id: "550e8400-e29b-41d4-a716-446655440000", bulkUnassignKeysRequest: { keyHashes: [ "c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93", ], }, }); console.log(result);} run();Standalone function
The standalone function version of this method:
import { ModelGatesCore } from "@modelgates/sdk/core.js";import { guardrailsBulkUnassignKeys } from "@modelgates/sdk/funcs/guardrailsBulkUnassignKeys.js"; // Use `ModelGatesCore` for best tree-shaking performance.// You can create one instance of it to use across an application.const modelgates = new ModelGatesCore({ httpReferer: "<value>", appTitle: "<value>", appCategories: "<value>", apiKey: process.env["MODELGATES_API_KEY"] ?? "",}); async function run() { const res = await guardrailsBulkUnassignKeys(modelgates, { id: "550e8400-e29b-41d4-a716-446655440000", bulkUnassignKeysRequest: { keyHashes: [ "c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93", ], }, }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("guardrailsBulkUnassignKeys failed:", res.error); }} run();Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.BulkUnassignKeysFromGuardrailRequest | :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 | :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 | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<models.BulkUnassignKeysResponse>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.BadRequestResponseError | 400 | application/json |
| errors.UnauthorizedResponseError | 401 | application/json |
| errors.NotFoundResponseError | 404 | application/json |
| errors.InternalServerResponseError | 500 | application/json |
| errors.ModelGatesDefaultError | 4XX, 5XX | */* |
listGuardrailMemberAssignments
List all organization member assignments for a specific guardrail. Management key required.
Example Usage
import { ModelGates } from "@modelgates/sdk"; const modelgates = new ModelGates({ httpReferer: "<value>", appTitle: "<value>", appCategories: "<value>", apiKey: process.env["MODELGATES_API_KEY"] ?? "",}); async function run() { const result = await modelgates.guardrails.listGuardrailMemberAssignments({ id: "550e8400-e29b-41d4-a716-446655440000", }); for await (const page of result) { console.log(page); }} run();Standalone function
The standalone function version of this method:
import { ModelGatesCore } from "@modelgates/sdk/core.js";import { guardrailsListGuardrailMemberAssignments } from "@modelgates/sdk/funcs/guardrailsListGuardrailMemberAssignments.js"; // Use `ModelGatesCore` for best tree-shaking performance.// You can create one instance of it to use across an application.const modelgates = new ModelGatesCore({ httpReferer: "<value>", appTitle: "<value>", appCategories: "<value>", apiKey: process.env["MODELGATES_API_KEY"] ?? "",}); async function run() { const res = await guardrailsListGuardrailMemberAssignments(modelgates, { id: "550e8400-e29b-41d4-a716-446655440000", }); if (res.ok) { const { value: result } = res; for await (const page of result) { console.log(page); } } else { console.log("guardrailsListGuardrailMemberAssignments failed:", res.error); }} run();Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.ListGuardrailMemberAssignmentsRequest | :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 | :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 | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<operations.ListGuardrailMemberAssignmentsResponse>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.UnauthorizedResponseError | 401 | application/json |
| errors.NotFoundResponseError | 404 | application/json |
| errors.InternalServerResponseError | 500 | application/json |
| errors.ModelGatesDefaultError | 4XX, 5XX | */* |
bulkAssignMembers
Assign multiple organization members to a specific guardrail. Management key required.
Example Usage
import { ModelGates } from "@modelgates/sdk"; const modelgates = new ModelGates({ httpReferer: "<value>", appTitle: "<value>", appCategories: "<value>", apiKey: process.env["MODELGATES_API_KEY"] ?? "",}); async function run() { const result = await modelgates.guardrails.bulkAssignMembers({ id: "550e8400-e29b-41d4-a716-446655440000", bulkAssignMembersRequest: { memberUserIds: [ "user_abc123", "user_def456", ], }, }); console.log(result);} run();Standalone function
The standalone function version of this method:
import { ModelGatesCore } from "@modelgates/sdk/core.js";import { guardrailsBulkAssignMembers } from "@modelgates/sdk/funcs/guardrailsBulkAssignMembers.js"; // Use `ModelGatesCore` for best tree-shaking performance.// You can create one instance of it to use across an application.const modelgates = new ModelGatesCore({ httpReferer: "<value>", appTitle: "<value>", appCategories: "<value>", apiKey: process.env["MODELGATES_API_KEY"] ?? "",}); async function run() { const res = await guardrailsBulkAssignMembers(modelgates, { id: "550e8400-e29b-41d4-a716-446655440000", bulkAssignMembersRequest: { memberUserIds: [ "user_abc123", "user_def456", ], }, }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("guardrailsBulkAssignMembers failed:", res.error); }} run();Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.BulkAssignMembersToGuardrailRequest | :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 | :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 | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<models.BulkAssignMembersResponse>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.BadRequestResponseError | 400 | application/json |
| errors.UnauthorizedResponseError | 401 | application/json |
| errors.NotFoundResponseError | 404 | application/json |
| errors.InternalServerResponseError | 500 | application/json |
| errors.ModelGatesDefaultError | 4XX, 5XX | */* |
bulkUnassignMembers
Unassign multiple organization members from a specific guardrail. Management key required.
Example Usage
import { ModelGates } from "@modelgates/sdk"; const modelgates = new ModelGates({ httpReferer: "<value>", appTitle: "<value>", appCategories: "<value>", apiKey: process.env["MODELGATES_API_KEY"] ?? "",}); async function run() { const result = await modelgates.guardrails.bulkUnassignMembers({ id: "550e8400-e29b-41d4-a716-446655440000", bulkUnassignMembersRequest: { memberUserIds: [ "user_abc123", "user_def456", ], }, }); console.log(result);} run();Standalone function
The standalone function version of this method:
import { ModelGatesCore } from "@modelgates/sdk/core.js";import { guardrailsBulkUnassignMembers } from "@modelgates/sdk/funcs/guardrailsBulkUnassignMembers.js"; // Use `ModelGatesCore` for best tree-shaking performance.// You can create one instance of it to use across an application.const modelgates = new ModelGatesCore({ httpReferer: "<value>", appTitle: "<value>", appCategories: "<value>", apiKey: process.env["MODELGATES_API_KEY"] ?? "",}); async function run() { const res = await guardrailsBulkUnassignMembers(modelgates, { id: "550e8400-e29b-41d4-a716-446655440000", bulkUnassignMembersRequest: { memberUserIds: [ "user_abc123", "user_def456", ], }, }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("guardrailsBulkUnassignMembers failed:", res.error); }} run();Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.BulkUnassignMembersFromGuardrailRequest | :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 | :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 | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<models.BulkUnassignMembersResponse>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.BadRequestResponseError | 400 | application/json |
| errors.UnauthorizedResponseError | 401 | application/json |
| errors.NotFoundResponseError | 404 | application/json |
| errors.InternalServerResponseError | 500 | application/json |
| errors.ModelGatesDefaultError | 4XX, 5XX | */* |
listKeyAssignments
List all API key guardrail assignments for the authenticated user. Management key required.
Example Usage
import { ModelGates } from "@modelgates/sdk"; const modelgates = new ModelGates({ httpReferer: "<value>", appTitle: "<value>", appCategories: "<value>", apiKey: process.env["MODELGATES_API_KEY"] ?? "",}); async function run() { const result = await modelgates.guardrails.listKeyAssignments(); for await (const page of result) { console.log(page); }} run();Standalone function
The standalone function version of this method:
import { ModelGatesCore } from "@modelgates/sdk/core.js";import { guardrailsListKeyAssignments } from "@modelgates/sdk/funcs/guardrailsListKeyAssignments.js"; // Use `ModelGatesCore` for best tree-shaking performance.// You can create one instance of it to use across an application.const modelgates = new ModelGatesCore({ httpReferer: "<value>", appTitle: "<value>", appCategories: "<value>", apiKey: process.env["MODELGATES_API_KEY"] ?? "",}); async function run() { const res = await guardrailsListKeyAssignments(modelgates); if (res.ok) { const { value: result } = res; for await (const page of result) { console.log(page); } } else { console.log("guardrailsListKeyAssignments failed:", res.error); }} run();Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.ListKeyAssignmentsRequest | :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 | :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 | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<operations.ListKeyAssignmentsResponse>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.UnauthorizedResponseError | 401 | application/json |
| errors.InternalServerResponseError | 500 | application/json |
| errors.ModelGatesDefaultError | 4XX, 5XX | */* |
listMemberAssignments
List all organization member guardrail assignments for the authenticated user. Management key required.
Example Usage
import { ModelGates } from "@modelgates/sdk"; const modelgates = new ModelGates({ httpReferer: "<value>", appTitle: "<value>", appCategories: "<value>", apiKey: process.env["MODELGATES_API_KEY"] ?? "",}); async function run() { const result = await modelgates.guardrails.listMemberAssignments(); for await (const page of result) { console.log(page); }} run();Standalone function
The standalone function version of this method:
import { ModelGatesCore } from "@modelgates/sdk/core.js";import { guardrailsListMemberAssignments } from "@modelgates/sdk/funcs/guardrailsListMemberAssignments.js"; // Use `ModelGatesCore` for best tree-shaking performance.// You can create one instance of it to use across an application.const modelgates = new ModelGatesCore({ httpReferer: "<value>", appTitle: "<value>", appCategories: "<value>", apiKey: process.env["MODELGATES_API_KEY"] ?? "",}); async function run() { const res = await guardrailsListMemberAssignments(modelgates); if (res.ok) { const { value: result } = res; for await (const page of result) { console.log(page); } } else { console.log("guardrailsListMemberAssignments failed:", res.error); }} run();Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.ListMemberAssignmentsRequest | :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 | :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 | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<operations.ListMemberAssignmentsResponse>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.UnauthorizedResponseError | 401 | application/json |
| errors.InternalServerResponseError | 500 | application/json |
| errors.ModelGatesDefaultError | 4XX, 5XX | */* |