---
title: x402 API：按请求以 USDC 付费调用 AI 模型，无需 API key | RunAPI
description: 通过 x402 在 RunAPI 上调用图像、视频、音乐和音频模型。你的智能体在 Base 上以 USDC 支付每次请求，无需注册、API key 或预付额度。
url: https://runapi.ai/zh-CN/x402.md
canonical: https://runapi.ai/zh-CN/x402
locale: zh-CN
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-CN/x402
> Site index for agents: https://runapi.ai/llms.txt

# 面向 AI 模型的 x402 API：按请求以 USDC 付费

RunAPI 在按次计费的端点上接受 x402 支付。智能体发送一个普通请求，收到 402 报价，用钱包签名后即可获得结果。无需账号、API key 或预付额度。

_更新于 September 24, 2026 · 阅读约需 6 分钟_


## Key takeaways

- 符合条件的 RunAPI 按次计费端点（单价不超过 10 USDC）会对未认证请求返回标准的 x402 v2 报价。
- 支付通过 Coinbase CDP facilitator 在 Base 上以 USDC 结算。付款方签署 EIP-3009 授权，无需支付 gas。
- 付费请求会在正常响应之外附带一个只读的 poll URL，智能体无需账号即可获取完成后的任务结果。

- **155** 支持 x402 支付的资源
- **Base** 结算网络
- **USDC** 支付资产
- **0** 所需 API key 数量


## 从请求到结果的四个步骤

