配置参考
本页是被跟踪的 config.example.toml 的单一来源配置参考。ProxAI 首次运行时会把该文件写到应用目录,然后从本地 config.toml 加载真实运行时配置。
Section 地图
Section titled “Section 地图”| Section | 负责 | 任务文档 |
|---|---|---|
[server] | 本地 proxy listener、请求体大小和并发限制。 | 配置说明 |
[mcp] | 本地 MCP control/API listener。MCP 是控制面,不是模型路径。 | 配置说明 |
[routing.default_provider_names] | 每个入站请求协议的 fallback provider 名称。 | 路由与 Provider |
[[routing.routes]] | 显式模型/协议路由和可选 upstream model rewrite。 | 路由匹配 |
[providers.<name>] | 命名上游 provider 的协议、base URL、API key、compatibility 和 idle timeout。 | Provider 设置 |
[tool_calls] | 不完整流式工具调用参数的语义超时。 | 流式行为 |
[logging] | 日志 level、输出格式和颜色行为。 | 观测与诊断 |
[logging.duration_thresholds] | Human log duration coloring thresholds。 | 观测与诊断 |
[error_responses] | 客户端错误格式:text 或 JSON。 | 错误响应 |
[capture] | 本地按 phase 的 capture 开关。 | 捕获阶段 |
| 产物 | 角色 |
|---|---|
`config.example.toml` | 仓库追踪的示例和文档来源。保持简洁且不含 secret。 |
`config.toml` | 本地运行时配置。有意 git-ignored。 |
`src/config.rs` | Typed schema、解析、校验和默认值。 |
`site/src/content/docs/*/reference/configuration.mdx` | 嵌入仓库示例并映射 sections 的 reference 页面。 |
config.example.toml
Section titled “config.example.toml”下面的内容直接从仓库根的
config.example.toml注入,因此注释保留英文,避免翻译造成漂移。
[server]host = "127.0.0.1"port = 18080# Maximum inbound HTTP request body size accepted by the local proxy.max_request_body_bytes = 52428800# Maximum number of concurrently handled local proxy requests.max_concurrent_requests = 64
[mcp]# Local MCP control/API listener. The MCP endpoint is served at /mcp.# Example default URL: http://127.0.0.1:18081/mcphost = "127.0.0.1"port = 18081
[routing.default_provider_names]openai_responses = "openai"# No-conversion default provider for /v1/chat/completions.openai_chat_completions = "minimax_chat"# No-conversion default provider for /v1/messages.anthropic_messages = "anthropic"
# Route matching modes:# - exact: case-insensitive exact match# - glob: * and ? wildcard match# - regex: case-insensitive regex match; upstream_model acts as replacement template# - auto: infer glob when * or ? is present, infer regex for obvious regex syntax,# otherwise exact## request_protocol is optional. The inbound protocol is determined from the# actual request path (/v1/responses, /v1/chat/completions, or /v1/messages).# - omitted: match this model pattern for any inbound protocol# - set: require the inbound protocol to match; if the model pattern matches but# the request path uses a different protocol, proxai returns a config error# If you need different providers for the same model pattern across endpoints,# create separate routes and set request_protocol explicitly on each one.## upstream_model is optional:# - omitted: forward the original request model unchanged# - exact/glob: fixed upstream model mapping# - regex: replacement template using $1 or $name
[[routing.routes]]# Stable route names can be targeted by --route-override name.field=value.name = "openai"# auto => globmodel_pattern = "gpt-*"provider = "openai"
[[routing.routes]]name = "mimo_chat_ant"# Example OpenAI Chat Completions requests routed to an Anthropic-compatible provider.model_pattern = "mimo-*"provider = "anthropic"
[[routing.routes]]name = "minimax_chat"# Example MiniMax M3 route for OpenAI Chat Completions-compatible clients.model_pattern = "MiniMax-*"provider = "minimax_chat"
# Example exact alias route:# [[routing.routes]]# name = "gpt_54_stable_alias"# model_pattern = "gpt-5.4-stable"# provider = "openai"# upstream_model = "gpt-5.4"
# Example regex mapping route:# [[routing.routes]]# name = "gpt_minor_regex"# model_pattern = "^gpt-(?<major>\d+)\.(?<minor>\d+)-mini$"# provider = "openai"# match_kind = "regex"# upstream_model = "gpt-$major.$minor-mini"
[providers.openai]protocol = "openai_responses"base_url = "http://your-openai-upstream.example:8080"# Required. Proxai always sends this key upstream and ignores any# Authorization header Zed provided. This makes dummy Zed keys safe.api_key = "replace-with-your-api-key"read_idle_timeout_secs = 120
[providers.minimax_chat]protocol = "openai_chat_completions"base_url = "https://api.minimaxi.com/v1"api_key = "replace-with-your-minimax-api-key"read_idle_timeout_secs = 120
[providers.anthropic]protocol = "anthropic_messages"base_url = "https://api.anthropic.com"api_key = "replace-with-your-api-key"# strict: do not rewrite successful upstream Anthropic Messages response bodies.# anthropic_compatible: fill conservative compatibility gaps, currently# missing SDK required-nullable response fields, bare message_start events,# measured MiniMax thinking block missing-signature events, and measured# GLM 5.1 partial server_tool_use counters.compatibility = "strict"read_idle_timeout_secs = 120
[tool_calls]# Semantic timeout for incomplete streamed tool arguments. Must be > 0.timeout_secs = 120
[logging]level = "info"output_format = "human"use_color = true
[logging.duration_thresholds]warn_ms = 5000error_ms = 15000
[error_responses]# text: concise text body, best for raw-string clients# json: OpenAI-style JSON error bodyformat = "text"
[capture]# Capture the client request as proxai received it.inbound_request_enabled = false# Capture the request proxai actually forwards upstream after adaptation.provider_request_enabled = false# Capture the upstream response headers and raw response body bytes.upstream_response_enabled = false# Capture the final response proxai sends back to the client.outbound_response_enabled = false