Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsCommunityBlog
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

Back to skills

Api Provider Setup

ASecurity

添加和配置第三方 API 中转站供应商到 OpenClaw。当用户需要添加新的 API 供应商、配置中转站、设置自定义模型端点时使用此技能。支持 Anthropic 兼容和 OpenAI 兼容的 API 格式。

207 stars
0 votes
0 copies
1 views
Added 9/4/2026
ai-agentsbashapi

Works with

api

Security Analysis

A100/100

Scanned 9/4/2026

Install to Claude Code

$npx -y skills add NeverSight/skills_feed --skill api-provider-setup --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Api Provider Setup?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Api Provider Setup
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/neversight-api-provider-setup/badge)](https://www.skillsdirectory.com/skills/neversight-api-provider-setup)

More formats (shields.io, HTML) on the badges page.

Download Zip
Files
SKILL.md
---
name: api-provider-setup
description: 添加和配置第三方 API 中转站供应商到 OpenClaw。当用户需要添加新的 API 供应商、配置中转站、设置自定义模型端点时使用此技能。支持 Anthropic 兼容和 OpenAI 兼容的 API 格式。
---

# API Provider Setup

为 OpenClaw 添加和配置第三方 API 中转站供应商。

## 配置位置

配置文件:`~/.openclaw/openclaw.json`

在 `models.providers` 部分添加自定义供应商。

## 配置模板

### Anthropic 兼容 API(如 anapi、智谱)

```json
{
  "models": {
    "mode": "merge",
    "providers": {
      "供应商名称": {
        "baseUrl": "https://api.example.com",
        "apiKey": "sk-your-api-key",
        "auth": "api-key",
        "api": "anthropic-messages",
        "models": [
          {
            "id": "model-id",
            "name": "显示名称",
            "reasoning": false,
            "input": ["text"],
            "contextWindow": 200000,
            "maxTokens": 8192,
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            }
          }
        ]
      }
    }
  }
}
```

### OpenAI 兼容 API(如 OpenRouter)

```json
{
  "models": {
    "mode": "merge",
    "providers": {
      "供应商名称": {
        "baseUrl": "https://api.example.com/v1",
        "apiKey": "sk-your-api-key",
        "auth": "api-key",
        "api": "openai-completions",
        "models": [
          {
            "id": "gpt-4",
            "name": "GPT-4",
            "reasoning": false,
            "input": ["text"],
            "contextWindow": 128000,
            "maxTokens": 4096
          }
        ]
      }
    }
  }
}
```

## 关键字段说明

| 字段 | 必填 | 说明 |
|------|------|------|
| `baseUrl` | ✅ | API 端点地址(不含 /v1/messages 等路径) |
| `apiKey` | ✅ | API 密钥 |
| `auth` | ✅ | 认证方式,通常为 `api-key` |
| `api` | ✅ | API 格式:`anthropic-messages` 或 `openai-completions` |
| `models` | ✅ | 该供应商支持的模型列表 |
| `models[].id` | ✅ | 模型 ID(调用时使用) |
| `models[].name` | ❌ | 显示名称 |
| `models[].contextWindow` | ❌ | 上下文窗口大小 |
| `models[].maxTokens` | ❌ | 最大输出 token 数 |
| `models[].reasoning` | ❌ | 是否支持推理模式 |

## 添加模型别名

在 `agents.defaults.models` 中添加别名:

```json
{
  "agents": {
    "defaults": {
      "models": {
        "供应商/模型id": {
          "alias": "简短别名"
        }
      }
    }
  }
}
```

> ⚠️ **重要约束**:`alias` 字段**必须是字符串**,不能是数组!
> 
> ```json
> // ✅ 正确
> "alias": "opus46"
> 
> // ❌ 错误 - 会导致 Config validation failed
> "alias": ["opus46", "aixn/opus46"]
> ```
> 
> 如果需要多个别名指向同一模型,需要在 `models` 中添加多条记录:
> ```json
> "供应商/模型id": { "alias": "别名1" }
> ```

## 设置为默认模型

在 `agents.defaults.model` 中设置:

```json
{
  "agents": {
    "defaults": {
      "model": {
        "primary": "供应商/模型id",
        "fallbacks": [
          "备选供应商1/模型id",
          "备选供应商2/模型id"
        ]
      }
    }
  }
}
```

## 添加流程

1. **获取供应商信息**
   - Base URL
   - API Key
   - API 格式(Anthropic 或 OpenAI 兼容)
   - 支持的模型列表

2. **使用 gateway config.patch 添加**
   ```
   gateway config.patch 添加供应商配置
   ```

3. **重启 Gateway 生效**
   ```
   gateway restart
   ```

4. **测试新模型**
   ```
   session_status(model="新供应商/模型id")
   ```

## 常见中转站配置示例

### Anapi (Anthropic 中转)
```json
"anapi": {
  "baseUrl": "https://anapi.9w7.cn",
  "apiKey": "sk-xxx",
  "auth": "api-key",
  "api": "anthropic-messages",
  "models": [{"id": "opus-4.5", "name": "Opus 4.5", "contextWindow": 200000}]
}
```

### 智谱 ZAI
```json
"zai": {
  "baseUrl": "https://open.bigmodel.cn/api/anthropic",
  "apiKey": "xxx.xxx",
  "auth": "api-key",
  "api": "anthropic-messages",
  "models": [{"id": "glm-4.7", "name": "GLM-4.7", "contextWindow": 200000}]
}
```

### OpenRouter VIP
```json
"openrouter-vip": {
  "baseUrl": "https://openrouter.vip/v1",
  "apiKey": "sk-xxx",
  "auth": "api-key",
  "api": "openai-completions",
  "models": [{"id": "gpt-5.2", "name": "GPT-5.2", "contextWindow": 200000}]
}
```

## 故障排查

1. **401 Unauthorized** - API Key 错误或过期
2. **404 Not Found** - baseUrl 路径错误或 API 格式不匹配
3. **模型不存在** - 检查 models[].id 是否正确
4. **格式错误** - 检查 api 字段是否匹配供应商的 API 格式

## 常见问题与解决方案

### API 格式不匹配导致 404

**症状**:消息发送成功,但 AI 返回 `404 status code (no body)`

**原因**:供应商的 API 格式配置错误。

**诊断**:
```bash
# 测试 Anthropic Messages API 格式
curl -X POST "https://your-api-endpoint/v1/messages" \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -d '{"model":"model-id","max_tokens":10,"messages":[{"role":"user","content":"hi"}]}'

# 测试 OpenAI Completions API 格式
curl -X POST "https://your-api-endpoint/v1/chat/completions" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{"model":"model-id","messages":[{"role":"user","content":"hi"}],"max_tokens":10}'
```

**解决**:

1. 确认供应商使用的 API 格式:
   - **Anthropic 格式**:使用 `/v1/messages`,请求体包含 `messages` 数组
   - **OpenAI 格式**:使用 `/v1/chat/completions`,请求体包含 `messages` 数组

2. 修改 `models.json` 中的 `api` 字段:
   ```json
   {
     "providers": {
       "your-provider": {
         "api": "anthropic-messages"  // 或 "openai-completions"
       }
     }
   }
   ```

3. 重启 Gateway:
   ```bash
   openclaw gateway restart
   ```

**案例**:
- Anapi 使用 **Anthropic Messages API**,必须设置 `"api": "anthropic-messages"`
- OpenRouter VIP 使用 **OpenAI Completions API**,必须设置 `"api": "openai-completions"`
- 智谱 ZAI 使用 **Anthropic Messages API**,必须设置 `"api": "anthropic-messages"`

Attribution

NeverSightNeverSight
View sourceMore from NeverSight →
SSkills DirectorySkills Directory

Know which skills are safe — weekly.

Best new skills + every skill we flagged as malicious. From the team that scanned 103,619.

Join free

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Know which skills are safe — weekly.

Best new skills + every skill we flagged as malicious. From the team that scanned 103,619.

Join free

Related Skills

Caveman

Ultra-compressed communication mode. Cuts token usage ~75% by speaking like caveman while keeping full technical accuracy. Supports intensity levels: lite, full (default), ultra, wenyan-lite, wenyan-full, wenyan-ultra. Use when user says "caveman mode", "talk like caveman", "use caveman", "less tokens", "be brief", or invokes /caveman. Also auto-triggers when token efficiency is requested.

1023331 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

686011 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3351 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

651 votes

math-skill

A comprehensive mathematical reasoning skill for AI assistants — handles arithmetic to research-level problems with rigorous step-by-step reasoning, systematic verification, and transparent uncertainty handling

381 votes
View all in ai-agents →