---
title: 快速入門 | RunAPI
description: 使用 RunAPI 管理金鑰建立並管理標準 API 金鑰及安全護欄。
url: https://runapi.ai/zh-HK/docs/guides/platform-management/quickstart.md
canonical: https://runapi.ai/zh-HK/docs/guides/platform-management/quickstart
locale: zh-HK
---

> HTML 版本: https://runapi.ai/zh-HK/docs/guides/platform-management/quickstart
> 智能代理網站索引: https://runapi.ai/llms.txt

# 快速入門

平台管理讓帳號管理員無需為每次變更登入儀表板，即可建立、查閱、更新及撤銷標準 API 金鑰與防護規則。

## 建立管理金鑰

請依照[身份驗證指南](https://runapi.ai/zh-HK/docs/guides/authentication.md)登入，
然後開啟管理金鑰頁面並建立管理金鑰。
請與標準應用程式金鑰分開儲存。僅向平台管理端點以 bearer 令牌形式發送。

```http
Authorization: Bearer YOUR_MANAGEMENT_KEY
```

標準 API 金鑰無法呼叫金鑰或防護欄管理端點。有效的管理金鑰在其持有人不再具備所需帳戶角色時，仍可能收到 `403 Forbidden`。

## 列出標準 API 金鑰

使用 `GET /api/v1/keys` 檢視管理金鑰帳戶可見的金鑰：

```shell
curl "https://runapi.ai/api/v1/keys" \
  -H "Authorization: Bearer YOUR_MANAGEMENT_KEY"
```

將回傳的公開識別碼用於後續的擷取、更新、撤銷或護欄指派請求。切勿根據金鑰名稱或遮罩令牌推斷存取權限。

## 建立並輪換金鑰

使用 `POST /api/v1/keys` 建立應用程式金鑰。完整密鑰
僅在建立回應中返回，因此請在丟棄該回應前將其儲存到密鑰
管理器中。輪換時應建立替換金鑰，將其部署到應用程式，驗證流量，然後
撤銷舊金鑰。

```shell
curl -X POST "https://runapi.ai/api/v1/keys" \
  -H "Authorization: Bearer YOUR_MANAGEMENT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Production worker"}'
```

`credit_limit_windows` 接受 `1h`、`1d` 和 `7d`
滾動消費上限的任意組合。如果任何已設定的窗口耗盡，使用該金鑰的呼叫將返回 `429 Too Many Requests`，直到使用量離開該窗口。
更新金鑰時發送空物件以清除所有滾動上限。

## 套用防護欄

Guardrails 是可重複使用的帳戶政策，用於模型、供應商及消費控制。透過 `/api/v1/guardrails` 管理政策，然後使用 `/api/v1/guardrail_assignments` 來附加或移除它們。將被拒絕的指派視為政策或所有權失敗，而非在沒有 guardrail 的情況下靜默繼續。

## 處理管理錯誤

* `401 Unauthorized` 表示憑證遺失、格式錯誤、已撤銷或無效。
* `403 Forbidden` 表示該憑證類別或帳戶角色無法執行此操作。
* `404 Not Found` 表示已驗證身份的帳戶無法看見所請求的資源。
* `422 Unprocessable Content` 表示一個或多個提交的值違反了資源規則。

---

## RunAPI 的更多內容

- [首頁](https://runapi.ai/zh-HK/.md)
- [模型目錄](https://runapi.ai/zh-HK/models.md)
- [收費](https://runapi.ai/zh-HK/pricing.md)
- [服務商](https://runapi.ai/zh-HK/models)
- [文件](https://runapi.ai/zh-HK/docs/guides)
- [SDK](https://runapi.ai/zh-HK/sdk.md)
- [CLI](https://runapi.ai/zh-HK/cli.md)
- [MCP Server](https://runapi.ai/zh-HK/mcp.md)
- [Claude Code 與 Cursor](https://runapi.ai/zh-HK/claude-code-vs-cursor.md)
- [Cursor API 設定](https://runapi.ai/zh-HK/cursor-api-setup.md)
- [RunAPI 與 OpenRouter](https://runapi.ai/zh-HK/openrouter-alternative.md)
- [企業版](https://runapi.ai/zh-HK/contact.md)
- [聯絡](https://runapi.ai/zh-HK/contact.md)
- [條款](https://runapi.ai/zh-HK/terms.md)
- [私隱](https://runapi.ai/zh-HK/privacy.md)
- [智能代理網站索引](https://runapi.ai/llms.txt)

聯絡我們: contact@runapi.ai

## 結構化資料

```json
[
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-HK",
    "@type": "WebSite",
    "name": "RunAPI",
    "url": "https://runapi.ai/zh-HK",
    "potentialAction": {
      "@type": "SearchAction",
      "target": {
        "@type": "EntryPoint",
        "urlTemplate": "https://runapi.ai/zh-HK/models?q={search_term_string}"
      },
      "query-input": "required name=search_term_string"
    }
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-HK",
    "@type": "Organization",
    "name": "RunAPI",
    "url": "https://runapi.ai/zh-HK",
    "logo": {
      "@type": "ImageObject",
      "url": "https://runapi.ai/zh-HKicon.svg"
    },
    "sameAs": [
      "https://github.com/runapi-ai"
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-HK",
    "@type": "TechArticle",
    "headline": "快速入門",
    "description": "使用 RunAPI 管理金鑰建立並管理標準 API 金鑰及安全護欄。",
    "url": "https://runapi.ai/zh-HK/docs/guides/platform-management/quickstart",
    "mainEntityOfPage": "https://runapi.ai/zh-HK/docs/guides/platform-management/quickstart"
  }
]
```
