@crowdstrike/aidr

中文文档
1.5.0发布于 2026/11/04MITTypeScriptESM + CJS构建来源已验证近 30 天下载 7656

TypeScript SDK for CrowdStrike AIDR

原始使用文档
文档目录9 节
  1. Installation
  2. Usage
  3. Retries
  4. Timeouts
  5. Fetch options
  6. Configuring proxies
  7. Node.js
  8. Bun
  9. Deno

CrowdStrike AIDR TypeScript SDK

TypeScript SDK for CrowdStrike AIDR.

Installation

npm install @crowdstrike/aidr
pnpm add @crowdstrike/aidr
yarn add @crowdstrike/aidr

Usage

import { AIGuard } from "@crowdstrike/aidr";

const client = new AIGuard({
  token: "your-api-token",
  baseURLTemplate: "https://api.crowdstrike.com/aidr/{SERVICE_NAME}",
});

const response = await client.guardChatCompletions({
  guard_input: {
    messages: [
      {
        role: "user",
        content: "Hello, how can I help you?",
      },
    ],
  },
});

console.log(response);

Retries

The SDK supports automatic retries for temporary failures (network errors or HTTP/5XX server errors). It supports configuring retries at the client level or per-request.

// Set the default number of retries when creating the client.
const client = new AIGuard({
  token: "your-api-token",
  baseURLTemplate: "https://api.crowdstrike.com/aidr/{SERVICE_NAME}",
  maxRetries: 3, // Default is 2.
});

const response = await client.guardChatCompletions(
  {
    guard_input: {
      messages: [{ role: "user", content: "Hello" }],
    },
  },
  {
    // Override the default retry count for this specific request.
    maxRetries: 5,
  }
);

Timeouts

Configure request timeouts to control how long the client waits for a response before timing out.

// Set the default timeout (in milliseconds) when creating the client.
const client = new AIGuard({
  token: "your-api-token",
  baseURLTemplate: "https://api.crowdstrike.com/{SERVICE_NAME}",
  timeout: 30000, // 30 seconds (default is 60 seconds).
});

const response = await client.guardChatCompletions(
  {
    guard_input: {
      messages: [{ role: "user", content: "Hello" }],
    },
  },
  {
    // Override the default timeout for a specific request.
    timeout: 10000, // 10 seconds.
  }
);

Fetch options

If you want to set custom fetch options without overriding the fetch function, you can provide a fetchOptions object when instantiating the client or making a request. Request-specific options override client options.

const client = new AIGuard({
  fetchOptions: {
    // `RequestInit` options.
  },
});

Configuring proxies

To modify proxy behavior, you can provide custom fetchOptions that add runtime-specific proxy options to requests:

Node.js

import * as undici from 'undici';

const proxyAgent = new undici.ProxyAgent('http://localhost:8888');
const client = new AIGuard({
  fetchOptions: {
    dispatcher: proxyAgent,
  },
});

Bun

const client = new AIGuard({
  fetchOptions: {
    proxy: 'http://localhost:8888',
  },
});

Deno

const httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });
const client = new AIGuard({
  fetchOptions: {
    client: httpClient,
  },
});

版本与发布记录

@crowdstrike/aidr 共发布 9 个版本,首次发布于 2025/12/14;过去 12 个月发布了 9 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.5.0latest2026/11/047 天前
1.4.02026/10/2813 天前
1.3.02026/08/212 个月前
1.2.22026/06/114 个月前
1.2.12026/05/235 个月前
1.2.02026/05/066 个月前

关于 @crowdstrike/aidr 的常见问题

@crowdstrike/aidr 是什么?

TypeScript SDK for CrowdStrike AIDR

如何安装 @crowdstrike/aidr?

在项目目录运行 npm install @crowdstrike/aidr,或使用 pnpm add / yarn add / bun add。

@crowdstrike/aidr 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@crowdstrike/aidr 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@crowdstrike/aidr 可以商用吗?

@crowdstrike/aidr 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@crowdstrike/aidr 的下载量有多少?

根据 npm 官方下载统计,@crowdstrike/aidr 在 2026/10/11 – 2026/11/09 这 30 天内被下载 7,656 次,日均约 255 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@crowdstrike/aidr 还在维护吗?

最新版本 1.5.0 发布于 2026/11/04(7 天前);至今共发布 9 个版本,其中过去 12 个月发布了 9 个;首次发布于 2025/12/14。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。