SatGate CLI
SatGate CLI manages API access, budgets, and monetization for the agent economy. Use it when you need to control what agents can access and how much they can spend.
They're the wallet. We're the register.
If the agent needs to pay for L402 APIs, install lnget from Lightning Labs. SatGate is for the server side — enforcement, attribution, and governance.
Setup
Run scripts/configure.sh if no ~/.satgate/config.yaml exists. Or set environment variables:
CODEBLOCK0
Always run satgate status first to confirm you're targeting the right gateway.
Safety Rules
- 1. Check target first — run
satgate status before any operation to verify gateway URL and surface. - Use
--dry-run on destructive operations (revoke, mint with large budgets). - Never use
--yes without explicit user approval. - Revocation is irreversible — always confirm token name before revoking.
Commands
Check gateway health
CODEBLOCK1
Mint a token for a new agent
CODEBLOCK2
Check agent spend
CODEBLOCK3
List and inspect tokens
CODEBLOCK4
Revoke a compromised agent
CODEBLOCK5
View security threats
CODEBLOCK6
Check policy modes
CODEBLOCK7
Common Workflows
"New agent needs API access"
→ INLINECODE9
"How much are agents spending?"
→ INLINECODE10
"Agent is misbehaving"
→ INLINECODE11
"Board wants AI spend report"
→ INLINECODE12
"Is the gateway healthy?"
→ INLINECODE13
Output Formats
All commands support --json for machine-readable output:
CODEBLOCK8
Pairing with lnget
SatGate (server-side) + lnget (client-side) = complete agent commerce stack.
- - lnget: Agents pay for L402-gated APIs automatically
- SatGate CLI: Operators mint tokens, set budgets, revoke access, view spend
An agent using lnget hits your SatGate-protected endpoint → SatGate enforces the budget and attributes the cost → you see it in satgate spend.
Install lnget: INLINECODE17
SatGate CLI
SatGate CLI 管理代理经济中的 API 访问、预算和货币化。当你需要控制代理可以访问的内容及其消费额度时使用。
它们是钱包。我们是收银台。
如果代理需要支付 L402 API 费用,请从 Lightning Labs 安装 lnget。SatGate 用于服务端——执行、归属和治理。
设置
如果 ~/.satgate/config.yaml 不存在,运行 scripts/configure.sh。或者设置环境变量:
bash
自托管网关
export SATGATE_GATEWAY=http://localhost:9090
export SATGATE
ADMINTOKEN=sgk
yourtoken
SatGate Cloud
export SATGATE_SURFACE=cloud
export SATGATE_GATEWAY=https://satgate-gateway.fly.dev
export SATGATE
BEARERTOKEN=sg
yourapi_key
export SATGATE_TENANT=your-tenant-slug
始终先运行 satgate status 确认目标网关正确。
安全规则
- 1. 先检查目标 — 在任何操作前运行 satgate status 验证网关 URL 和平台。
- 对破坏性操作使用 --dry-run(revoke、mint 大预算时)。
- 未经用户明确批准,绝不使用 --yes。
- 撤销不可逆 — 撤销前务必确认令牌名称。
命令
检查网关健康状态
bash
satgate status # 完整状态(版本、平台、运行时间)
satgate ping # 快速存活检查(退出码 0/1)
为新代理铸造令牌
bash
交互式(提示填写所有字段)
satgate mint
非交互式
satgate mint --agent my-bot --budget 500 --expiry 30d --routes /api/openai/*
带父令牌(在现有令牌下委派)
satgate mint --agent child-bot --budget 100 --parent parent-token-id
预览而不执行
satgate mint --agent my-bot --budget 500 --dry-run
检查代理消费
bash
satgate spend # 组织级成本中心汇总
satgate spend --agent cs-bot # 按代理细分
satgate spend --period 7d # 按时间范围
列出和检查令牌
bash
satgate tokens # 所有令牌的状态、消费、预算
satgate token
# 详情:范围、委派链、消费
撤销被入侵的代理
bash
satgate revoke # 交互式确认
satgate revoke --dry-run # 仅预览
查看安全威胁
bash
satgate report threats # 被阻止的请求、异常
检查策略模式
bash
satgate mode # 每条路由的当前模式(只读)
常见工作流
新代理需要 API 访问权限
→ satgate mint --agent agent-name --budget 500 --routes /api/openai/*
代理消费了多少?
→ satgate spend
代理行为异常
→ satgate revoke
董事会需要 AI 消费报告
→ satgate spend --json > report.json
网关健康吗?
→ satgate ping
输出格式
所有命令支持 --json 输出机器可读格式:
bash
satgate tokens --json | jq .[] | select(.status == active)
satgate spend --json > monthly-report.json
与 lnget 配合使用
SatGate(服务端)+ lnget(客户端)= 完整的代理商业栈。
- - lnget:代理自动支付 L402 保护的 API
- SatGate CLI:操作员铸造令牌、设置预算、撤销访问、查看消费
使用 lnget 的代理访问你的 SatGate 保护端点 → SatGate 执行预算并归因成本 → 你在 satgate spend 中看到结果。
安装 lnget:claude plugin marketplace add lightninglabs/lightning-agent-tools