Skip to content

发现协议

JarvisClaw 暴露了标准的 x402 发现端点,任何 Agent 都可以查询以了解可用服务和支付方式。

发现端点

bash
curl https://api.jarvisclaw.ai/.well-known/x402

/.well-known/x402 是规范路径 —— x402scan 等 Agent 工具探测的就是它。 /.well-known/x402/discovery 作为历史别名保留。

无需认证。返回:

json
{
  "x402Version": 2,
  "provider": {
    "name": "JarvisClaw",
    "description": "AI API 路由平台,智能路由 + x402 按次付费",
    "url": "https://api.jarvisclaw.ai",
    "docs": "https://docs.jarvisclaw.ai"
  },
  "paymentInfo": {
    "protocol": "x402",
    "version": "2",
    "networks": ["eip155:8453", "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"],
    "assets": {
      "eip155:8453": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "solana:...": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
    },
    "payTo": { "eip155:8453": "0x...", "solana:...": "..." },
    "facilitator": "https://api.cdp.coinbase.com/platform/v2/x402"
  },
  "resources": [...],
  "capabilities": {
    "streaming": true,
    "multimodal": true,
    "functionCalling": true,
    "vision": true,
    "codeExecution": true,
    "webSearch": true,
    "openaiCompatible": true,
    "claudeCompatible": true,
    "geminiCompatible": true
  },
  "authentication": {
    "x402": { "header": "PAYMENT-SIGNATURE", "headerAliases": ["X-PAYMENT"] },
    "apiKey": { "header": "Authorization", "format": "Bearer sk-..." }
  },
  "discovery": {
    "llmsTxt": "/llms.txt",
    "agentManifest": "/agent-manifest.json",
    "openapi": "/openapi.json",
    "a2aCard": "/.well-known/agent.json",
    "aip": "/.well-known/agent-intent-protocol.json",
    "mcp": "/mcp",
    "models": "/v1/models",
    "health": "/api/discovery/health"
  }
}

discovery 块交叉链接了所有其他机器可读入口,Agent 找到任意一个即可到达其余。

资源列表

resources 中每一项都带 typeendpointmethodsdescriptionpricing,以及已知的 具体价格 —— 这样 Agent 无需逐个探测 402 就能比价。代表性条目:

