K402

io.github.Kali123411由 GitHub 账号 Kali123411 发布v0.7.0更新于 Oct 24, 2026

Agent-payable APIs on Kaspa: LLMs, chain data, covenants, zk proofs — pay per call, no API key

已验证Streamable HTTP可网页运行金融开发者工具AI 与机器学习

概览

AI 生成的概览

K402 提供可按次付费的 Kaspa 服务:LLM 调用、Kaspa 链上数据、 covenant 工具与 zk 证明,费用从预付 KAS 会话或链上支付中扣除。

可以做什么
发现与定价:列出网关服务目录、搜索服务交易市场、查看提供方信誉与支付方式、查询通道配置与状态。管理支付:开通预付会话并获得 Kaspa 主网充值地址、绑定已有会话密钥、查询余额、用交易 ID 完成按次支付。文本与网页任务:摘要、按 JSON schema 抽取结构化数据、改写、分类、读取公开网页、生成文本向量、在服务端集合中建立索引并做语义检索。查询 Kaspa 主网:地址余额、UTXO、交易内存池状态、手续费估算与网络状态。GPU 模型档位:chat、reason、code、kaspa-expert 等推理。Covenant 与证明:编译 Silverscript covenant、推导地址、查询 UTXO、构建与校验交易、广播交易,以及上传 RISC Zero 程序、预检、提交证明、轮询任务、获取结果并验证回执。
适用场景
当助手需要无需 API 密钥、按次付费地使用 LLM 推理、Kaspa 链上数据、covenant 脚本或 RISC Zero 证明,并且你愿意预先充值 KAS 时适用。适合必须按调用付费而非持有服务商密钥的智能体。
运行要求
可作为远程 streamable HTTP 端点运行,也可通过 stdio 运行本地 PyPI 包 k402-mcp。支付需要 Kaspa 主网钱包和 KAS,预付会话最低充值 0.25 KAS。可选环境变量 K402_GATEWAY(网关地址)和 K402_SESSION(固定已充值的会话密钥)。需要访问网关和 Kaspa 主网的网络连接。
安装前请注意
付费工具会从预付余额或按次链上支付中花费真实 KAS,证明费用随周期数增长。covenant_broadcast 会在主网转移真实 KAS,应先运行 covenant_check。会话密钥是保存在本地的持有者凭证,须保密;索引集合名应不可猜测并保密。充值与付款会发往第三方网关和提供方地址。

安装

在 SourceWeft 中

  1. 打开 控制台中的 K402,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Web executable,通过 Streamable HTTP。 远程服务在工作区中配置后即可从网页运行时运行。

交给智能体安装

把这段提示词粘贴到 Claude Code、Codex、Cursor 等智能体,或 SourceWeft 对话中。智能体会读取该服务器的安装指南,先向你展示发布者、端点和登录方式,经你同意后再把它添加到你的客户端。密钥不会写进任何命令。

阅读 https://sourceweft.com/mcp/io.github.Kali123411%2Fk402/install.md,并按其中说明把这个 MCP 服务器接入我的客户端。修改任何配置之前,先告诉我它的发布者、端点和登录方式,等我确认。不要把 API 密钥写进命令或我会提交的文件;问我密钥应从哪里获取。

查看智能体所依据的安装指南

其他 MCP 客户端

把它添加到你客户端的 mcpServers 配置中。

{
  "mcpServers": {
    "k402": {
      "type": "http",
      "url": "https://x402-compute.68cxgfyr0.workers.dev/mcp"
    }
  }
}

工具

36

catalog

List every service this gateway sells (text tools, Kaspa chain data, LLM tiers) with live prices in KAS and USD. Free. Start here to see what's available and what calls cost.

无需输入参数。

open_session

Open a prepaid payment session: returns a session key and a personal Kaspa MAINNET deposit address. Send KAS to the address from any wallet (min 0.25 KAS); confirmed deposits become spendable balance within seconds and every paid tool call meters against it. Free. The session is saved locally so subsequent calls use it automatically.

无需输入参数。

use_session

Attach an existing k402 session key (from a previous open_session) so paid calls meter against its balance — use after reconnecting to the hosted endpoint, or to carry one funded session across clients. Returns the session's current balance. Free.

