---
title: x402 API：以 USDC 按次付費呼叫 AI 模型，免 API key | RunAPI
description: 透過 x402 在 RunAPI 上呼叫圖片、影片、音樂和音訊模型。你的 AI 代理在 Base 上以 USDC 支付每次請求，免註冊、免 API key，也不必預儲點數。
url: https://runapi.ai/zh-TW/x402.md
canonical: https://runapi.ai/zh-TW/x402
locale: zh-TW
updated: '2026-09-24'
date: '2026-09-24'
site: RunAPI
image: https://runapi.ai/assets/opengraph-bfaaa0f0.png
alternates:
  en: https://runapi.ai/x402
  zh-CN: https://runapi.ai/zh-CN/x402
  es: https://runapi.ai/es/x402
  ja: https://runapi.ai/ja/x402
  de: https://runapi.ai/de/x402
  fr: https://runapi.ai/fr/x402
  pt-BR: https://runapi.ai/pt-BR/x402
  ko: https://runapi.ai/ko/x402
  it: https://runapi.ai/it/x402
  nl: https://runapi.ai/nl/x402
  pl: https://runapi.ai/pl/x402
  tr: https://runapi.ai/tr/x402
  zh-TW: https://runapi.ai/zh-TW/x402
  zh-HK: https://runapi.ai/zh-HK/x402
  ar: https://runapi.ai/ar/x402
  x-default: https://runapi.ai/x402
---

> HTML version: https://runapi.ai/zh-TW/x402
> Site index for agents: https://runapi.ai/llms.txt

# 專為 AI 模型打造的 x402 API：以 USDC 按次付費

RunAPI 的按次計費端點支援 x402 付款。AI 代理送出一般請求、收到 402 報價，用錢包簽署後即可取得結果。不需要帳號、API key，也不必預儲點數。

_更新於 September 24, 2026 · 閱讀時間約 6 分鐘_


## Key takeaways

- 符合條件的 RunAPI 按次計費端點（單價不超過 10 USDC）收到未經驗證的請求時，會回傳標準的 x402 v2 報價。
- 款項透過 Coinbase CDP facilitator 在 Base 上以 USDC 結算。付款方只需簽署 EIP-3009 授權，不必支付 gas。
- 已付款的請求除了一般回應外，還會附上一個唯讀的 poll URL，AI 代理不需帳號也能取得完成後的任務結果。

- **155** 支援 x402 付款的資源
- **Base** 結算網路
- **USDC** 付款資產
- **0** 所需 API key 數量


## 從請求到結果只要四個步驟

1. **不帶 key 送出請求** 以 POST 送出與使用 API key 時相同的 JSON 請求內容，只是省略 Authorization 標頭。
2. **讀取 402 報價** RunAPI 回傳 402 狀態碼，並附上 PAYMENT-REQUIRED 標頭，列出確切的金額、資產、網路與收款地址。報價有效期為 300 秒。
3. **簽署後重試** 你的 x402 v2 用戶端以 AI 代理的錢包簽署 EIP-3009 授權，再帶上 PAYMENT-SIGNATURE 標頭重新送出請求。
4. **輪詢任務** RunAPI 完成結算、啟動任務，並回傳 200 狀態碼，附上 PAYMENT-RESPONSE 收據與用來取得結果的 poll_url。

## 實際交互流程

第一次請求不帶任何憑證。對於可付費的端點，RunAPI 會回傳 402 與付款要求：

```shell
curl -i -X POST "https://runapi.ai/api/v1/z_image/text_to_image" \
  -H 'Content-Type: application/json' \
  --data @request.json

# HTTP/2 402
# PAYMENT-REQUIRED: <base64 JSON with accepts: scheme, network, asset, amount, payTo>
```

將回應交給任何已連接 AI 代理錢包的 x402 v2 用戶端，簽署與重試都由用戶端處理：

```text
request  = {method: "POST", url: task_url, json: payload}
response = x402_client.send(request, wallet: agent_wallet)
# The x402 v2 client reads PAYMENT-REQUIRED, signs an EIP-3009
# authorization, and replays the request with PAYMENT-SIGNATURE.
response.status                       # => 200
response.headers["PAYMENT-RESPONSE"]  # settlement receipt
response.json["poll_url"]             # read-only task result URL
```

## 價格範例

以下是目前支援 x402 的部分模型的最低單次呼叫價格。價格取自即時模型目錄，每個 402 報價都會列出該次請求的確切金額。

