buy-cycles
БесплатноБез исполняемых скриптовНе проверенBuy cycles with a credit card for the CLI's own identity with `icp cycles buy`, through CyclePay's on-chain gateway, then continue deploying. Use when a…
от jiayaoqijia★ 81 звезда на GitHubОб этом скилле
Buy Cycles With a Card
What This Is
A cycles gateway is a canister that takes an order for cycles, has the buyer pay for it
by card on a hosted Stripe page, and delivers the cycles on-chain. icp cycles buy makes
the CLI identity the buyer: the identity that will run icp deploy creates the order
itself, so the cycles land on that identity's own cycles-ledger account and nothing has
to be linked, signed in or transferred afterwards. The agent's job is to create the
order, hand the payment link to the human, wait for delivery, and carry on deploying.
The default gateway is CyclePay, run by the DFINITY
Foundation: backend canister 2bwus-iiaaa-aaaac-bee3a-cai, mainnet only, USD only.
Everything the command quotes with is read from the gateway at run time (get_card_terms,
get_xdr_rate_status): the per-order range (USD 1 to 200 at the time of writing), the
card fee (2.9 % + 0.30 USD), the cycles-ledger delivery fee (200 M cycles) and the USD
per XDR rate (1 XDR = 1 T cycles). Do not hardcode any of them. Card details never touch
the canister or the CLI.
Prerequisites
icpCLI installed (https://cli.internetcomputer.org); load theicp-cliskill for general usage and the-n/-eflag rule.icp cycles --helpmust listbuy; otherwise use the fallback below.- A named
icpidentity for the project. The anonymous identity is refused, and the identity that buys must be the one that deploys. - A human who can open a URL on some device (laptop, phone). The agent's machine needs no browser.
The Flow
# 1. Who is buying, and what they hold now
icp identity principal --identity "$ID"
icp cycles balance -n ic --identity "$ID"
# 2. Buy (spend 10 USD; or `--cycles 5t` to pay the least that buys 5 T cycles -- for a deploy,
# the gap from the `icp-cli` skill's pre-deploy estimate, N canisters × (2T + 100M) − balance)
icp cycles buy --amount 10 -n ic --identity "$ID" --no-open --yes --json
# stdout, line 1, as soon as the order exists:
# {"order_id":"co-12-…","checkout_url":"https://buy.stripe.com/…","amount":{"currency":"USD","value":"10.00"},
# "net":{"currency":"USD","value":"9.41"},"fee":{"currency":"USD","value":"0.59"},
# "estimated_cycles":"6959859171597","expires_at":"2026-10-15T18:03:12Z"}
# → show checkout_url to the user VERBATIM and ask them to pay on it (any device).
# The command polls every 3 s for up to an hour, then prints line 2 and exits 0 only on delivery:
# {"order_id":"co-12-…","status":"delivered","cycles_delivered":"6938000000000",
# "paid":{"currency":"USD","value":"10.00"},"refunded":null,"detail":null,"balance":"6938000000000"}
# 3. Continue as the same identity
icp cycles balance -n ic --identity "$ID"
icp deploy -e ic --identity "$ID"
Without --yes the command shows the quote and asks for confirmation, which needs a
terminal; without one it prints the quote and refuses (Use --yes to proceed), creating
nothing — a usable dry run when the user wants to see the figures first:
Identity: dev
Buyer: 7k7px-dcypq-wulnh-byzgd-6sib2-udn6c-lfo6e-6oujd-veifp-62woo-5ae
Gateway: 2bwus-iiaaa-aaaac-bee3a-cai (CyclePay)
Price: 10.00 USD (9.41 USD after a 0.59 USD card fee)
Estimate: about 6.959T cycles, at 1.3520 USD per 1T cycles
Flags that matter to an agent: --no-open (never let the CLI try a browser), --json
(two objects on stdout, one per line, never an array; progress and prompts go to stderr),
-q (stdout is the link, then the final status tag), --no-wait (print the link and
return; the order needs nothing more from the CLI), --gateway <canister-id> /
ICP_CYCLES_GATEWAY_CANISTER_ID (another canister serving the same interface, on any
network).
Fallback: the same order with icp canister call
Only when the installed CLI has no cycles buy. Same canister, same identity rules. The
argument and reply shapes are those of
cycles_gateway.did,
which icp-cli holds against CyclePay's backend interface; this sequence was run against
icp-cli's stand-in gateway and mainnet's public queries on 2026-10-14.
GW=2bwus-iiaaa-aaaac-bee3a-cai
icp canister call "$GW" get_card_terms '()' -n ic --query # deliveries_paused, min/max_order_usd_cents, fee_bps, fee_fixed_usd_cents, ledger_delivery_fee_cycles
icp canister call "$GW" get_xdr_rate_status '()' -n ic --query # xdr_usd_x10000, stale
# Create: USD cents, destination = the caller's own cycles-ledger account.
icp canister call "$GW" create_order \
'(record { destination = variant { Ledger }; beneficiary = null; project_id = null;
amount_usd_cents = 1000 : nat64; confirm_system_canister = null })' \
-n ic --identity "$ID"
# Ok = record { order_id = "co-…"; payment_url = "https://…"; net_usd_cents; expires_at }
# Err = record { code = "AMOUNT_OUT_OF_RANGE"; message = "…" } (nothing was created)
Установить buy-cycles в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл buy-cycles?
Buy cycles with a credit card for the CLI's own identity with `icp cycles buy`, through CyclePay's on-chain gateway, then continue deploying. Use when a mainnet deploy or canister creation fails for lack of cycles, the user has no ICP, no wallet or no exchange account, or asks to pay for cycles by card, Stripe, fiat or USD. Do NOT use for converting ICP you already hold (cycles-management: `icp cycles mint`), for topping up a canister from an existing balance, or for Internet Identity sign-in (agent-web-identity).
Как установить скилл buy-cycles?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл buy-cycles запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
ci-review
The scan that the plugin's GitHub Action runs.
от Anthropicazure-static-web-apps
Helps create, configure, and deploy Azure Static Web Apps using the SWA CLI. Use when deploying static sites to Azure, setting up SWA local development…
от GitHubai-ready
Make any repo AI-ready — analyzes your codebase and generates AGENTS.md, copilot-instructions.md, CI workflows, issue templates, and more. Mines your PR…
от GitHubaws-cdk-python-setup
Setup and initialization guide for developing AWS CDK (Cloud Development Kit) applications in Python. This skill enables users to configure environment…
от GitHub