Apache Casbin Gateway
6. 常见问题

6.1 常见问题

安装

需要先装数据库、Go或Node吗? 不需要。一条命令装完,分发的是一个把界面也打包进去的单文件二进制(1.2)。

http://localhost:17000打不开。 执行casbin-gateway status。如果端口被别的程序占着,Gateway会说出是谁然后退出,而不是抢端口——腾出端口,或者在conf/app.conf里改httpport(5.1)。

我改了conf/app.conf,但没有任何变化。 这个文件只在第一次启动时给设置播种;之后设置存在数据库里,在设置页改。例外是httpport、driverName、dataSourceName、dbName和redisEndpoint,它们在数据库打开之前就被读取。

Agent客户端页是空的。 要么Gateway跑在容器里,看到的是它自己的文件系统而不是你的(5.4);要么那个Agent装在安装程序和PATH都描述不了的地方——用选择程序(2.1)。

供应商与路由

中转商该选哪个类型? 它自己文档里写的那一套。类型说的是供应商说什么,不是你的Agent必须说什么——Gateway在四套API之间双向转换(3.2)。

Codex能跑在DeepSeek或Kimi上吗? 能。Codex只说OpenAI Responses,Gateway替它转换。Claude Code和Gemini CLI接任意供应商同理(3.2)。

我的Agent用的是ChatGPT或Claude订阅,没有Key。 选ChatGPT订阅或Claude订阅这个来源,点登录:Gateway保管这个订阅,像Key一样给每个Agent花。想把登录留在Agent自己手里,就把认证方式设成调用方自己的登录(3.3)。

环境变量里的cg-...是什么? Gateway自己的中继令牌,不是厂商的Key。Agent那个变量必须有东西,而Gateway对上游用的是供应商的Key(3.2)。

探测会花我的钱吗? 会花掉那个供应商自己账上几分钱,报告里写着。providerProbeMode = "manual"只在你要求时探测,"off"从不探测(3.4)。

记录与隐私

我的提示词会被发到哪里去吗? 不会。记录存在Gateway自己的数据库里,就在这台机器上。

怎么让它完全不记录提示词? 在接入Agent之前,把LLM记录页顶部的选择器——或者设置→LLM记录——设成关闭记录。默认情况下每个转发请求都被完整记录(4.2)。

记录里会有API Key吗? 请求头完全不记录;正文里像凭据的值在落库前就被替换掉,替换了多少处会显示在记录上。

权限

我关掉了终端,Agent还是执行了命令。 先看这个Agent在哪个执行点上。工具开关对"流量走Gateway的Agent"和"开了监控的Agent"(通过钩子)生效;既不走也不监控的Agent不受任何约束。权限页会说明它属于哪种情况(4.1)。

能手写策略吗? 能。高级里有Casbin的model.conf和policy.csv,也接受你自己加的行,并且你写的行会在开关生成的行之前被检查(4.1)。

用量与费用

用量里出现了我从没接进Gateway的Agent的花费。 这正是它的意义:Agent账单读的是Agent自己的会话记录,所以算得上那些根本没走这里的请求。转发账单才是走过这里那部分的窄口径账(4.3)。

我这家中转商的费用算错了。 在模型定价里改这个模型的价,改完就不会再被覆盖。或者把llmPricingFile指向你自己的费率(4.3)。

其他

在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.

本页内容