openclaw 网盘下载
OpenClaw

技能详情(站内镜像,无评论)

首页 > 技能库 > Node.js API 客户端黄金标准

Node.js API 客户端黄金标准 v3.0 - 多Endpoint + 多Key轮询 + 限流 + 熔断器

开发与 DevOps

许可证:MIT-0

MIT-0 ·免费使用、修改和重新分发。无需归因。

版本:v1.0.0

统计:⭐ 0 · 110 · 0 current installs · 0 all-time installs

0

安装量(当前) 0

🛡 VirusTotal :良性 · OpenClaw :可疑

Package:danihe001/reliable-api-client

安全扫描(ClawHub)

  • VirusTotal :良性
  • OpenClaw :可疑

OpenClaw 评估

The skill's code and instructions mostly match its stated purpose (a multi-endpoint, multi-key reliable API client), but the provided source file is truncated here and there are a few minor inconsistencies and missing artifacts that warrant a cautious review before use.

目的

Name/description (multi-endpoint, multi-key, rate limiting, circuit breaker) align with the included code (EndpointManager, rate limiter, connection pool, circuit breaker, backoff). No extraneous services or unrelated credentials are requested.

说明范围

SKILL.md is an instruction-only surface that documents usage and references the JS file. It does not ask the agent to read unrelated system files or environment variables. It does reference an 'EVOMAP_STANDARD.md' document that is not included in the package — missing documentation should be checked. The runtime instructions do not appear to instruct exfiltration, but the JS file provided here is truncated so the full runtime behavior (network…

安装机制

No install spec is present (instruction-only), and the package contains a single JS file. No downloads from external URLs or package manager installs are specified. This is a low-risk install mechanism, but you should still vet the code before running.

证书

The skill declares no required environment variables or credentials. The client takes API keys/endpoints via its constructor, which is appropriate for this purpose. There are no extra unrelated secrets requested in manifest or SKILL.md.

持久

The skill does not request always:true and defaults to user-invocable/autonomous invocation. There is no indication it modifies other skill configs or requires elevated agent/system privileges in the manifest.

安装(复制给龙虾 AI)

将下方整段复制到龙虾中文库对话中,由龙虾按 SKILL.md 完成安装。

请把本段交给龙虾中文库(龙虾 AI)执行:为本机安装 OpenClaw 技能「Node.js API 客户端黄金标准」。简介:Node.js API 客户端黄金标准 v3.0 - 多Endpoint + 多Key轮询 + 限流 + 熔断器。
请 fetch 以下地址读取 SKILL.md 并按文档完成安装:https://raw.githubusercontent.com/openclaw/skills/refs/heads/main/skills/danihe001/reliable-api-client/SKILL.md
(来源:yingzhi8.cn 技能库)

SKILL.md

打开原始 SKILL.md(GitHub raw)

---
name: reliable-api-client
description: Node.js API 客户端黄金标准 v3.0 - 多Endpoint + 多Key轮询 + 限流 + 熔断器
homepage: https://github.com/tvvshow/openclaw-evomap
metadata:
  {
    "openclaw":
      {
        "emoji": "🌐",
        "requires": {},
        "install": [],
      },
  }
---

# Node.js API 客户端黄金标准 v3.0

整合多Endpoint + 多Key轮询 + 限流 + 连接池 + 指数退避重试 + 熔断器

## 新功能 (v3.0)

| 功能 | 说明 |
|------|------|
| **多Endpoint** | 支持多个上游地址,自动故障转移 |
| **Endpoint熔断** | 每个Endpoint独立熔断器 |
| **优先级策略** | 支持 priority/least-used/round-robin |
| **延迟监控** | 跟踪每个Endpoint的响应时间 |

## 使用方法

```javascript
const ReliableAPIClient = require('./reliable-api-client');

const client = new ReliableAPIClient({
  // 多 Endpoint 支持
  endpoints: [
    { url: 'https://api.example.com', priority: 10 },  // 高优先级
    { url: 'https://backup.example.com', priority: 5 }
  ],
  endpointStrategy: 'priority',  // priority | round-robin | least-used
  endpointCooldown: 60000,      // 1分钟冷却
  
  // 多 Key 支持
  apiKeys: ['key1', 'key2', 'key3'],
  keyStrategy: 'round-robin',
  
  // 限流
  maxQPS: 10,
  
  // 重试
  maxRetries: 3,
  
  // 熔断
  circuitThreshold: 5,
  circuitReset: 30000,
  
  // 连接池
  poolSize: 20
});

// 添加更多 Endpoint
client.addEndpoint('https://new-endpoint.com', priority: 8);
client.addAPIKey('new-key');

// 请求
const data = await client.get('/users');
const result = await client.post('/orders', { item: 'test' });

// 统计
console.log('Endpoints:', client.getEndpointStats());
console.log('Keys:', client.getKeyStats());
console.log('Circuit:', client.getCircuitBreakerStatus(url));
```

## 架构

```
请求 → [限流器] → [Endpoint选择] → [Key选择] → [熔断器] → 发送
                                      ↓
                              [指数退避重试]
                                      ↓
                              [失败 → 切换Endpoint/Key]
```

## 故障转移逻辑

1. 优先选择健康的 Endpoint
2. 按策略选择(priority/least-used/round-robin)
3. 请求失败 → 标记 Endpoint 错误
4. 连续失败 → 熔断器打开
5. 熔断后 → 自动切换到下一个 Endpoint
6. 冷却后 → Endpoint 恢复健康

## 文件

- `reliable-api-client.js` - 主代码

## 相关文档

- `EVOMAP_STANDARD.md` - 胶囊发布规范