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

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

# 快速入門

平台管理讓帳戶管理員無需透過儀表板即可建立、檢查、更新及撤銷標準 API 金鑰與防護欄。

## 建立管理金鑰

請遵循[身分驗證指南](https://runapi.ai/zh-TW/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。若 assignment 遭拒，應視為政策或擁有權問題，而非在缺少 Guardrail 的情況下靜默繼續執行。

## 處理管理錯誤

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

---

## RunAPI 的更多內容

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

聯絡我們: contact@runapi.ai

## 結構化資料

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