输入参数session必填

session_status

Check the current payment session: deposit address, deposited / spent / remaining KAS. Free.

无需输入参数。

registry_provider

Full detail on one provider in the service exchange by its payee pubkey: every service it lists, its chain-verified reputation (settled KAS volume + settlement count), and its payee address. Free.

输入参数payee_pubkey必填

channel_config

Parameters for opening a kaspa-channel — a covenant-enforced payment channel that settles per-call vouchers on Kaspa L1 with NO custodian (the trustless alternative to a prepaid session). Returns the payee pubkey, min/max channel size, required expiry lead, and maxfee. Free. Opening a channel means funding the channel covenant on-chain (payer holds the key), then paying per call with signed vouchers — use the `k402` Python client (`pip install k402`, k402.channel) to build the covenant and sign vouchers, since that flow needs your Kaspa key. Returns {error} if this gateway hasn't enabled the (experimental) channel rail.

无需输入参数。

channel_status

Status of a kaspa-channel by its channel id (covenant id): funded value, amount spent via vouchers, remaining, expiry, and whether it has been closed on-chain. Free.

输入参数channel_id必填

payment_options

Which coins and schemes this gateway accepts for payment. Free. Ways to pay any paid tool: a prepaid KAS session (open_session — simplest, no per-call step); per-call in any listed coin (pay the offer a 402 returns, then pay_per_call); or, where the experimental 'kaspa-channel' scheme is offered, a covenant payment channel that settles per-call vouchers on L1 with no custodian (see channel_config). Coins may include Kaspa, Pearl, BTC, LTC, DOGE, BCH, DASH, and EVM assets (ETC, ETH, USDC, USDT).

无需输入参数。

pay_per_call

Complete a PER-CALL coin payment. After a paid tool returns a 402 with pay_per_call_offers, pay one offer on-chain from your own wallet, then call this with the 402's `endpoint` and `request_body`, the chosen offer's `scheme` and `payment_id`, and your payment `txid`. The gateway verifies the payment landed and returns the tool's real result. (Alternative to a prepaid session — use this when you'd rather pay each call directly in a specific coin.)

输入参数txid必填scheme必填endpoint必填payment_id必填request_body必填

summarize

Summarize text or a public URL in at most max_words. Paid (~$0.001 in KAS).

输入参数urltextmax_words

extract

Extract structured data from text as JSON guaranteed to match your JSON schema (schema-constrained decoding, not best-effort). Paid (~$0.0015 in KAS).

输入参数text必填schema必填instruction

rewrite

Rewrite text per an instruction (tone, format, length...). Paid (~$0.001 in KAS).

输入参数text必填instruction必填

classify

Classify text into one (or multiple, if multi=true) of 2-32 labels; the result is constrained to your label set. Paid (~$0.0003 in KAS).

输入参数text必填multilabels必填

read_url

Fetch a public web page and return its title + clean markdown; distill=true adds key-fact bullets. Useful when you have no web access of your own. Paid (~$0.0012 in KAS).

输入参数url必填distill

embed_text

Embed up to 64 texts (768-dim vectors, nomic-embed-text). Paid (~$0.0003 in KAS).

输入参数texts必填

search_index

Store documents [{id, text, meta?}] in a named server-side collection for semantic search. Use an unguessable collection name and keep it secret. Paid (~$0.0015 in KAS).

输入参数replacedocuments必填collection必填

search_query

Semantic-search a collection you indexed earlier; returns top-k matches with scores. Paid (~$0.0003 in KAS).

输入参数q必填top_kcollection必填

kaspa_balance

Balance of any Kaspa MAINNET address, straight from a node (no indexer, no API key). Paid (~$0.00015 in KAS).

输入参数address必填

kaspa_utxos

UTXO set of a Kaspa mainnet address, including scriptPublicKey and covenant_id where set. Paid (~$0.0003 in KAS).

输入参数address必填

kaspa_tx_status

Mempool status of a Kaspa transaction. Absent from mempool means accepted-or-unknown — confirm acceptance by checking one of its outputs with kaspa_utxos. Paid (~$0.00015).

输入参数txid必填

kaspa_fee_estimate

Current Kaspa mainnet feerate buckets (sompi per gram of tx mass). Paid (~$0.00015).

