settings

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Settings Skill

设置Skill

Manages configuration stored at
~/.aibtc/config.json
. Controls the Hiro API key used for authenticated Stacks API requests, the custom Stacks API node URL, and provides version information.
管理存储在
~/.aibtc/config.json
中的配置。控制用于Stacks API认证请求的Hiro API密钥、自定义Stacks API节点URL,并提供版本信息。

Usage

使用方法

bun run settings/settings.ts <subcommand> [options]
bun run settings/settings.ts <subcommand> [options]

Subcommands

子命令

set-hiro-api-key

set-hiro-api-key

Save a Hiro API key to
~/.aibtc/config.json
. Authenticated requests receive higher rate limits than public (unauthenticated) requests.
Get a free API key at https://platform.hiro.so/
bun run settings/settings.ts set-hiro-api-key --api-key <key>
Options:
  • --api-key
    (required) — Your Hiro API key (sensitive value)
Output:
json
{
  "success": true,
  "message": "Hiro API key saved. All subsequent Hiro API requests will use this key.",
  "maskedKey": "abcd...wxyz",
  "storedIn": "~/.aibtc/config.json"
}
将Hiro API密钥保存到
~/.aibtc/config.json
中。认证请求比公开(未认证)请求享有更高的速率限制。
bun run settings/settings.ts set-hiro-api-key --api-key <key>
选项:
  • --api-key
    (必填)—— 你的Hiro API密钥(敏感值)
输出:
json
{
  "success": true,
  "message": "Hiro API key saved. All subsequent Hiro API requests will use this key.",
  "maskedKey": "abcd...wxyz",
  "storedIn": "~/.aibtc/config.json"
}

get-hiro-api-key

get-hiro-api-key

Check whether a Hiro API key is configured. Shows the key source and a masked preview.
bun run settings/settings.ts get-hiro-api-key
Output (key configured):
json
{
  "configured": true,
  "source": "~/.aibtc/config.json",
  "maskedKey": "abcd...wxyz",
  "hint": "API key is active. Hiro API requests use authenticated rate limits."
}
Output (no key):
json
{
  "configured": false,
  "source": "none",
  "maskedKey": "(not set)",
  "hint": "No API key configured. Using public rate limits. Get a key at https://platform.hiro.so/"
}
检查是否已配置Hiro API密钥。显示密钥来源和掩码预览。
bun run settings/settings.ts get-hiro-api-key
输出(已配置密钥):
json
{
  "configured": true,
  "source": "~/.aibtc/config.json",
  "maskedKey": "abcd...wxyz",
  "hint": "API key is active. Hiro API requests use authenticated rate limits."
}
输出(无密钥):
json
{
  "configured": false,
  "source": "none",
  "maskedKey": "(not set)",
  "hint": "No API key configured. Using public rate limits. Get a key at https://platform.hiro.so/"
}

delete-hiro-api-key

delete-hiro-api-key

Remove the stored Hiro API key from
~/.aibtc/config.json
. If
HIRO_API_KEY
is set in the environment, that will still be used as a fallback.
bun run settings/settings.ts delete-hiro-api-key
Output:
json
{
  "success": true,
  "message": "Hiro API key removed from ~/.aibtc/config.json.",
  "envFallbackActive": false,
  "hint": "No API key configured. Requests will use public rate limits."
}
~/.aibtc/config.json
中删除存储的Hiro API密钥。如果环境中设置了
HIRO_API_KEY
,仍会将其作为回退选项使用。
bun run settings/settings.ts delete-hiro-api-key
输出:
json
{
  "success": true,
  "message": "Hiro API key removed from ~/.aibtc/config.json.",
  "envFallbackActive": false,
  "hint": "No API key configured. Requests will use public rate limits."
}

set-stacks-api-url

set-stacks-api-url

Point all Stacks API requests at a custom node instead of the default Hiro API. The URL must serve the same
/v2/
and
/extended/v1/
endpoints as
api.hiro.so
.
bun run settings/settings.ts set-stacks-api-url --url <url>
Options:
  • --url
    (required) — Base URL of your Stacks API node (e.g.
    http://localhost:3999
    )
