
focxle — what your AI agents cost
com.focxle由 focxle.com 发布v0.1.7更新于 Oct 24, 2026
Ask what your AI agents cost. Per agent, across every vendor, from your editor.
概览
一个本地 MCP 服务器,让助手根据本地支出汇总回答你的 AI 智能体花了多少钱,可按智能体和供应商查看。
- 可以做什么
- 回答本机记录的 AI 总支出问题,按智能体和供应商细分,数据来自被监测进程退出时写入的本地每日汇总文件。按智能体和供应商主机拆分支出,指出哪个智能体最贵。报告假设的单次调用或每日上限本会拦截哪些调用,使用与实际执行拦截相同的评估代码。只读取本地历史文件,自身从不开始计量,因此编辑器自身的模型调用不会被计入。
- 适用场景
- 当你已用 focxle 库对 Python 智能体做了监测,并希望在 Claude Code、Cursor、Windsurf、Zed 或其他 MCP 客户端中询问其成本时适用,例如本周花了多少、哪个智能体最贵。若没有任何进程被监测或汇总已关闭,则没有用处。
- 运行要求
- 通过 PyPI 包 focxle 作为本地进程运行(需 Python 3.9 及以上),以 python -m focxle mcp 启动。需要 ~/.focxle/history.json 中的本地支出历史,只有被监测进程运行并退出后才会存在。该 MCP 服务器无需账户、API 密钥或网络访问。
安装
在 SourceWeft 中
- 打开 控制台中的 focxle — what your AI agents cost,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
focxle
See what every AI agent costs you, across every vendor. In one line, with no account, in under a second.
Nothing you already have can tell you what one agent cost. Your OpenAI dashboard cannot see Anthropic. Neither can see Serper, Firecrawl, or the twelve other APIs your agent calls in a loop at 3am. They all report per key and per month, which is the wrong unit twice over: you do not run a key, you run agents, and by the time the month closes the money is gone.
focxle runs inside your process, so it sees every one of them, attributes them to the agent that made the call, and prices them from the vendor's own token counts rather than a guess. Connect an account and payments your agent settles on-chain land in the same total.
Why the number gets large fast. Do the arithmetic on a stuck agent. Two frontier-model calls a second, 10k tokens in and 1k out, at $5 per million in and $25 per million out, is 7.5 cents a call and $540 an hour. Twelve hours overnight is $6,480. A two-day weekend is $25,900. Nobody budgets for this, because nobody plans it: it is a bad stopping condition, one retry wrapper too many, a tool that feeds its own output back into the prompt. The first anyone hears is the invoice.
That is the entire reason this exists. It is free, forever, to watch it happen and to see exactly what a cap would have stopped before you pay for one.
This library fails open. It runs inside your agent, so the worst thing it
could do is break a request it was only supposed to measure. If anything inside
it fails, your call goes through and the failure is counted and printed at the
end. focxle.init(fail_open=False) inverts that if an unmeasured call is
genuinely worse for you than a failed one.
It blocks nothing by default. Out of the box it only measures. Refusing a call needs an account on a paid plan, and even then the instruction comes from a signed document rather than a local setting, so nothing you or we write in code can quietly switch it on. Calls to vendors we cannot price are always allowed through.
That is the whole setup. No account, no API key, no config file, and no network call. Prices ship with the package, so the first run works on a plane. Telemetry is off unless you turn it on, and we ask exactly once.
What you get
The second block is the point. It is what a cap would have done, evaluated by the same code that would do the blocking, printed so you can decide whether you want one before you pay for one.
Every figure there is a measurement, not a sales number. The total, the worst call and the running total are sums of calls that really happened, priced from the vendor's own usage numbers. The monthly figure is the only projection, it is this run's own measured rate carried forward, it says so on the line itself, and it is withheld entirely unless the run was long enough and busy enough to mean anything.
If a cap would have stopped a large share of your calls, it says that instead of quoting a figure. A cap that blocks a quarter of an agent's work is not saving money, it is stopping the agent, and calling the difference a saving would make the number worthless on the day it matters. Nothing is offered for sale on those runs either.
Why there is nothing else quite like this
Cost tools for AI fall into three shapes, and all three ask you for something before they tell you anything.
Vendor dashboards are per key and per month, one per vendor, and none of them can see the others. Four vendors means four tabs and no total.
Proxies and gateways see everything, because every call now goes through somebody else's server. That is a new dependency on your live path, a new company holding your prompts, and a new thing that can be down at 3am.
Observability platforms want a trace pipeline, an account, and a seat or per-trace bill before the first number appears. Several are excellent. All of them are a project, and none of them is something you do at 4pm because you got a surprising invoice at lunchtime.
focxle is pip install focxle and one line. It has zero dependencies, so
nothing enters your environment and nothing can conflict with your pins. It
makes zero network calls on the free path, which the test suite proves by
deleting socket.socket and running the whole suite anyway. It needs no
account, no key and no config file, and the price table ships inside the
package, so the first run works on a plane. It fails open by construction:
the worst thing a bug in here can do is fail to measure a call that still went
through.
And it answers the question none of the others can: what did this agent cost me, across everything it touched.
Attributing spend to an agent
Per agent is the number nobody else can show you, and it only exists if calls are labelled.
Works across threads and async tasks. Or set FOCXLE_AGENT in the environment,
which is usually right, because the same image is normally deployed as several
different agents.
Exact token counts
The HTTP layer already sees your model calls. Wrapping the client upgrades them from "a request happened" to the vendor's own token counts.
Streaming is handled. Wrapping the same client twice is a no-op rather than a double count.
For LangChain, where the framework builds the client for you:
Ask it in your editor
focxle ships an MCP server, so you can ask about your own spend in Claude Code, Cursor, Windsurf, Zed or anything else that speaks MCP:
what did my agents cost this week which agent is the expensive one what would a $2 per call cap have stopped
Add this to your client's MCP config:
It answers from a small daily rollup kept in ~/.focxle/history.json, written
when an instrumented process exits. It reads that file and nothing else: no
network, no account, and it never starts measuring anything itself, so your
editor's own model calls are never counted as yours. FOCXLE_NO_HISTORY=1
turns the rollup off, and then there is nothing to ask about.
Reading the numbers yourself
What it does not do
It does not block anything on its own. With no account, policy evaluation
runs and the verdict is only recorded, so you see what a cap would have done
before you decide you want one. Policy(mode="enforce") written in your own
code is refused and downgraded to observe, with a note on stderr: enforcement
is something an account is granted, not a flag a process sets for itself.
When it is granted, caps are judged on what you have actually spent, not on a
guess at what a call is about to cost. Output length cannot be known before the
reply is written, so guessing it refuses ordinary work and misses the runaways.
The one exception is the per-call ceiling, which has to be decided in advance:
it prices the max_tokens you asked for, so set it above what your largest
declared reply would cost rather than above what calls typically cost.
It does not price everything. A vendor missing from the price table is recorded at zero, and both the host and the exact model id are named in the report, so a zero that means "free" is never confused with a zero that means "we did not recognise this". The call is allowed through. Blocking a call because we do not know what it costs would be this library making a decision on missing information inside a process that trusted it to be passive. An invented figure would be worse, because it looks like knowledge.
Routers are priced as the provider they name, so a call through OpenRouter to
anthropic/claude-haiku-4.5 costs what that model costs. Dots and dashes in a
version are treated as one spelling, because which one you see depends on whose
SDK produced the string.
It is per process. An agent running across fifty workers produces fifty
partial pictures. Reconciling them needs somewhere to send them, which is what
an account is for. The one exception is the running total of what a cap would
have prevented, which is kept in ~/.focxle/lifetime.json so a second run does
not start from zero. It holds two numbers and a date, never leaves your
machine, and FOCXLE_NO_LIFETIME=1 stops it being written at all.
Everything under ~/.focxle is created for your user only, 0700 on the
directory and 0600 on the files, the way ~/.ssh and ~/.aws/credentials
are. Your account id is a credential: whoever reads it can read that account's
spend and start a checkout against it, and agent workloads run on shared CI
runners constantly. Anything an earlier version left world readable is
tightened the next time it is written.
It has no dependencies. Nothing is added to your environment and nothing can conflict with your versions. The SDKs and frameworks it instruments are detected at runtime and never imported at install time.
What is sent anywhere
Nothing, unless you turn it on. There is no network call on the observe path at
all, which the test suite asserts by removing socket.socket and running
anyway.
There is exactly one thing we ask for, printed once after your first breakdown and never again. It is off until you type a command:
If you turn it on, it sends anonymous vendor totals: which vendors you used, how many calls, how much, and the hosts we could not price. That last one is the whole reason we ask, because it is how we know what to price next.
It never sends your agent names, your model names, prompts, responses, URLs or
anything derived from your machine. The install id is a random UUID generated
locally, not a hash of your hostname, because anything derived can be reversed
by whoever holds the same input. Private hosts (.internal, .corp, bare
names, IP addresses) are dropped from every field and counted under withheld,
so the totals are visibly partial rather than quietly so.
It never prompts. This runs at process exit, often with no terminal attached, and blocking on stdin there would hang a production agent.
If you enable the local file sink, it records the host and the first two segments of the path, never query strings, so your search terms and document ids stay out of it. That file never leaves your machine.
Compatibility
Python 3.9 and up. Instruments openai, anthropic, httpx, requests and
LangChain when they are present, and does nothing when they are not.
Source, issues and contributions
The source is published at github.com/focxle/focxle-python so you can read it before running it inside your agent. It is generated from a private build repository and is source only: the test suite lives there and is not mirrored here, because those files have never been through the checks that decide what is safe to publish.
Because the repo is generated, pull requests cannot be merged back and are not accepted. That is a limitation of how this is built, not a comment on your patch. What is genuinely wanted, and acted on:
- Bugs and feature requests — open an issue, or email [email protected].
- A vendor or model we price wrongly, or do not price at all. The report names them, and that list is the single most useful thing you can send us.
- Security findings — use GitHub's private vulnerability reporting on that repo, or email the address above. Please give us a reasonable window before publishing.
Licence
MIT.
来源:README.md,提交 9cefc42
工具
0版本历史
1- v0.1.7最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分
其他 Focxle 集成
Focxle: AI governance for B2B deals between agents
com.focxle官方发布者
面向智能体间 B2B 交易的远程 MCP 服务器:谈判报价、锁定签署协议、核查对手方信誉,并通过 x402 以 USDC 付款。
Focxle: negotiation rooms and locked agreements for B2B AI agents
com.focxle官方发布者
一个远程 MCP 服务器,让 AI 代理进行 B2B 谈判、记录报价、核对所有者规则并锁定已签署的协议。
Focxle directory: find and hire AI agents, and get hired
com.focxle官方发布者
一个面向 AI 代理招聘市场的远程 MCP 服务器:搜索代理、核查钱包可信度、发布自身服务并收发合作询价。
Focxle (retired listing): see com.focxle/b2b-agent-negotiation-governance
com.focxle官方发布者
已下架的 Focxle 虚拟卡条目,不再发卡,改指向代理协商与治理服务器。