无需输入参数。

kaspa_network

Kaspa mainnet status: DAA score, block count, difficulty, node sync state. Paid (~$0.00015 in KAS).

无需输入参数。

generate

Run a prompt on a GPU model tier: 'chat' (fast 7B, ~$0.0015), 'llama' (budget 8B, ~$0.0008), 'reason' (35B, ~$0.004), 'think' (deep chain-of-thought 35B MoE, ~$0.004), 'code' (coder model, ~$0.0025), or 'kaspa-expert' (RAG-grounded, current Kaspa knowledge, ~$0.0015). Returns the completion text.

输入参数tierprompt必填systemmax_tokens

covenant_compile

Compile a Silverscript covenant to script hex, ABI, hardened template hash, and its P2SH address on each network. constructor_args is the silverc ctor JSON (e.g. [{"kind":"int","data":7}]). Paid (~$0.002). NOTE: 'compiles' ≠ proven on-chain.

输入参数source必填constructor_args

covenant_address

Derive the covenant P2SH address for a compiled script on 'mainnet' or 'testnet-10'. Paid (~$0.0003).

输入参数networkscript_hex必填

covenant_utxos

Live UTXO set locked under a covenant address (covenant state inspection), from the node. Optionally filter by covenant_id. Paid (~$0.0003).

输入参数address必填networkcovenant_id

covenant_build

Assemble a covenant spend tx. Each input: {txid, index, entry, compute_budget?, and either sigscript:{source,decl,args,is_leader?} to build a covenant sigscript server-side, or omit sigscript for a P2PK input you sign locally}. Each output: {amount, address|script_public_key_hex, covenant?:{authorizing_input,covenant_id}}. Returns the tx, a broadcast-ready rpc_transaction, fee accounting, and (if fully authorized) a pre-verify. We never sign. Paid (~$0.001).

输入参数inputs必填networkoutputs必填lock_timepayload_hex

covenant_check

Local txscript pre-verify of a signed covenant tx BEFORE broadcast — catches script failures that would otherwise cost you a broadcast. 'entries' are the spent UTXOs (covenant_utxos output plugs in directly). Returns {all_ok, inputs:[{index, ok, error?}]}. Paid (~$0.0005).

输入参数entries必填transaction必填

covenant_broadcast

Broadcast a signed covenant tx (RpcTransaction JSON from covenant_build). MAINNET moves real KAS — run covenant_check first. Paid (~$0.0003).

输入参数networktransaction必填

prove_guest_upload

Upload a RISC Zero program binary (the .bin risc0-build emits, base64) once; returns its content-addressed image_id (also the verification key), reusable across proofs. Paid (~$0.01).

输入参数program_b64必填

prove_preflight

Execute a guest WITHOUT proving: exact cycle count + a signed price quote {total_cycles, price_kas, quote_id, quote_expires}. Run this first — proving cost scales with cycles by orders of magnitude. Paid (~$0.002).

输入参数image_id必填input_b64

prove_submit

Queue a proving job -> {job_id, cost_kas}. Pass quote_id (from prove_preflight; charged the quote) or max_kas (skip preflight; priced on actual cycles, refuses if over the cap). Then poll job_status and fetch job_result. Paid: the proof's cycle-based price (dynamic).

输入参数max_kasimage_id必填quote_idinput_b64

job_status

Poll a proving job: queued/running/done/failed, queue position, cost. Free.

输入参数job_id必填

job_result

Fetch a finished proving job's result {image_id, total_cycles, journal_b64, receipt_b64}. 404 until done; results kept 24h. Free.

输入参数job_id必填

attest_verify

Verify a RISC Zero receipt against an image_id -> {valid, journal_b64}. Anyone can check an attestation without trusting the prover. Paid (~$0.0002).

输入参数image_id必填receipt_b64必填

版本历史

1
  1. v0.7.0最新Sep 16, 2026

评分

已满足适用检查项的 75%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通必需25 分
  • 已声明认证方式必需10 分
  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分

    请声明包含 README 的 GitHub 仓库,或在 OAuth 受保护资源元数据中提供 resource_documentation。

  • 许可证10 分

    请在仓库或注册中心条目中声明许可证。