1. **不带 key 发送请求** 发送和携带 API key 时相同的 JSON 请求体，只是省略 Authorization 请求头。
2. **读取 402 报价** RunAPI 返回 402 状态码，附带 PAYMENT-REQUIRED 响应头，列出准确的金额、资产、网络和收款地址。报价有效期为 300 秒。
3. **签名并重试** 你的 x402 v2 客户端用智能体钱包签署 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>
```

把响应交给任意连接了智能体钱包的 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 金额，模型目录中也列出了当前价格。

### 智能体能通过 x402 Bazaar 发现 RunAPI 吗？

每个 402 报价都包含 Bazaar 发现声明，其中带有输入 schema 和示例，因此 x402 客户端和目录都可以收录该端点。

### 如果我付款了，但请求在任务开始前失败会怎样？

校验失败的请求会在结算之前被拒绝，因此不会产生扣费。一旦支付结算完成，之后失败的任务会产生全额退款义务。



## 相关页面

- [什么是 HTTP 402？](https://runapi.ai/zh-CN/http-402.md) - x402 背后的状态码，以及 API 为什么会返回它。
- [模型目录](https://runapi.ai/zh-CN/models.md) - RunAPI 上所有可用的模型和端点。
- [开发者文档](https://runapi.ai/zh-CN/docs/guides) - 请求格式、任务轮询和错误码。
- [CLI](https://runapi.ai/zh-CN/cli.md) - 在终端或智能体 shell 中运行模型。


Claude 访客：新账户可在 30 天内获得 $1.00 API 赠送额度。每人限领一次，仅用于 API 用量。


## 让你的智能体自己支付 API 调用

浏览模型，选择一个按次计费端点，无需 key 即可发送第一个请求。

- [浏览模型](https://runapi.ai/zh-CN/models.md)
- [阅读文档](https://runapi.ai/zh-CN/docs/guides)



---

## More from RunAPI

- [Home](https://runapi.ai/zh-CN/.md)
### 产品
- [模型目录](https://runapi.ai/zh-CN/models.md)
- [定价](https://runapi.ai/zh-CN/pricing.md)
- [提供方](https://runapi.ai/zh-CN/models#all-models)
### 开发者
- [文档](https://runapi.ai/zh-CN/docs/guides)
- [SDK](https://runapi.ai/zh-CN/sdk.md)
- [CLI](https://runapi.ai/zh-CN/cli.md)
- [MCP Server](https://runapi.ai/zh-CN/mcp.md)
### 指南
- [Claude Code 与 Cursor](https://runapi.ai/zh-CN/claude-code-vs-cursor.md)
- [Cursor API 设置](https://runapi.ai/zh-CN/cursor-api-setup.md)
- [RunAPI 与 OpenRouter](https://runapi.ai/zh-CN/openrouter-alternative.md)
- [x402 API](https://runapi.ai/zh-CN/x402.md)
### 公司
- [企业版](https://runapi.ai/zh-CN/contact.md)
- [联系](https://runapi.ai/zh-CN/contact.md)
### 法律
- [服务条款](https://runapi.ai/zh-CN/terms.md)
- [隐私政策](https://runapi.ai/zh-CN/privacy.md)
- [Site index for agents](https://runapi.ai/llms.txt)

Contact: contact@runapi.ai

## Structured data

```json
[
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-CN",
    "@type": "WebSite",
    "name": "RunAPI",
    "url": "https://runapi.ai/zh-CN",
    "potentialAction": {
      "@type": "SearchAction",
      "target": {
        "@type": "EntryPoint",
        "urlTemplate": "https://runapi.ai/zh-CN/models?q={search_term_string}"
      },
      "query-input": "required name=search_term_string"
    }
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-CN",
    "@type": "Organization",
    "name": "RunAPI",
    "url": "https://runapi.ai/zh-CN",
    "logo": {
      "@type": "ImageObject",
      "url": "https://runapi.ai/zh-CNicon.svg"
    },
    "sameAs": [
      "https://github.com/runapi-ai"
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-CN",
    "@type": "Article",
    "headline": "x402 API：按请求以 USDC 付费调用 AI 模型，无需 API key",
    "description": "通过 x402 在 RunAPI 上调用图像、视频、音乐和音频模型。你的智能体在 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-CN"
    },
    "mainEntityOfPage": "https://runapi.ai/zh-CN/x402"
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-CN",
    "@type": "HowTo",
    "name": "如何用 x402 支付 RunAPI 请求",
    "description": "智能体使用 x402 v2 协议，在 Base 上以 USDC 支付一次 RunAPI 请求。",
    "totalTime": "PT5M",
    "step": [
      {
        "@type": "HowToStep",
        "position": 1,
        "name": "不带 key 发送请求",
        "text": "发送和携带 API key 时相同的 JSON 请求体，只是省略 Authorization 请求头。",
        "url": "https://runapi.ai/zh-CN/x402#four-step-getting-started-step-1"
      },
      {
        "@type": "HowToStep",
        "position": 2,
        "name": "读取 402 报价",
        "text": "RunAPI 返回 402 状态码，附带 PAYMENT-REQUIRED 响应头，列出准确的金额、资产、网络和收款地址。报价有效期为 300 秒。",
        "url": "https://runapi.ai/zh-CN/x402#four-step-getting-started-step-2"
      },
      {
        "@type": "HowToStep",
        "position": 3,
        "name": "签名并重试",
        "text": "你的 x402 v2 客户端用智能体钱包签署 EIP-3009 授权，然后携带 PAYMENT-SIGNATURE 请求头重新发送请求。",
        "url": "https://runapi.ai/zh-CN/x402#four-step-getting-started-step-3"
      },
      {
        "@type": "HowToStep",
        "position": 4,
        "name": "轮询任务",
        "text": "RunAPI 结算付款、启动任务，并返回 200 状态码，附带 PAYMENT-RESPONSE 收据和用于获取结果的 poll_url。",
        "url": "https://runapi.ai/zh-CN/x402#four-step-getting-started-step-4"
      }
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-CN",
    "@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": "智能体能通过 x402 Bazaar 发现 RunAPI 吗？",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "每个 402 报价都包含 Bazaar 发现声明，其中带有输入 schema 和示例，因此 x402 客户端和目录都可以收录该端点。"
        }
      },
      {
        "@type": "Question",
        "name": "如果我付款了，但请求在任务开始前失败会怎样？",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "校验失败的请求会在结算之前被拒绝，因此不会产生扣费。一旦支付结算完成，之后失败的任务会产生全额退款义务。"
        }
      }
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-CN",
    "@type": "BreadcrumbList",
    "itemListElement": [
      {
        "@type": "ListItem",
        "position": 1,
        "name": "首页",
        "item": "https://runapi.ai/zh-CN"
      },
      {
        "@type": "ListItem",
        "position": 2,
        "name": "x402 API",
        "item": "https://runapi.ai/zh-CN/x402"
      }
    ]
  }
]
```
