语言模型 · x402

面向 AI Agent 的 LLM x402 服务

使用 USDC,按实际 Token 用量付费。

无需平台 API Key 或预充值。每次请求授权一个费用上限,再按实际 Token 用量以 USDC 结算,适用每次最低收费。

  • Chat Completions / Responses
  • 流式回复

用 KoinCode 开始调用 ↓

用 KoinCode 调用 LLM x402

KoinCode 是开源桌面 AI Agent,内置 Koinelix 模型服务,可直接使用本地钱包付款,无需填写 API Key。

下载
  1. 准备钱包

    安装并打开 KoinCode。在 Preferences → Wallet 创建或导入钱包,核对 Base 主网,通过 Receive 获取收款地址并转入 USDC。

  2. 启用模型

    在 Preferences → Model settings 选择 KoinCode,点击 Refresh models 并启用想用的模型。

  3. 发起任务并授权

    打开 New task,在模型菜单里选中已启用的 KoinCode 模型并发送消息。需要授权时,核对费用上限,选择仅本次请求或当前会话。

  4. 查看实际费用

    在任务中查看模型回复。打开 Wallet → Payment history,查看以 USDC 结算的实际费用和付款状态。

文本对话与写作

回答问题、总结材料与起草内容,让模型参与文本任务。

代码与函数定义

生成和解释代码,携带本地函数定义,获取工具调用建议。

选择调用协议

读取各模型支持的协议与接口地址,包括 Chat Completions 和 Responses。

流式接收回复

按任务选择逐步接收文本或一次接收完整回复。

从发现模型到完成结算

  1. 免费读取 /v1/models,选择模型、协议与价格。
  2. 提交本次请求,获取 HTTP 402 费用上限报价。
  3. 签署 upto 上限,携带付款授权重发同一请求。
  4. 接收模型回复与最终 token 用量。
  5. 最后按实际 token 消耗量结算。

授权上限清晰,按实际消耗结算。

报价根据本次请求的输入估算与最大输出预算计算。最终按实际输入、缓存与输出 token 及本次报价费率计费,适用每次最低收费。

签名确定本次最高付款金额。生成结束后执行结算交易时才实际转账。流式调用先逐步返回文本,最终用量确定后结算;非流式调用完成结算后返回完整回复。

目录价格已是最终计费单价,无需再次打折。新报价使用当前价,已签报价按原报价处理。

查看模型价格 →

给 Agent 一个接入入口

Read https://koinelix.com/agents.md and discover models at https://api.koinelix.com/v1/models.
Choose a model and supported protocol for my task.
Catalog pricing already contains final billable rates; do not apply another discount. Billing uses actual usage at the quoted rates, subject to minimum_charge_usdc. New quotes use current rates; signed quotes keep their quoted rates.
For Chat Completions, use only max_completion_tokens for the output limit; max_tokens and max_output_tokens are rejected with HTTP 400.
Use x402 v2 upto / Permit2. Check the quoted network, asset, trusted payee and my spending budget before signing.
Preserve the exact request body, path, identity, idempotency key and payment proof.
Receive the response and settle by actual token usage.
For pending or unknown outcomes, recover the original call with X-Koinelix-Recover-Only: true and the original authorization; query with bounded backoff.
Confirm payment=settled and the transaction receipt before treating payment as complete.

发现入口:/agents.md · /llms.txt · /openapi.json · /.well-known/x402