类型端点描述
ai-model/v1/chat/completions对话补全(按 Token 计费)
ai-model/v1/messagesAnthropic 原生 Messages API
ai-model/v1/responses/v1/responses/compactResponses API(有状态 Agent 运行)
ai-model/v1/images/generations/v1/images/edits图像生成与编辑
ai-model/v1/videos/generations视频生成
ai-model/v1/audio/speech/audio/transcriptions/audio/translations/audio/generations语音、转写、翻译、音乐
ai-model/v1/embeddings/v1/rerank向量化与重排
ai-model/v1/realtimeWebSocket 实时(语音对语音、低延迟文本)
ai-model/v1/moderations内容安全分类
ai-tool/v1/search网络 / 知识搜索
ai-tool/v1/prompt-coach/optimizePrompt 优化
agent-protocol/v1/intent/*AIP —— resolve、execute、execute-budget、subscribe、discover
agent-protocol/a2aA2A JSON-RPC 入口
agent-protocol/mcpMCP 服务器(Streamable HTTP)
marketplace/v1/marketplace/<service>/...每个市场服务各占一项,独立定价
user-api/v1/uapi/{slug}/{path}用户发布的 API(按次计费)
agent-registry/api/agents发现其他 Agent

市场服务逐个列举

每个市场服务都以独立资源出现,带真实可调用路径和价格。不存在 /v1/marketplace/{service}/{path} 这种占位条目需要你解析。

获取模型列表

发现端点不包含完整模型列表(避免数据过时)。直接查询模型:

bash
curl https://api.jarvisclaw.ai/v1/models \
  -H "Authorization: Bearer sk-your-api-key"

AIP 发现(Agent Intent Protocol)

除了 x402 发现,JarvisClaw 还暴露了标准的 AIP 端点用于 Agent 间发现:

bash
curl https://api.jarvisclaw.ai/.well-known/agent-intent-protocol.json

响应:

json
{
  "aip_version": "1.0",
  "name": "JarvisClaw AI Gateway",
  "description": "带 x402 链上微支付的统一 AI 服务网关。Agent 可在去中心化的提供商网络中发现、解析并执行 AI 能力。",
  "endpoints": {
    "discover":       { "method": "GET",  "url": "https://api.jarvisclaw.ai/v1/intent/discover", "auth": "none" },
    "resolve":        { "method": "GET",  "url": "https://api.jarvisclaw.ai/v1/intent/resolve",  "auth": "none" },
    "types":          { "method": "GET",  "url": "https://api.jarvisclaw.ai/v1/intent/types",    "auth": "none" },
    "execute":        { "method": "POST", "url": "https://api.jarvisclaw.ai/v1/intent/execute",  "auth": "x402_payment" },
    "execute_budget": { "method": "POST", "url": "https://api.jarvisclaw.ai/v1/intent/execute-budget", "auth": "x402_payment" },
    "subscribe":      { "method": "POST", "url": "https://api.jarvisclaw.ai/v1/intent/subscribe", "auth": "x402_payment" }
  },
  "network": {
    "description": "第三方 API 服务器的公开目录。",
    "endpoints": {
      "search":    { "method": "GET",  "url": ".../v1/network/search",    "auth": "none" },
      "servers":   { "method": "GET",  "url": ".../v1/network/servers",   "auth": "none" },
      "apis":      { "method": "GET",  "url": ".../v1/network/apis",      "auth": "none" },
      "health":    { "method": "GET",  "url": ".../v1/network/health",    "auth": "none" },
      "recommend": { "method": "POST", "url": ".../v1/network/recommend", "auth": "none" },
      "execute":   { "method": "POST", "url": ".../v1/network/execute",   "auth": "x402_payment" }
    }
  },
  "federation": { "...": "旧键别名,内容与 \"network\" 完全一致" },
  "wallet": {
    "base_url": "https://api.jarvisclaw.ai/v1/wallet",
    "endpoints": ["/balance", "/history", "/limits", "/pools"],
    "auth": "x402_payment"
  },
  "supported_intents": ["chat_completion", "image_generation", "..."],
  "protocols": ["aip/1.0", "a2a/1.0", "mcp/1.0"],
  "payment": {
    "method": "x402",
    "facilitator": "https://api.cdp.coinbase.com/platform/v2/x402",
    "networks": [
      { "name": "base", "chain_id": 8453, "token": "USDC" },
      { "name": "base-sepolia", "chain_id": 84532, "token": "USDC", "testnet": true },
      { "name": "solana", "cluster": "mainnet-beta", "token": "USDC" }
    ]
  },
  "attestation": {
    "description": "付费响应带签名的 settlement 凭证,可离线验证。",
    "enabled": true,
    "signer": "0x...",
    "scheme": "eip712",
    "domain": { "name": "JarvisClaw-AIP", "version": "1", "chainId": 8453 }
  },
  "authentication": {
    "primary": "x402_payment",
    "methods": [
      { "type": "x402_payment", "header": "PAYMENT-SIGNATURE", "headerAliases": ["X-PAYMENT"] },
      { "type": "bearer_token", "description": "网页登录的会话 token" }
    ]
  },
  "docs": "https://docs.jarvisclaw.ai",
  "contact": "https://t.me/JarvisClawai"
}

supported_intents 由实时提供商注册表生成,会随网络节点加入而增长。每个端点条目都自带 auth 字段 —— 请读取它而不要凭假设。

其他 Agent 和平台通过爬取 /.well-known/agent-intent-protocol.json 自动发现你的服务。

验证结算凭证

attestation 块公布了结算凭证的 EIP-712 签名者地址。付费响应会带 settlement.attestation 对象,可离线校验 —— 重算 intent 与 result 哈希、恢复签名者、与此处的 attestation.signer 比对。 详见 AIP → 结算

A2A 发现(Agent-to-Agent)

JarvisClaw 同时提供 Google A2A Agent Card,A2A 客户端可自动发现并通过 JSON-RPC 委派任务。

bash
# 规范路径(已在 IANA 注册,A2A 规范要求)
curl https://api.jarvisclaw.ai/.well-known/agent-card.json

# 1.0 之前的别名,为兼容旧客户端保留
curl https://api.jarvisclaw.ai/.well-known/agent.json

两个路径返回同一份 card,均无需认证。card 声明了覆盖对话、图像、视频、语音、搜索和向量化的技能, 每项都带示例 prompt。

调用 A2A

bash
curl -X POST https://api.jarvisclaw.ai/a2a \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "SendMessage",
    "params": {
      "message": {
        "role": "user",
        "parts": [{"type": "text", "text": "总结最新的 AI Agent 研究"}]
      }
    }
  }'

JSON-RPC 方法:

方法0.x 旧别名说明
SendMessagetasks/send提交任务
GetTasktasks/get查询任务状态
CancelTasktasks/cancel取消任务

A2A 1.0 重命名了这些方法,旧名称仍被接受。POST /a2a 的认证方式与其他端点一致 —— API Key 或 x402 支付签名。获取 card 免费,执行任务计费。

网络

接入网络后,你的平台也会发现并聚合其他 AIP 兼容平台的服务。网络结果自动合并到 /v1/intent/discover 响应中。

详见 AIP → 网络 了解节点管理、推荐档位与如何加入网络。

备选探测路径

Agent 常见的探测路径:

路径行为
/.well-known/x402规范 x402 发现
/.well-known/x402/discovery历史别名,同一响应
/.well-known/agent-intent-protocol.json规范 AIP 发现
/.well-known/agent-card.json规范 A2A card
/.well-known/agent.jsonA2A 历史别名
/x402/discovery301 → /.well-known/x402
/discovery/resources301 → /.well-known/x402

公开发现 API

比完整发现文档更轻量的免费、无需认证的 JSON 接口:

bash
curl https://api.jarvisclaw.ai/api/discovery/models       # 模型列表
curl https://api.jarvisclaw.ai/api/discovery/free-models  # 仅免费模型
curl https://api.jarvisclaw.ai/api/discovery/health       # 平台健康状态
curl https://api.jarvisclaw.ai/v1/network/stats           # AIP 网络规模(仅计数)

供爬虫和 Agent 工具使用的纯文本 / manifest 入口:

bash
curl https://api.jarvisclaw.ai/llms.txt
curl https://api.jarvisclaw.ai/agent-manifest.json

OpenAPI 规范

供 x402scan 和自动化工具使用:

bash
curl https://api.jarvisclaw.ai/openapi.json

返回 OpenAPI 3.1 规范,每个付费端点包含 x-payment-info 字段。