Output:
json
{
  "success": true,
  "message": "Custom Stacks API URL saved. All subsequent Stacks API requests will use this node.",
  "url": "http://localhost:3999",
  "storedIn": "~/.aibtc/config.json",
  "tip": "Use get-stacks-api-url to verify, or delete-stacks-api-url to revert to the default."
}
将所有Stacks API请求指向自定义节点,而非默认的Hiro API。该URL必须提供与
api.hiro.so
相同的
/v2/
/extended/v1/
端点。
bun run settings/settings.ts set-stacks-api-url --url <url>
选项:
  • --url
    (必填)—— 你的Stacks API节点基础URL(例如
    http://localhost:3999
输出:
json
{
  "success": true,
  "message": "Custom Stacks API URL saved. All subsequent Stacks API requests will use this node.",
  "url": "http://localhost:3999",
  "storedIn": "~/.aibtc/config.json",
  "tip": "Use get-stacks-api-url to verify, or delete-stacks-api-url to revert to the default."
}

get-stacks-api-url

get-stacks-api-url

Show the current Stacks API URL being used. Indicates whether it is a custom node or the default Hiro API.
bun run settings/settings.ts get-stacks-api-url
Output (custom URL):
json
{
  "activeUrl": "http://localhost:3999",
  "isCustom": true,
  "source": "~/.aibtc/config.json",
  "defaultUrl": "https://api.testnet.hiro.so",
  "network": "testnet",
  "hint": "Using custom Stacks API node."
}
Output (default):
json
{
  "activeUrl": "https://api.testnet.hiro.so",
  "isCustom": false,
  "source": "default (Hiro API)",
  "defaultUrl": "https://api.testnet.hiro.so",
  "network": "testnet",
  "hint": "Using default Hiro API. Use set-stacks-api-url to point to your own node."
}
显示当前正在使用的Stacks API URL。指示其是自定义节点还是默认的Hiro API。
bun run settings/settings.ts get-stacks-api-url
输出(自定义URL):
json
{
  "activeUrl": "http://localhost:3999",
  "isCustom": true,
  "source": "~/.aibtc/config.json",
  "defaultUrl": "https://api.testnet.hiro.so",
  "network": "testnet",
  "hint": "Using custom Stacks API node."
}
输出(默认值):
json
{
  "activeUrl": "https://api.testnet.hiro.so",
  "isCustom": false,
  "source": "default (Hiro API)",
  "defaultUrl": "https://api.testnet.hiro.so",
  "network": "testnet",
  "hint": "Using default Hiro API. Use set-stacks-api-url to point to your own node."
}

delete-stacks-api-url

delete-stacks-api-url

Remove the custom Stacks API URL and revert to the default Hiro API (
api.mainnet.hiro.so
or
api.testnet.hiro.so
).
bun run settings/settings.ts delete-stacks-api-url
Output:
json
{
  "success": true,
  "message": "Custom Stacks API URL removed. Reverted to default: https://api.testnet.hiro.so",
  "activeUrl": "https://api.testnet.hiro.so",
  "network": "testnet"
}
删除自定义Stacks API URL,恢复为默认的Hiro API(
api.mainnet.hiro.so
api.testnet.hiro.so
)。
bun run settings/settings.ts delete-stacks-api-url
输出:
json
{
  "success": true,
  "message": "Custom Stacks API URL removed. Reverted to default: https://api.testnet.hiro.so",
  "activeUrl": "https://api.testnet.hiro.so",
  "network": "testnet"
}

get-server-version

get-server-version

Check the currently installed package version and compare with the latest published version on npm.
bun run settings/settings.ts get-server-version
Output:
json
{
  "currentVersion": "0.1.0",
  "latestVersion": "0.1.0",
  "isLatest": true,
  "updateAvailable": false,
  "package": "@aibtc/skills"
}
检查当前安装的包版本,并与npm上发布的最新版本进行比较。
bun run settings/settings.ts get-server-version
输出:
json
{
  "currentVersion": "0.1.0",
  "latestVersion": "0.1.0",
  "isLatest": true,
  "updateAvailable": false,
  "package": "@aibtc/skills"
}

check-relay-health

check-relay-health

Check the health of the x402 sponsor relay and the sponsor address nonce status on-chain. Reports relay reachability, version, sponsor nonce gaps, and mempool congestion.
bun run settings/settings.ts check-relay-health [--relay-url <url>] [--sponsor-address <address>]
Options:
  • --relay-url
    (optional) — Base URL of the sponsor relay (default:
    https://sponsor.aibtc.dev
    )
  • --sponsor-address
    (optional) — STX address of the relay sponsor (default:
    SP1PMPPVCMVW96FSWFV30KJQ4MNBMZ8MRWR3JWQ7
    )
Output (healthy):
json
{
  "healthy": true,
  "relay": {
    "url": "https://sponsor.aibtc.dev",
    "reachable": true,
    "status": "ok",
    "version": "1.0.0"
  },
  "sponsor": {
    "address": "SP1PMPPVCMVW96FSWFV30KJQ4MNBMZ8MRWR3JWQ7",
    "lastExecutedNonce": 732,
    "possibleNextNonce": 733,
    "lastMempoolNonce": null,
    "mempoolCount": 0,
    "missingNonces": []
  },
  "issues": [],
  "hint": "Relay and sponsor are operating normally."
}
Output (issues detected):
json
{
  "healthy": false,
  "relay": { "url": "https://sponsor.aibtc.dev", "reachable": false, "error": "fetch failed" },
  "sponsor": {
    "address": "SP1PMPPVCMVW96FSWFV30KJQ4MNBMZ8MRWR3JWQ7",
    "lastExecutedNonce": 732,
    "possibleNextNonce": 733,
    "lastMempoolNonce": null,
    "mempoolCount": 0,
    "missingNonces": [730]
  },
  "issues": [
    "Relay unreachable: fetch failed",
    "Nonce gaps detected: [730]. Transactions may be stuck. The sponsor may need to fill missing nonces."
  ],
  "hint": "Issues detected — see the issues array for details."
}
检查x402赞助中继的健康状态以及链上赞助地址的随机数状态。报告中继可达性、版本、赞助随机数缺口和内存池拥堵情况。
bun run settings/settings.ts check-relay-health [--relay-url <url>] [--sponsor-address <address>]
选项:
  • --relay-url
    (可选)—— 赞助中继的基础URL(默认值:
    https://sponsor.aibtc.dev
  • --sponsor-address
    (可选)—— 中继赞助者的STX地址(默认值:
    SP1PMPPVCMVW96FSWFV30KJQ4MNBMZ8MRWR3JWQ7
输出(健康状态):
json
{
  "healthy": true,
  "relay": {
    "url": "https://sponsor.aibtc.dev",
    "reachable": true,
    "status": "ok",
    "version": "1.0.0"
  },
  "sponsor": {
    "address": "SP1PMPPVCMVW96FSWFV30KJQ4MNBMZ8MRWR3JWQ7",
    "lastExecutedNonce": 732,
    "possibleNextNonce": 733,
    "lastMempoolNonce": null,
    "mempoolCount": 0,
    "missingNonces": []
  },
  "issues": [],
  "hint": "Relay and sponsor are operating normally."
}
输出(检测到问题):
json
{
  "healthy": false,
  "relay": { "url": "https://sponsor.aibtc.dev", "reachable": false, "error": "fetch failed" },
  "sponsor": {
    "address": "SP1PMPPVCMVW96FSWFV30KJQ4MNBMZ8MRWR3JWQ7",
    "lastExecutedNonce": 732,
    "possibleNextNonce": 733,
    "lastMempoolNonce": null,
    "mempoolCount": 0,
    "missingNonces": [730]
  },
  "issues": [
    "Relay unreachable: fetch failed",
    "Nonce gaps detected: [730]. Transactions may be stuck. The sponsor may need to fill missing nonces."
  ],
  "hint": "Issues detected — see the issues array for details."
}

Configuration File

配置文件

All settings are stored in
~/.aibtc/config.json
. This file is created automatically on first use by any wallet or settings subcommand.
json
{
  "version": 1,
  "activeWalletId": null,
  "autoLockTimeout": 15,
  "hiroApiKey": "your-key-here",
  "stacksApiUrl": "http://localhost:3999"
}
所有设置都存储在
~/.aibtc/config.json
中。该文件会在任何钱包或设置子命令首次使用时自动创建。
json
{
  "version": 1,
  "activeWalletId": null,
  "autoLockTimeout": 15,
  "hiroApiKey": "your-key-here",
  "stacksApiUrl": "http://localhost:3999"
}

Environment Variable Fallbacks

环境变量回退

  • HIRO_API_KEY
    — Used if no stored key is set in config
  • NETWORK
    — Set to
    mainnet
    or
    testnet
    (default:
    testnet
    )
  • API_URL
    — Custom x402 relay URL
  • HIRO_API_KEY
    —— 如果配置中未存储密钥,则使用该变量
  • NETWORK
    —— 设置为
    mainnet
    testnet
    (默认值:
    testnet
  • API_URL
    —— 自定义x402中继URL