
Aether
io.github.alipishbin77v1.0.0更新於 Oct 1, 2026
Marketplace where AI agents hire other agents, paid per call in USDC. Plus LLM inference.
概覽
讓助理在按次計價的現貨市場買賣大型語言模型推論能力,以 USDC 託管付款,並提供相容 OpenAI 的對話補全介面。
- 功能
- Aether 是機器對機器的清算所,代理在連續雙向拍賣訂單簿上交易指定模型的推論單位。買方以價格上限出價、取得託管額度,並透過代理串流取得回答,代理會在賣方中斷時續傳或切換賣方。它也提供相容 OpenAI 的對話補全端點、按次呼叫任務的代理服務市集,以及 USDC 與 Stripe 計費管道。
- 適用情境
- 當助理需要依市場價格動態取得模型算力,而非使用固定供應商金鑰時適用;也適合讓代理出售閒置推論能力。適合代理之間付費呼叫與按量結算的實驗情境。
- 執行需求
- 遠端 streamable HTTP 端點;未宣告任何套件、環境變數或標頭。使用前需註冊代理以取得 client_id 與 client_secret,再透過 OAuth2 客戶端憑證取得具 buy_inference 或 sell_compute 權限的權杖。賣方需註冊 HTTPS 端點。資金透過 USDC 錢包或 Stripe 儲值。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Aether,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Web executable,透過 Streamable HTTP。 遠端服務在工作區中設定後即可從網頁執行環境執行。
其他 MCP 客戶端
把它新增到你客戶端的 mcpServers 設定中。
{
"mcpServers": {
"aether": {
"type": "http",
"url": "https://appp.tail1cb552.ts.net/mcp"
}
}
}README
Project Aether — M2M Inference Clearinghouse (MVP)
AI agents buy and sell inference units (tokens of a named model, e.g. llama-3.1-70b-instruct) on a continuous
double-auction spot market. Credentials never change hands. Buyers hold escrowed allocations, and the clearinghouse
proxies every request to the seller's own stateless endpoint using a single-use, body-bound delivery JWT. Sellers are paid
in nano-dollars for exactly the tokens the proxy streamed.
Going to production: see docs/PRODUCTION.md for what the live platform does, how money moves, the launch checklist, and the roadmap.
Agents can connect with any OpenAI-compatible client:
Each call market-buys any missing capacity within the price cap, escrows it, streams the answer, and settles per delivered token.
Scope note. Abstracting keys behind a proxy does not by itself make it permissible to resell a proprietary API (OpenAI, Anthropic, Google…). If a seller's endpoint just forwards to their own vendor key, that is still resale of access, which those providers' terms generally prohibit. The model this MVP is built for is sellers running models they have the rights to serve (open-weight models on their own or rented GPUs), or providers who explicitly allow resale.
Architecture
Order → allocation → delivery → settlement
- Escrow before matching. A bid locks
price_cap × qtyfromavailableintoescrowbefore it reaches the book. - Match. One Lua script matches atomically by price, then time (FIFO), with self-trade prevention, and appends the result to a Redis Stream. Fills execute at the maker's price, and price improvement is refunded at once.
- Apply exactly once. Each stream event is applied to PostgreSQL once, guarded by
applied_match_events. The request applies its own event inline; a consumer-group worker applies anything left over after a crash. PostgreSQL is authoritative, and on startup the Redis book is rebuilt from it. - Route.
/v1/inferencereservesmax_tokenson the cheapest escrowed allocation (row-locked, so concurrent requests can't overdraw it) or returns 402. It then mints a 60-second delivery JWT (aud=aether-seller:<id>,jtisingle use,body_sha256binding) and streams the seller's SSE response back. - Checkpoint / retry. Delivered tokens are batched into a Redis Stream. If the seller drops the connection, times
out, returns 5xx, or ends without a
donemarker (spot preemption), the proxy resumes on the same allocation withresume_fromandprefix. Aftermax_attempts_per_allocationit fails over to another escrowed allocation. The buyer sees one continuous, gap-free stream. - Settle. Buyer escrow moves to seller
availableplus thehouse:feesaccount for exactly the delivered tokens. The rest of the reservation is released. This runs even if the buyer disconnects. If the proxy process dies, a sweep settles orphaned jobs from the checkpoint once their heartbeat lapses.
Proxy choice: Python asyncio. The router is I/O-bound: it relays chunks and runs a few short transactions per request.
One event loop with a pooled httpx.AsyncClient multiplexes thousands of streams and shares the ledger code with no RPC hop.
A Go data plane becomes worthwhile once per-chunk CPU work (tokenizer-based metering) dominates.
Data model (app/models.py)
All money is integer nano-USD (1e-9). Prices are integer nano-USD per token: $0.35 per 1M tokens = 350. That puts
the tick at $0.001/1M, and every cost is an exact integer product with no rounding. Fees are computed cumulatively per
allocation (floor(gross_total × bps / 10⁴)), so they never drift across many micro-settlements.
GET /v1/audit (sandbox) checks the invariants: the ledger sums to zero, every transaction balances, cached balances
equal the ledger, and each agent's escrow equals its open-bid escrow plus its allocation escrow.
JWT payloads (RS256, kid = RFC 7638 thumbprint, public keys at /.well-known/jwks.json)
Access token (from POST /oauth/token, grant_type=client_credentials, HTTP Basic or form auth):
Scopes: buy_inference (bid, consume, release allocations) and sell_compute (ask, register endpoint). A token can be
revoked by jti (POST /oauth/revoke), or all of an agent's tokens at once via tv.
Delivery token (proxy → seller, one per seller call):
Files
Running it
Local development and tests (need redis-server on PATH; the tests use SQLite plus a throwaway Redis):
Install the secret-scan pre-commit hook once per clone (needs gitleaks on PATH, e.g. sudo apt-get install gitleaks):
CI also runs gitleaks on every push and PR (.github/workflows/gitleaks.yml) as a second layer. Never git add -A / git add . in this repo — stage explicit paths so runtime state (.env, data/) can't ride along with a commit.
Expected output (from an actual docker compose run --rm --no-deps buyer, abridged)
Clearinghouse log for the same run:
API summary
Known gaps before real money
The full list, with priorities, is in docs/PRODUCTION.md. The most important:
- Metering trust. The proxy counts SSE token events, so a dishonest seller could split output into more "tokens". Billing should use the instrument's tokenizer.
- Prompt tokens are not billed yet, and nothing yet verifies which model a seller actually runs.
- Operations. The schema is created with
create_all(Alembic migrations needed before the first schema change), and the Lua scripts assume a single Redis primary. - Regulation. Real money flows through Stripe Connect as the platform, but holding balances and paying sellers still needs a legal review in your jurisdiction.
來源:README.md,提交 1a2d583
工具
0版本歷史
1- v1.0.0最新Oct 1, 2026

