alchemy-openapi-skill

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Alchemy Prices API Skill

Alchemy Prices API 技能

Use this skill to run Alchemy Prices API operations through
uxc
+ OpenAPI.
Reuse the
uxc
skill for shared execution, auth, and error-handling guidance.
使用此技能通过
uxc
+ OpenAPI运行Alchemy Prices API操作。
复用
uxc
技能以实现共享执行、认证和错误处理指导。

Prerequisites

前提条件

  • uxc
    is installed and available in
    PATH
    .
  • Network access to
    https://api.g.alchemy.com
    .
  • Access to the curated OpenAPI schema URL:
    • https://raw.githubusercontent.com/holon-run/uxc/main/skills/alchemy-openapi-skill/references/alchemy-prices.openapi.json
  • An Alchemy API key.
  • uxc
    已安装且可在
    PATH
    中访问。
  • 可访问
    https://api.g.alchemy.com
    的网络权限。
  • 可访问精心整理的OpenAPI schema URL:
    • https://raw.githubusercontent.com/holon-run/uxc/main/skills/alchemy-openapi-skill/references/alchemy-prices.openapi.json
  • 一个Alchemy API密钥。

Scope

适用范围

This v1 skill intentionally covers the narrow Prices API surface:
  • token price lookup by symbol
  • token price lookup by contract address
  • historical token prices
This skill does not cover:
  • node JSON-RPC
  • NFT or portfolio APIs
  • write operations
  • the broader Alchemy API surface
  • multi-symbol batch lookup in one
    uxc
    call
此v1版本技能仅涵盖有限的Prices API功能:
  • 通过代币符号查询代币价格
  • 通过合约地址查询代币价格
  • 代币历史价格
此技能涵盖:
  • 节点JSON-RPC
  • NFT或投资组合API
  • 写入操作
  • 更广泛的Alchemy API功能
  • 在单次
    uxc
    调用中批量查询多个代币符号

Authentication

认证

Alchemy Prices API places the API key in the request path:
/prices/v1/{apiKey}/...
.
Configure one API-key credential with a request path prefix template:
bash
uxc auth credential set alchemy-prices \
  --auth-type api_key \
  --secret-env ALCHEMY_API_KEY \
  --path-prefix-template "/prices/v1/{{secret}}"

uxc auth binding add \
  --id alchemy-prices \
  --host api.g.alchemy.com \
  --scheme https \
  --credential alchemy-prices \
  --priority 100
Validate the active mapping when auth looks wrong:
bash
uxc auth binding match https://api.g.alchemy.com
Alchemy Prices API将API密钥放在请求路径中:
/prices/v1/{apiKey}/...
使用请求路径前缀模板配置一个API密钥凭据:
bash
uxc auth credential set alchemy-prices \
  --auth-type api_key \
  --secret-env ALCHEMY_API_KEY \
  --path-prefix-template "/prices/v1/{{secret}}"

uxc auth binding add \
  --id alchemy-prices \
  --host api.g.alchemy.com \
  --scheme https \
  --credential alchemy-prices \
  --priority 100
当认证出现问题时,验证当前的映射关系:
bash
uxc auth binding match https://api.g.alchemy.com

Core Workflow