| 模型 | 端點 | 單次呼叫價格 |
| --- | --- | ---: |
| Z Image Text to image (`z-image`) | `POST /api/v1/z_image/text_to_image` | $0.01 |
| Flux Text to image (`flux-2-klein`) | `POST /api/v1/flux/text_to_image` | $0.03 |
| Suno Stitch audio (`suno-v4`) | `POST /api/v1/suno/stitch_audio` | $0.01 |
| Suno Stitch audio (`suno-v4.5`) | `POST /api/v1/suno/stitch_audio` | $0.01 |
| Recraft Upscale image (`recraft-crisp-upscale`) | `POST /api/v1/recraft/upscale_image` | $0.01 |
| Recraft Remove background (`recraft-remove-background`) | `POST /api/v1/recraft/remove_background` | $0.01 |

## 付款細節

RunAPI 遵循 x402 v2 的 exact 方案，只接受下列數值。其他任何數值都會在 RunAPI 請 facilitator 結算之前遭到拒絕。

- 網路：Base mainnet（eip155:8453）
- 資產：USDC，合約地址 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913，6 位小數
- Facilitator：Coinbase CDP
- 授權方式：EIP-3009，付款方只需持有 USDC，不需要 ETH 來支付 gas
- 限額：每次請求最高 10 USDC；報價在 300 秒後失效

## 取得結果

大多數媒體任務以非同步方式完成。200 回應中包含一個 poll_url，內含唯讀的任務存取權杖。此權杖只能開啟這一個任務，並在任務完成後 30 天內保持有效。


## 任務失敗時

x402 本身沒有退款機制。已付款的任務若以失敗狀態結束，RunAPI 會按實收金額記錄一筆全額退款義務，再由營運人員以另一筆 USDC 轉帳退回付款錢包；退款並非自動完成。


## 支援哪些端點

x402 適用於單次價格固定的按次計費 REST 端點。依 token、秒數或字元計費的模型（包括 LLM 端點）仍需使用 API key 與點數。MCP server 不接受 x402 付款。


## API key 照樣可用

x402 是額外提供的付款方式。帶有有效 API key 的請求會照常扣除帳戶點數；帶有無效 key 的請求則會收到 401，而非付款報價。



## x402 常見問題

### 什麼是 x402？

x402 是建立在 HTTP 402 Payment Required 狀態碼之上的開放付款協定。伺服器回傳 402 並附上付款要求，用戶端以簽署過的穩定幣授權付款，然後重新送出請求。此協定由 x402 Foundation 維護。

### 用 x402 付款需要 RunAPI 帳號嗎？

不需要。付款的錢包就是身分識別。RunAPI 只會在第一次成功結算後建立內部錢包檔案，從不要求電子郵件或 API key。

### x402 facilitator 負責什麼？

Facilitator 負責驗證已簽署的付款，並在 Base 上送出 USDC 轉帳。RunAPI 使用 Coinbase CDP facilitator，因此付款方不必支付 gas。

### 一次請求要多少錢？

每個端點都有固定的單次呼叫價格。簽署之前，402 報價會顯示確切的 USDC 金額，模型目錄也會列出目前價格。

### AI 代理能透過 x402 Bazaar 找到 RunAPI 嗎？

每個 402 報價都包含 Bazaar 探索宣告，附有輸入 schema 與範例，因此 x402 用戶端與目錄都能收錄該端點。

### 如果我已付款，但請求在任務開始前就失敗了怎麼辦？

驗證未通過的請求會在結算之前就被拒絕，因此不會扣款。付款一旦完成結算，之後失敗的任務都會產生全額退款義務。



## 相關頁面

