Apache Casbin Gateway
4. 管控

4.3 用量与模型定价

用量

用自己订阅的Agent不会往Gateway转发任何东西,直接打到厂商的请求在这里也不留记录——但Agent自己照样会把这次对话写在磁盘上。

用量读的就是这些会话记录。所以从第一次启动开始,本机每个Agent的花费就都在这一页上了,不需要配供应商,也不需要接任何流量。

用量

两个标签页:

标签页覆盖知道
Agent账单本机每个Agent,不管走没走Gatewaytoken、缓存命中率和费用,按时间、按模型、按Agent拆分
转发账单只有经过Gateway的流量上面这些,外加是哪个供应商回的、有没有失败

第一个是这台机器到底花了多少的完整账;第二个是唯一能告诉你钱去了哪个上游的账。

模型定价

用量页上每个数字,都是从模型定价算出来的——一张"一百万token多少钱"的表。

模型定价

厂商会改价,中转商不跟,所以:

  • 手动改价——改过之后这个模型就归你了,不会被覆盖。
  • 或者让Gateway按计划从models.dev目录里,给这台机器跑过的模型重新定价。你自己改过的会被跳过。
设置效果
modelsDevSyncMode要不要同步这个目录
modelsDevSyncIntervalHours多久同步一次
llmPricingFile改用你自己那份费率的JSON文件

没有价格的模型只统计token、不计入费用——某个供应商提供的东西里有多少处于这种状态,真伪检测报告里会说(3.4)。

下一节:5.1 设置与配置。

在GitHub上编辑
Apache Incubator

Apache Casbin (Incubating) is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.

Copyright © 2026 The Apache Software Foundation, Licensed under the Apache License, Version 2.0.

Apache, Apache Casbin, the names of Apache projects, and the feather logo are either registered trademarks or trademarks of The Apache Software Foundation in the United States and/or other countries. All other marks mentioned may be trademarks or registered trademarks of their respective owners.

本页内容