核心工作流程

  1. Use the fixed link command by default:
    • command -v alchemy-openapi-cli
    • If missing, create it:
      uxc link alchemy-openapi-cli https://api.g.alchemy.com --schema-url https://raw.githubusercontent.com/holon-run/uxc/main/skills/alchemy-openapi-skill/references/alchemy-prices.openapi.json
    • alchemy-openapi-cli -h
  2. Inspect operation schema first:
    • alchemy-openapi-cli get:/tokens/by-symbol -h
    • alchemy-openapi-cli post:/tokens/by-address -h
    • alchemy-openapi-cli post:/tokens/historical -h
  3. Start with narrow single-asset reads before batch historical requests:
    • alchemy-openapi-cli get:/tokens/by-symbol symbols=ETH currency=USD
    • alchemy-openapi-cli post:/tokens/by-address '{"addresses":[{"network":"eth-mainnet","address":"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"}],"currency":"USD"}'
  4. Use positional JSON only for the POST endpoints:
  • alchemy-openapi-cli post:/tokens/historical '{"symbol":"ETH","startTime":"2025-01-01T00:00:00Z","endTime":"2025-01-07T00:00:00Z","interval":"1d","currency":"USD"}'
  1. 默认使用固定链接命令:
    • command -v alchemy-openapi-cli
    • 如果未找到,创建链接:
      uxc link alchemy-openapi-cli https://api.g.alchemy.com --schema-url https://raw.githubusercontent.com/holon-run/uxc/main/skills/alchemy-openapi-skill/references/alchemy-prices.openapi.json
    • alchemy-openapi-cli -h
  2. 先查看操作schema:
    • alchemy-openapi-cli get:/tokens/by-symbol -h
    • alchemy-openapi-cli post:/tokens/by-address -h
    • alchemy-openapi-cli post:/tokens/historical -h
  3. 在批量历史请求前,先从单一资产的查询开始:
    • alchemy-openapi-cli get:/tokens/by-symbol symbols=ETH currency=USD
    • alchemy-openapi-cli post:/tokens/by-address '{"addresses":[{"network":"eth-mainnet","address":"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"}],"currency":"USD"}'
  4. 仅对POST端点使用JSON参数:
  • alchemy-openapi-cli post:/tokens/historical '{"symbol":"ETH","startTime":"2025-01-01T00:00:00Z","endTime":"2025-01-07T00:00:00Z","interval":"1d","currency":"USD"}'

Operations

操作列表

  • get:/tokens/by-symbol
  • post:/tokens/by-address
  • post:/tokens/historical
  • get:/tokens/by-symbol
  • post:/tokens/by-address
  • post:/tokens/historical

Guardrails

防护规则

  • Keep automation on the JSON output envelope; do not use
    --text
    .
  • Parse stable fields first:
    ok
    ,
    kind
    ,
    protocol
    ,
    data
    ,
    error
    .
  • Treat this v1 skill as read-only and prices-only. Do not imply RPC, trade execution, or wallet mutation support.
  • API keys are sensitive because they appear in the request path. Use
    --secret-env
    or
    --secret-op
    , not shell history literals, when possible.
  • /tokens/by-symbol
    is query-based in the live API.
  • The live API supports repeated
    symbols=
    parameters, but this v1 skill intentionally narrows that endpoint to a single
    symbols=<TOKEN>
    query because current
    uxc
    query argument handling does not reliably execute array-shaped query parameters.
  • Historical requests can expand quickly. Keep time windows tight unless the user explicitly wants a larger backfill.
  • alchemy-openapi-cli <operation> ...
    is equivalent to
    uxc https://api.g.alchemy.com --schema-url <alchemy_openapi_schema> <operation> ...
    .
  • 仅对JSON输出结果进行自动化处理,不要使用
    --text
    参数。
  • 优先解析稳定字段:
    ok
    ,
    kind
    ,
    protocol
    ,
    data
    ,
    error
    .
  • 将此v1版本技能视为仅读取、仅价格查询工具。不要认为它支持RPC、交易执行或钱包操作。
  • API密钥属于敏感信息,因为它们会出现在请求路径中。尽可能使用
    --secret-env
    --secret-op
    ,不要在shell历史记录中明文输入。
  • /tokens/by-symbol
    在实际API中是基于查询参数的。
  • 实际API支持重复的
    symbols=
    参数,但此v1版本技能特意将该端点限制为单一
    symbols=<TOKEN>
    查询,因为当前
    uxc
    的查询参数处理无法可靠执行数组形式的查询参数。
  • 历史请求的数据量可能会快速膨胀。除非用户明确需要更大范围的回溯数据,否则保持时间窗口紧凑。
  • alchemy-openapi-cli <operation> ...
    等同于
    uxc https://api.g.alchemy.com --schema-url <alchemy_openapi_schema> <operation> ...
    .

References

参考资料