- [什麼是 HTTP 402？](https://runapi.ai/zh-TW/http-402.md) - x402 背後的狀態碼，以及 API 為什麼會回傳它。
- [模型目錄](https://runapi.ai/zh-TW/models.md) - RunAPI 上所有可用的模型與端點。
- [開發者文件](https://runapi.ai/zh-TW/docs/guides) - 請求格式、任務輪詢與錯誤碼。
- [CLI](https://runapi.ai/zh-TW/cli.md) - 在終端機或 AI 代理的 shell 中執行模型。


Claude 訪客：新帳戶可在 30 天內獲得 $1.00 API 贈送額度。每人限領一次，僅用於 API 用量。


## 讓你的 AI 代理自行支付 API 呼叫

瀏覽模型、挑選一個按次計費端點，不需要 key 就能送出第一個請求。

- [瀏覽模型](https://runapi.ai/zh-TW/models.md)
- [閱讀文件](https://runapi.ai/zh-TW/docs/guides)



---

## More from RunAPI

- [Home](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#all-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)
- [x402 API](https://runapi.ai/zh-TW/x402.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)
- [Site index for agents](https://runapi.ai/llms.txt)

Contact: contact@runapi.ai

## Structured data

```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": "Article",
    "headline": "x402 API：以 USDC 按次付費呼叫 AI 模型，免 API key",
    "description": "透過 x402 在 RunAPI 上呼叫圖片、影片、音樂和音訊模型。你的 AI 代理在 Base 上以 USDC 支付每次請求，免註冊、免 API key，也不必預儲點數。",
    "datePublished": "2026-09-24",
    "dateModified": "2026-09-24",
    "author": {
      "@type": "Organization",
      "name": "RunAPI"
    },
    "publisher": {
      "@type": "Organization",
      "name": "RunAPI",
      "url": "https://runapi.ai/zh-TW"
    },
    "mainEntityOfPage": "https://runapi.ai/zh-TW/x402"
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-TW",
    "@type": "HowTo",
    "name": "如何用 x402 支付 RunAPI 請求",
    "description": "AI 代理使用 x402 v2 協定，在 Base 上以 USDC 支付一次 RunAPI 請求。",
    "totalTime": "PT5M",
    "step": [
      {
        "@type": "HowToStep",
        "position": 1,
        "name": "不帶 key 送出請求",
        "text": "以 POST 送出與使用 API key 時相同的 JSON 請求內容，只是省略 Authorization 標頭。",
        "url": "https://runapi.ai/zh-TW/x402#four-step-getting-started-step-1"
      },
      {
        "@type": "HowToStep",
        "position": 2,
        "name": "讀取 402 報價",
        "text": "RunAPI 回傳 402 狀態碼，並附上 PAYMENT-REQUIRED 標頭，列出確切的金額、資產、網路與收款地址。報價有效期為 300 秒。",
        "url": "https://runapi.ai/zh-TW/x402#four-step-getting-started-step-2"
      },
      {
        "@type": "HowToStep",
        "position": 3,
        "name": "簽署後重試",
        "text": "你的 x402 v2 用戶端以 AI 代理的錢包簽署 EIP-3009 授權，再帶上 PAYMENT-SIGNATURE 標頭重新送出請求。",
        "url": "https://runapi.ai/zh-TW/x402#four-step-getting-started-step-3"
      },
      {
        "@type": "HowToStep",
        "position": 4,
        "name": "輪詢任務",
        "text": "RunAPI 完成結算、啟動任務，並回傳 200 狀態碼，附上 PAYMENT-RESPONSE 收據與用來取得結果的 poll_url。",
        "url": "https://runapi.ai/zh-TW/x402#four-step-getting-started-step-4"
      }
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-TW",
    "@type": "FAQPage",
    "mainEntity": [
      {
        "@type": "Question",
        "name": "什麼是 x402？",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "x402 是建立在 HTTP 402 Payment Required 狀態碼之上的開放付款協定。伺服器回傳 402 並附上付款要求，用戶端以簽署過的穩定幣授權付款，然後重新送出請求。此協定由 x402 Foundation 維護。"
        }
      },
      {
        "@type": "Question",
        "name": "用 x402 付款需要 RunAPI 帳號嗎？",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "不需要。付款的錢包就是身分識別。RunAPI 只會在第一次成功結算後建立內部錢包檔案，從不要求電子郵件或 API key。"
        }
      },
      {
        "@type": "Question",
        "name": "x402 facilitator 負責什麼？",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "Facilitator 負責驗證已簽署的付款，並在 Base 上送出 USDC 轉帳。RunAPI 使用 Coinbase CDP facilitator，因此付款方不必支付 gas。"
        }
      },
      {
        "@type": "Question",
        "name": "一次請求要多少錢？",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "每個端點都有固定的單次呼叫價格。簽署之前，402 報價會顯示確切的 USDC 金額，模型目錄也會列出目前價格。"
        }
      },
      {
        "@type": "Question",
        "name": "AI 代理能透過 x402 Bazaar 找到 RunAPI 嗎？",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "每個 402 報價都包含 Bazaar 探索宣告，附有輸入 schema 與範例，因此 x402 用戶端與目錄都能收錄該端點。"
        }
      },
      {
        "@type": "Question",
        "name": "如果我已付款，但請求在任務開始前就失敗了怎麼辦？",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "驗證未通過的請求會在結算之前就被拒絕，因此不會扣款。付款一旦完成結算，之後失敗的任務都會產生全額退款義務。"
        }
      }
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-TW",
    "@type": "BreadcrumbList",
    "itemListElement": [
      {
        "@type": "ListItem",
        "position": 1,
        "name": "首頁",
        "item": "https://runapi.ai/zh-TW"
      },
      {
        "@type": "ListItem",
        "position": 2,
        "name": "x402 API",
        "item": "https://runapi.ai/zh-TW/x402"
      }
    ]
  }
]
```
