← 返回
未分类 Key 中文

Bittensor Chutes x402

Build a pay-per-inference proxy for Bittensor Chutes AI. Accept USDC payments for decentralized AI inference using x402.
为 Bittensor Chutes AI 构建按调用付费代理,接受 USDC 支付,实现基于 x402 的去中心化 AI 推理。
primer-dev primer-dev 来源
未分类 clawhub v1.0.0 1 版本 100000 Key: 需要
★ 0
Stars
📥 308
下载
💾 0
安装
1
版本
#latest

概述

Chutes AI Proxy (x402)

Build a pay-per-inference proxy for Bittensor Chutes (Subnet 64). Accept USDC payments on Base and forward requests to Chutes' decentralized AI network.

When to Use This Skill

Use this skill when the user wants to:

  • Build an AI inference API that accepts crypto payments
  • Wrap Chutes/Bittensor with their own pricing
  • Create a pay-per-request AI service without subscriptions
  • Monetize AI access using stablecoins
  • Set up a Bittensor-powered AI endpoint

How to Respond

User Says/AsksWhat to Do
----------------------------
"Create a Chutes proxy"Run x402 create chutes-proxy my-proxy
"I want to sell AI inference"Scaffold the proxy, explain the business model
"How do I accept payments for AI?"Explain x402 + Chutes, offer to scaffold
"Set up Bittensor integration"Run the create command
"What models does Chutes support?"List models (DeepSeek, Llama, Qwen, etc.)

Quick Start

Node.js / TypeScript

npx @primersystems/x402 create chutes-proxy my-ai-proxy
cd my-ai-proxy
npm install
cp .env.example .env
# Edit .env with your Chutes API key and wallet address
npm run dev

Python

pip install primer-x402
x402 create chutes-proxy my-ai-proxy
cd my-ai-proxy
pip install -r requirements.txt
cp .env.example .env
# Edit .env with your Chutes API key and wallet address
uvicorn main:app --reload

How It Works

User Request
     |
     v
[Your Proxy] -- No payment? --> Return 402 + price
     |
     v
User signs USDC payment (gasless)
     |
     v
[Your Proxy] -- Verify payment --> [Primer Facilitator]
     |
     v
[Chutes API] -- Forward request --> Bittensor Subnet 64
     |
     v
AI Response returned to user

You pre-pay Chutes with your API credits. Users pay YOU in USDC. You keep the margin.

Configuration

After scaffolding, edit .env:

VariableDescriptionRequired
---------------------------------
CHUTES_API_KEYYour Chutes API key from chutes.aiYes
WALLET_ADDRESSYour wallet to receive USDCYes
PRICE_PER_1K_TOKENSYour price in USD (default: 0.001)No
FACILITATOR_URLx402 facilitator (default: Primer's)No

Getting a Chutes API Key

  1. Go to chutes.ai
  2. Sign up / connect wallet
  3. Subscribe to a tier ($3/month base)
  4. Generate API key (starts with cpk_)

Deployment

Cloudflare Workers (TypeScript - Free)

wrangler login
wrangler secret put CHUTES_API_KEY
wrangler secret put WALLET_ADDRESS
npm run deploy

Docker (Python)

docker build -t chutes-proxy .
docker run -p 8000:8000 --env-file .env chutes-proxy

Other Platforms

  • fly.io: fly launch && fly secrets set CHUTES_API_KEY=xxx
  • Railway/Render: Connect repo, set env vars in dashboard
  • Vercel Edge: Build and deploy TypeScript version

API Endpoints

Your proxy exposes:

EndpointDescriptionPayment
--------------------------------
GET /Health checkFree
POST /v1/chat/completionsChat completions (OpenAI-compatible)Required
GET /v1/modelsList available modelsFree

Supported Models

Any model on Chutes, including:

  • deepseek-ai/DeepSeek-V3
  • Qwen/Qwen3-235B-A22B
  • meta-llama/Llama-3.1-70B-Instruct
  • meta-llama/Llama-3.1-8B-Instruct

See chutes.ai for the full list.

Pricing Strategy

The proxy estimates tokens and charges upfront:

Price = (estimated_tokens / 1000) * PRICE_PER_1K_TOKENS

Set PRICE_PER_1K_TOKENS higher than Chutes' cost to make margin. Example:

  • Chutes costs you ~$0.0005/1K tokens
  • You charge $0.001/1K tokens
  • You keep 50% margin

Limitations

  • Streaming not supported - Template doesn't handle stream: true
  • Token estimation is approximate - Uses ~4 chars/token heuristic
  • Pre-payment only - No post-inference reconciliation

Use Cases

WhoWhy
----------
AI agent operatorsGive agents paid AI access without API keys
API resellersWrap Chutes with your branding/pricing
Privacy servicesAI without accounts or KYC
Bittensor minersAdd stablecoin revenue stream

Testing Your Proxy

# Should return 402 Payment Required
curl http://localhost:8787/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"messages":[{"role":"user","content":"Hello"}]}'

# Pay and get response (using x402 CLI)
npx @primersystems/x402 pay http://localhost:8787/v1/chat/completions \
  --max-amount 0.01 \
  --method POST \
  --body '{"messages":[{"role":"user","content":"Hello"}]}'

Links

  • Chutes AI: https://chutes.ai
  • Bittensor: https://bittensor.com
  • x402 Protocol: https://x402.org
  • Primer Systems: https://primer.systems
  • SDK Documentation: https://x402.org/docs/bittensor.html
  • GitHub: https://github.com/primer-systems/x402

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-07 11:29 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-agent

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,427 📥 326,934
ai-agent

Agent Browser

rez0
用于 AI 代理的浏览器自动化 CLI。当用户需要与网站交互(包括浏览页面、填写表单、点击按钮、截图等)时使用。
★ 855 📥 336,242
dev-programming

xClaw02

primer-dev
发起 x402 支付。使用 Base 及其他 EVM 链上的 USDC 为 API 付费、出售服务,并处理 402 Payment Required 响应。
★ 1 📥 1,909