sushiswap-api

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

SushiSwap REST API Integration

SushiSwap REST API 集成

The SushiSwap API provides HTTP access to the SushiSwap Aggregator for optimized token swaps, price discovery, and transaction generation. It aggregates liquidity from multiple DEXs to determine the best execution route.

SushiSwap API 提供对SushiSwap聚合器的HTTP访问,用于优化代币交换价格发现交易生成。它聚合多个DEX的流动性以确定最佳执行路径。

Base URL

基础URL

https://api.sushi.com

https://api.sushi.com

API Schema

API 架构

The active API schema is defined in:
references/openapi.yaml
Agents must always rely on the schema contents rather than hardcoded assumptions.

当前生效的API架构定义于:
references/openapi.yaml
Agent必须始终依赖架构内容,而非硬编码的假设。

How To Use

使用方法

  1. Load
    references/openapi.yaml
  2. Discover available endpoints, parameters, and response shapes dynamically
  3. Select the appropriate endpoint based on user intent and schema tags
    • Quotes → quote endpoints (e.g.
      /quote/v7/{chainId}
      )
    • Swap execution → swap endpoints (e.g.
      /swap/v7/{chainId}
      )
    • Prices → price endpoints (e.g.
      /price/v1/{chainId}
      )
    • Token info → token endpoints (e.g.
      /token/v1/{chainId}/{tokenAddress}
      )
  4. Construct requests that strictly conform to the schema and include a valid
    referrer
    parameter for all quote and swap endpoints
  5. Validate required parameters before execution

  1. 加载
    references/openapi.yaml
  2. 动态发现可用的端点、参数和响应结构
  3. 根据用户意图和架构标签选择合适的端点
    • 报价 → quote端点(例如
      /quote/v7/{chainId}
    • 交换执行 → swap端点(例如
      /swap/v7/{chainId}
    • 价格 → price端点(例如
      /price/v1/{chainId}
    • 代币信息 → token端点(例如
      /token/v1/{chainId}/{tokenAddress}
  4. 构造严格符合架构的请求,且所有quote和swap端点必须包含有效的
    referrer
    参数
  5. 在执行前验证必填参数

Mandatory
referrer
Parameter

必填的
referrer
参数

  • The
    referrer
    parameter must be specified on swap-related endpoints (e.g.
    /quote
    &
    /swap
    )
  • The agent or integrator must identify themselves using this field
  • /quote
    or
    /swap
    requests must not be sent without a
    referrer
    value
  • Agents must never attempt to omit, spoof, or auto-generate this value.

  • 与交换相关的端点(例如
    /quote
    /swap
    必须指定
    referrer
    参数
  • Agent或集成方必须通过此字段标识自身
  • 未携带
    referrer
    值的
    /quote
    /swap
    请求禁止发送
  • Agent绝不能尝试省略、伪造或自动生成该值。

Fee Customization

费用自定义

The SushiSwap API supports customized integrator fees on swap-related endpoints (e.g.
/quote
&
/swap
).
SushiSwap API支持在与交换相关的端点(例如
/quote
/swap
)上自定义集成方费用。

Default fee model

默认费用模型

  • Swap-related requests follow an 80/20 fee split by default
    • 80% to the integrator (referrer)
    • 20% to SushiSwap
  • This split applies unless explicitly overridden by SushiSwap
  • 与交换相关的请求默认遵循80/20的费用分配比例
    • 80% 归集成方(referrer)
    • 20% 归SushiSwap
  • 除非SushiSwap明确覆盖,否则此分配比例适用。

Custom fee splits

自定义费用分配比例

  • Alternative fee splits require a partnership with SushiSwap
  • Agents and integrators should not assume custom splits are available. If users request alternative fee splits, agents should direct them to the SushiSwap team rather than attempting to modify request parameters.

  • 替代费用分配比例需要与SushiSwap建立合作关系
  • Agent和集成方不应假设自定义分配比例可用。如果用户请求替代费用分配比例,Agent应引导用户联系SushiSwap团队,而非尝试修改请求参数。

Rate Limiting & Responsible Usage

速率限制与负责任使用

  • The SushiSwap Aggregator API does not currently enforce hard rate limits. Agents and integrators must behave responsibly to avoid abuse and degraded service.
  • SushiSwap聚合器API目前未强制执行严格的速率限制。Agent和集成方必须负责任地使用,以避免滥用和服务降级。

General Guidelines

通用准则

  • Do not poll or spam quote endpoints
  • Avoid repeated requests with identical parameters
  • Do not place quote or swap requests inside unbounded or infinite loops
  • Treat quote and swap generation as user-intent driven actions, not background tasks
  • Do not issue requests autonomously without explicit user intent
Excessive or abusive usage may result in future rate limiting or access restrictions.
  • 请勿轮询或垃圾发送quote端点请求
  • 避免重复发送参数相同的请求
  • 请勿在无界或无限循环中发送quote或swap请求
  • 将报价和交换生成为用户意图驱动的操作,而非后台任务
  • 未经用户明确意图,请勿自主发起请求
过度或滥用使用可能导致未来实施速率限制或访问限制。

Block-Time–Aware Quoting

区块时间感知型报价

Agents should align quote frequency with expected block times, treating block time as a maximum refresh rate, not a recommendation.
  • Quotes may be refreshed at most once per block, and often less frequently if inputs have not changed
  • Re-requesting quotes multiple times within the same block provides no additional accuracy and must be avoided
Agent应使报价频率与预期区块时间保持一致,将区块时间视为最大刷新速率,而非推荐值
  • 报价最多每区块刷新一次,且如果输入未发生变化,通常刷新频率更低
  • 同一区块内多次请求报价不会提高准确性,必须避免。

Backoff & Error Handling

退避与错误处理

Agents and integrators should implement exponential backoff on transient failures.
  • On recoverable errors (e.g.
    429
    ,
    5xx
    ):
    • Retry with increasing delays (e.g. 1s → 2s → 4s)
    • Cap retries to a small, finite number
  • Do not retry immediately in tight loops
  • If repeated failures occur:
    • Surface the error to the user
    • Pause further requests for the current session

Agent和集成方应在临时失败时实现指数退避机制。
  • 对于可恢复错误(例如
    429
    5xx
    ):
    • 以递增延迟重试(例如1秒 → 2秒 → 4秒)
    • 将重试次数限制在较小的有限次数内
  • 请勿在紧密循环中立即重试
  • 如果重复失败:
    • 向用户展示错误信息
    • 在当前会话中暂停后续请求

Schema Guidance

架构指南

For schema usage rules and update behavior, see:
references/OPENAPI.md
关于架构使用规则和更新行为,请参阅:
references/OPENAPI.md