跳转到主要内容
OK / complete - but needs edit & format
在 Livepeer 中,网关配置定价以控制成本和利润率。 作为视频转码和 AI 服务的消费者,网关会设定他们愿意为处理工作支付给协调者的最高价格。

定价概念

支付货币

所有支付均以 ETH(wei) - 不是 Livepeer 代币 (LPT)

定价模型

Format me.
  1. Video Transcoding: 每个处理的视频片段
  • 单位: 处理的像素 (宽度 x 高度)
  • 计算: 处理的像素 × 每像素价格
  1. AI Processing: 按功能/模型定价。
  • 单位:每功能/模型的价格
  • 计算方式:
    • 按像素支付:计算方式为宽度 × 高度 × 输出数量
    • 按请求支付:每次AI请求支付一次
    • 直播视频支付:按时间段支付(可配置)

定价配置标志

视频转码核心标志

Video
-maxPricePerUnit
int
默认值:"0 (wei)"
Maximum price per pixelsPerUnit (in wei integer or a custom currency format like 0.50USD or 0.02USD) for transcoding work
All pricing is in wei unless currency conversion is configured
-pixelsPerUnit
int
默认值:"1"
Number of pixels per pricing unit
-ignoreMaxPriceIfNeeded
boolean
默认值:"false"
Allow exceeding max price if no suitable Orchestrator exists

AI 处理核心标志

AI
-maxPricePerCapability
string
默认值:"none"
JSON list (or path/to/ai-pricing.json file) of maximum prices per AI capability/model
ExampleFormat.json
{
  "capabilities_prices": [
    {
      "pipeline": "text-to-image",
      "model_id": "stabilityai/sd-turbo",
      "price_per_unit": 1000,
      "pixels_per_unit": 1
    }
  ]
}
-livePaymentInterval
duration
默认值:"5s"
Payment processing frequency (e.g. 5s, 10s, 300ms)for Live AI Video workflows, where the gateway needs to send periodic payments to the orchestrator.

费用支付计算与流程

Format me. Add diagram
网关根据工作负载类型通过不同的机制支付费用: 视频转码 AI 处理
  • 按像素支付:计算方式为宽度 × 高度 × 输出数量 live_payment.go
  • 实时视频:在流媒体期间使用基于时间间隔的付款ai_http.go
付款处理流程
  1. 网关将带有片段/请求的付款发送到编排器live_payment.go
  2. 编排器验证付款并更新余额 segment_rpc.go
  3. 费用将从网关的余额账户中扣除 ai_http.go

配置方法

Format me.
网关通过配置标志设置他们愿意支付的最高价格在 transcodingConfig.json 或直接在 CLI 中。
  1. 命令行 标志
      -maxPricePerUnit=1000 \
      -pixelsPerUnit=1
    
  2. JSON 配置 文件(纯文本键值格式) 对于 AI 功能,请使用带有模型特定定价的 JSON 文件
  3. HTTP API - 可在运行时使用以进行调整而无需重启
    • /setBroadcastConfig: 设置通用定价
    • /setMaxPriceForCapability: 设置 AI 模型定价
  4. CLI 工具 使用 livepeer_cli -> 选项 16: “设置广播配置”

协调器配置和价格信息(网关参考)

为网关操作员提供的参考,说明协调器如何为服务配置定价和费用。

按网关定价(可由协调器设置)

协调器可以使用以下内容为单个网关设置特定价格 -pricePerGateway starter.go
{
  "gateways": [
    {
      "ethaddress": "0x123...",
      "priceperunit": 0.5,
      "currency": "USD",
      "pixelsperunit": 1000000000000
    }
  ]
}

价格计算

Repeated
实际的价格计算发生在协调器的 priceInfo 函数 orchestrator.go
  1. 检查每个清单ID的固定价格
  2. 从协调器配置中获取基础价格
  3. 对于AI工作负载,汇总单个功能/模型对的价格
  4. 如果启用,根据交易费用自动调整价格

动态价格调整

协调者可以基于交易费用启用自动价格调整 - 这就是为什么需要设置 maxPricing 标志 -> orchestrator.go
if !orch.node.AutoAdjustPrice {
    return basePrice, nil
}
// Apply overhead multiplier based on tx costs
overhead := big.NewRat(1, 1)
if basePrice.Num().Cmp(big.NewInt(0)) > 0 {
    txCostMultiplier, err := orch.node.Recipient.TxCostMultiplier(sender)
    if txCostMultiplier.Cmp(big.NewRat(0, 1)) > 0 {
        overhead = overhead.Add(overhead, new(big.Rat).Inv(txCostMultiplier))
    }
}

网关定价配置标志的完整列表

视频转码定价标志

FlagDefaultPurpose

AI 处理定价标志

FlagDefaultPurpose

支付票证标志

FlagDefaultPurpose

Gas & Transaction 标志(影响定价)

FlagDefaultPurpose

协调器特定定价(仅供参考)

FlagDefaultPurpose

备注

  • 网关标志 控制您支付(最高价格)
  • 协调器标志 控制您费用(实际价格)
  • AI 定价使用maxPricePerCapabilityJSON 结构进行每模型定价
  • 所有价格都可以以 wei 或带货币后缀的形式指定(例如“0.50USD”)
  • 默认的“0”值表示接受任何价格或使用系统默认值

相关页面

Last modified on March 1, 2026