Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Codex Model RouterNew to Visual Studio Code? Get it now.
Codex Model Router

Codex Model Router

koupualen

|
1 install
| (0) | Free
Route Codex model aliases to providers through a local proxy. 在 VS Code 中管理模型映射。
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Codex Model Router

在 VS Code 中为 Codex 管理模型接入。扩展内置代理默认只监听本机,也可改为局域网监听:Codex 选择稳定的模型别名,Router 将后续请求转发到你配置的供应商和实际模型。更换上游时,可以保留会话正在使用的别名。

Manage Codex model connections inside VS Code. The extension runs a proxy that listens on loopback by default and can optionally listen on the LAN. Codex selects a stable model alias, and Router forwards subsequent requests to your configured provider and actual model. You can change the upstream destination while keeping the alias used by a conversation.

本扩展是独立的社区工具,并非 OpenAI 或 VS Code 官方扩展。需要另行安装 Codex 扩展,并自行准备可用的供应商账号和 API Key。

This is an independent community tool, not an official OpenAI or VS Code extension. Install the Codex extension separately and provide your own supported provider account and API key.

工作方式 / How it works

Router 在 VS Code 扩展主机内提供 Responses 代理、图片生成和历史图片读取 MCP 工具。配置面板维护供应商、Codex 可见的模型、实际模型映射及图片设置;无需另外启动常驻代理程序。

Router provides a Responses proxy and MCP tools for image generation and history-image retrieval inside the VS Code extension host. Its panel manages providers, Codex-visible models, upstream model mappings, and image settings. No separate background proxy program is required.

                VS Code / extension host
  +--------------------+     +-----------------------------+
  | Codex extension    |     | Codex Model Router          |
  | model picker       |<----| settings -> models.json     |
  | conversations      |     | authenticated proxy + MCP   |
  +---------+----------+     +--------------+--------------+
            |                               ^
            | Responses / compact / MCP     | config.json
            | (alias + Bearer token)        | providers + mappings
            +------------------------------>|
                                            |
                                            +----> Provider A / Model X
                                            +----> Provider B / Model Y
                                            +----> Image API / Model Z

Codex 从本机 models.json 读取模型能力,并把携带模型别名和代理凭证的请求发送给 Router。本机连接使用 127.0.0.1,局域网客户端使用 Router 主机的网卡地址。代理按别名查找映射,替换实际模型 ID 和供应商鉴权,再转发 Responses 请求或流式响应;可选的历史图片处理在转发请求前完成。图片生成走独立的 MCP 工具及供应商图片接口。

Codex reads model capabilities from its local models.json and sends an alias and Router credential to the proxy. Local clients use 127.0.0.1; LAN clients use the Router host's network address. The proxy resolves the alias, substitutes the upstream model ID and provider authentication, and forwards Responses requests or streams. Optional image-history processing happens before a request is forwarded. Image generation uses separate MCP tools and the provider's image endpoint.

  Live after Save / 保存后作用于后续请求
  Provider URL + API key ---------+
  Alias -> provider -> model -----+--> Router snapshot --> next request
  Image model availability -------+
  Image history switch + budget --+
  Detailed logging toggle --------+
  Router API key ------------------+--> next request (update client credential)

  Codex reload required / 需要重载 Codex
  Alias + display + capabilities --> models.json --> Reload Codex --> picker

  Listener restart / 监听自动重启
  Port or listen mode --> Save --> rebind listener --> update client URL

供应商地址、API Key、“别名 → 供应商 → 实际模型”的映射和详细日志开关保存后,对后续请求生效;已经发出的请求沿用开始时的配置。新增别名、调整显示名称或模型能力会更新 Codex 模型目录,保存后还需重新加载 Codex。改动代理监听端口或监听范围会自动重新绑定监听,并需要同步更新 Codex 的接入地址。

Provider URLs, API keys, alias-to-provider-to-model mappings, and the detailed-logging switch take effect for subsequent requests after saving; in-flight requests keep their original settings. New aliases, display names, and model capabilities update the Codex model catalog and require a Codex reload after saving. Changing the proxy port or listen mode rebinds its listener and requires an updated Codex connection URL.

保存结果会指出本次修改的具体类别。更换映射供应商或实际模型不会改变别名的能力设置,也不需要重载 Codex;模型选择器的供应商标记可在下次重载时刷新。若此前还有模型列表或能力变更待加载,面板会单独说明,运行时路由仍实时生效。

Save feedback identifies the categories changed by that operation. Changing the mapped provider or actual model preserves the alias's capabilities and does not require a Codex reload; supplier labels in the model picker can refresh on the next reload. Earlier pending catalog or capability changes are reported separately and do not prevent live routing updates.

开始使用 / Get started

安装桌面版 VS Code 1.95 或更新版本及 Codex 扩展,然后安装 Codex Model Router。在活动栏打开 Codex Router。首次启动会创建本地配置,默认没有预置供应商、个人代理地址或 API Key。

Install desktop VS Code 1.95 or later and the Codex extension, then install Codex Model Router. Open Codex Router from the Activity Bar. The first launch creates local configuration without preconfigured providers, private proxy URLs, or API keys.

先在 设置 页填写并保存对外代理 API Key;允许 2–256 位大小写字母、数字和 -._~+/。未设置有效密钥时代理不会监听,复制配置按钮也不可用。监听范围 默认是仅本机;切换局域网监听时,代理会绑定所有 IPv4 网卡。再在 供应商 页添加接口名称、Base URL 和 API Key。Base URL 应是供应商的接口前缀,不包含末尾的 /responses;例如阿里云百炼可使用 https://dashscope.aliyuncs.com/compatible-mode/v1。

First set and save the Router API key in Settings using 2–256 ASCII letters, digits, or -._~+/. Until a valid key is set, the proxy does not listen and the copy buttons remain disabled. Listening defaults to loopback; LAN mode binds all IPv4 interfaces. Then add the provider name, Base URL, and API key in Providers. The Base URL is the provider's API prefix, without a trailing /responses; for example, Alibaba Cloud Model Studio uses https://dashscope.aliyuncs.com/compatible-mode/v1.

在 Codex加载模型 页建立 Codex 可见的模型别名并填写模型能力;在 模型映射 页把别名关联到供应商和实际模型 ID。点击底部的 保存配置。对话模型能力包括上下文窗口、图片输入及可选推理强度,应按实际供应商能力填写;Router 不会自动检测这些规格。

In Codex models, create a model alias visible to Codex and enter its capabilities. In Model mappings, connect that alias to a provider and an actual upstream model ID. Click Save configuration at the bottom. Enter conversation-model capabilities such as context window, image input, and reasoning levels according to your provider; Router does not discover those specifications automatically.

在 设置 页点击 复制接入配置,再点击旁边的 打开 Codex 配置文件,把片段合并到 ~/.codex/config.toml。片段包含与输入框完全相同的代理 Key;若已启用图片模型或历史图片按需读取,还会一并包含图片 MCP 的认证配置。复制的片段使用当前保存的端口、模型目录路径和第一个对话模型别名;若本机已有 Codex model_provider,会尝试复用其 ID 和名称。根级 model_provider、model 和 model_catalog_json 要放在 TOML 表之前;已有同名字段时请修改原值,避免重复定义。

In Settings, select Copy Codex configuration, then Open Codex config file, and merge the snippet into ~/.codex/config.toml. Its Router key is identical to the value entered in Settings. When image models or on-demand image history are enabled, it includes the authenticated image MCP settings. The snippet uses the saved port, catalog path, and first conversation-model alias. When an active Codex model_provider already exists, Router tries to reuse its ID and name. Put root-level model_provider, model, and model_catalog_json before TOML tables, and edit existing keys instead of duplicating them.

下列内容仅说明接入形状;example-router、example-model 和模型文件绝对路径都是占位值。实际使用时以 复制接入配置 生成的内容为准。

The following shows the connection shape only; example-router, example-model, and the absolute catalog path are placeholders. Use the snippet generated by Copy Codex configuration for your installation.

model_provider = "example-router"
model = "example-model"
model_catalog_json = "/ABSOLUTE/PATH/TO/.codex-model-router/models.json"

[model_providers."example-router"]
name = "Example Router"
base_url = "http://127.0.0.1:18765/v1"
wire_api = "responses"
requires_openai_auth = false
supports_websockets = false

[model_providers."example-router".http_headers]
Authorization = "Bearer example-key"

局域网客户端请在 Router 主机的 模型文件 区点击 打开模型文件目录,把 models.json 复制到客户端,再将客户端 model_catalog_json 改为当地文件的绝对路径。此后修改模型列表或能力时,需要重新复制该文件并重载客户端 Codex;只修改供应商或映射则不需要。复制局域网接入配置 会让你选择主机网卡地址,并复制包含对话代理与图片 MCP 的认证片段。Codex 当前不会从自定义供应商的 /v1/models 自动建立模型目录,也不接受把 model_catalog_json 指向 HTTP URL。

For a LAN client, use Open model-file directory on the Router host, copy models.json to the client, and set the client's model_catalog_json to that file's absolute path. After changing the model list or capabilities, copy the file again and reload Codex on the client; provider and mapping changes need no file transfer. Copy LAN configuration lets you choose the host address and copies authenticated chat and image MCP settings. Codex currently does not build its catalog automatically from a custom provider's /v1/models, and model_catalog_json does not accept an HTTP URL.

首次接入或修改模型目录后重新加载 Codex,然后在 Codex 的模型选择器中选择别名。Router 不会自动改写 Codex 的 TOML 文件;更换已有别名的上游映射时,则只需在 Router 中保存。

Reload Codex after initial connection or a catalog change, then select an alias in the Codex model picker. Router does not edit Codex's TOML file automatically. To change the upstream destination of an existing alias, save the mapping in Router.

配置页面 / Configuration pages

Codex加载模型 管理别名、用途和能力;供应商 管理 API 地址及密钥;模型映射 管理实际模型的去向。这三页把 Codex 所见的名字、访问凭证和上游模型分开,因此同一个实际模型可以由多个别名引用。

Codex models manages aliases, purpose, and capabilities; Providers manages API endpoints and keys; Model mappings manages upstream destinations. These pages keep the name visible to Codex, credentials, and actual model ID separate, so several aliases may use one upstream model.

图片MCP 管理可用图片模型和默认模型,并提供图片保存目录入口;设置 管理监听范围、端口、入口密钥、日志、历史图片及缓存、Codex 接入片段、重载入口以及配置备份。多窗口同时编辑时,旧版本配置不会覆盖另一窗口的新保存;需要加载最新配置再继续编辑。

Image MCP manages available image models and the default model, and provides an action to open the image directory. Settings provides the listener mode and port, ingress key, logging, image history and its cache, Codex connection snippet, reload action, and configuration backup. When multiple windows edit the same files, an older draft cannot overwrite a newer save from another window; reload the latest configuration before continuing.

日志时间采用运行 Router 的电脑本地时区,保留毫秒及明确的时区偏移,例如 2026-10-02T22:30:00.123+08:00,并随夏令时变化。

Log timestamps use the local time zone of the computer running Router, with milliseconds and an explicit offset, for example 2026-10-02T22:30:00.123+08:00, including daylight-saving changes.

图片生成 / Image generation

图片生成模型与对话模型分别配置。把图片别名映射到支持 /images/generations 的供应商后,在 图片MCP 页启用它并复制图片工具配置到 ~/.codex/config.toml。重新加载 Codex 后,继续使用普通对话模型,由会话调用 Router 的 list_image_models 和 generate_image 工具;可用模型和默认模型的后续变更保存后实时生效。

Configure image-generation models separately from conversation models. Map an image alias to a provider supporting /images/generations, enable it in Image MCP, and copy the image-tool configuration into ~/.codex/config.toml. After reloading Codex, keep using a normal conversation model and let the session call Router's list_image_models and generate_image tools. Later changes to available image models and the default model take effect after saving.

使用 OpenAI Images 协议时,generate_image 也支持图生图:将 input_image 设为 PNG、JPEG 或 WebP 的 data URL(例如 data:image/png;base64,...)或原始 base64 字符串,可选传入同格式的 mask。Router 会把这类请求发送到供应商的 /images/edits multipart 接口;省略 input_image 时仍发送到 /images/generations。输入图解码后不得超过 16 MiB,MCP 请求体不得超过 32 MiB;插件不会读取任意本地路径作为输入图。

For OpenAI Images mappings, generate_image also supports image-to-image editing. Set input_image to a PNG, JPEG, or WebP data URL (for example, data:image/png;base64,...) or raw base64, with an optional mask in the same format. Router sends these requests as multipart to the provider's /images/edits; calls without input_image continue to use /images/generations. Decoded input images are limited to 16 MiB and MCP request bodies to 32 MiB. The extension never reads arbitrary local paths as input images.

接入 腾讯 HY Image 3.5 Preview 时,先在腾讯 TokenHub 开通模型服务并取得 API Key。在 供应商 中填写 Base URL https://tokenhub.tencentmaas.com/v1 和该 Key;建立一个“图像生成”用途的模型别名后,在 模型映射 中选择该供应商、填写实际模型名 hy-image-v3.5-preview,将 图像接口协议 选为 腾讯 HY Image 3.5,最后在 图片MCP 页启用该别名。供应商、模型和协议映射保存后对后续请求实时生效。具体接入条件见腾讯官方指南。

For Tencent HY Image 3.5 Preview, enable the model in Tencent TokenHub and obtain an API key. Add a provider with Base URL https://tokenhub.tencentmaas.com/v1 and that key. Create an image-generation alias, then select the provider in Model mappings, enter the actual model ID hy-image-v3.5-preview, and choose Tencent HY Image 3.5 as the Image API protocol. Enable the alias in Image MCP. Provider, model, and protocol mapping changes apply to subsequent requests after saving. See the official Tencent guide for service prerequisites.

腾讯协议支持文字生图或一张 PNG/JPEG 参考图(最多 16 MiB)。工具使用相同的 prompt、input_image 和 size 参数;size=auto 使用腾讯默认尺寸,也可填写 4096x4096 等符合官方限制的尺寸。请省略 quality、output_format 和 mask,MCP 模型列表会提供相应提示。Router 从腾讯官方图片存储下载结果并保存,生成与下载共用超时和取消控制。通过 JSON POST /v1/images/generations 调用该映射时,仅支持一张结果以及 response_format=b64_json(均可省略)。

The Tencent protocol supports text input or one PNG/JPEG reference image up to 16 MiB. Use the same prompt, input_image, and size tool parameters. size=auto uses Tencent's default sizing; explicit sizes such as 4096x4096 must meet its documented limits. Omit quality, output_format, and mask; MCP model discovery reports these restrictions. Router downloads and saves the result from Tencent's official image storage, sharing timeout and cancellation across generation and download. JSON POST /v1/images/generations calls using this mapping support one result and response_format=b64_json, both optional defaults.

每次成功生成图片都会把原图保存到 ~/.codex-model-router/generated-images/,同时返回内存图片预览、本地路径和最终回复可用的 Markdown 图片链接。图片MCP 页可以打开保存目录,不需要选择保存模式。超过内联预览大小上限的图片仍会保存原图并返回链接,不会为了展示再次生成。

Every successful generation saves the original image to ~/.codex-model-router/generated-images/ and returns an in-memory preview, local path, and Markdown image link for the final reply. Open the directory from Image MCP; there is no storage mode to choose. Images exceeding the inline preview size limit still retain their original file and link without another generation request.

工具会提示会话将返回的 Markdown 图片链接放进最终回复,供 Codex 展示及 Remote 同步。保存失败会明确报错,不会返回虚构文件或把未落盘当成成功。升级时,旧配置里的保存模式和旧工具缓存传来的 save 值不再控制行为,统一保存文件并提供预览。

The tool instructs the conversation to include the returned Markdown image link in its final reply for Codex display and Remote synchronization. Save failures are explicit errors, never successful results with invented paths. Legacy storage settings and cached save arguments no longer control delivery: generation always saves the file and provides a preview.

升级图片工具后,需要在任务结束后重启提供共享 Router 代理的窗口扩展,并让 Codex 重新连接 MCP,以读取新版工具说明。如果其他窗口仍提供旧代理,面板会标明协议不匹配和所属进程,需要重载该窗口后生效。

After an image-tool upgrade, wait for running conversations to finish, then restart extensions in the window hosting the shared Router proxy and reconnect Codex to MCP. If another window still hosts an older proxy, the panel identifies its process and protocol mismatch so that window can be reloaded.

如果看图或图生图后出现 413 Payload Too Large,先确认报错接口。/v1/responses 表示整个对话请求过大,包括历史中的图片编码;/mcp 才是工具调用请求。在 设置 → 代理设置 → 对话请求体上限(MiB) 调整对话及压缩请求的上限,默认 128 MiB,范围 1–256 MiB;保存后对后续请求实时生效,无需重启代理或重载 Codex。较大的请求会占用更多内存。图片 MCP 的请求上限独立为 32 MiB,上游服务也可能有自己的限额。查看代理日志:Request rejected: source=router 表示本地拒绝,记录 declaredBytes、receivedBytes 和 limitBytes;Request completed: source=upstream ... status=413 表示上游拒绝,requestBytes 是实际转发的请求大小。即使关闭详细日志,也会记录这些信息。重复发送同一请求不会解除限额。

For 413 Payload Too Large after viewing or editing an image, check the endpoint first. /v1/responses refers to the whole conversation request, including encoded images in its history; /mcp refers to a tool call. In Settings → Proxy settings → Conversation request body limit (MiB), adjust the limit for Responses and compaction requests: the default is 128 MiB, with a range of 1–256 MiB. Saving applies it to subsequent requests without restarting Router or reloading Codex. Larger requests use more memory. Image MCP has a separate 32 MiB limit, and upstream services may impose their own limits. Request rejected: source=router identifies a local rejection with declaredBytes, receivedBytes, and limitBytes. Request completed: source=upstream ... status=413 identifies an upstream rejection, with requestBytes reporting the forwarded body size. These counters are available with detailed logging off. Retrying the same request cannot remove a size limit.

历史图片按需读取 / On-demand image history

图片较多的会话可以开启 设置 → 历史图片按需读取,减少反复发给上游的旧图片数据;新安装默认关闭。在 供应商 页设置每个供应商的 上游请求体预算,默认 32 MiB,可设为 1–256 MiB。这是 Router 的处理预算,不代表供应商公布的上限。超过预算时,Router 按完整 JSON 的实际字节数,从已有后续模型回复的旧图片开始,缓存图片并替换为可读回的引用。最新图片、当前工具刚返回的图片,以及无法可靠判断新旧的图片会保留;保留这些内容后仍超预算,会明确报错,提示分批或调整预算。

Enable Settings → On-demand image history for image-heavy conversations to reduce repeated uploads of older pictures. It is off by default. Each provider has an Upstream request body budget, defaulting to 32 MiB with a range of 1–256 MiB. This is Router's processing budget, not a published provider limit. When the complete JSON exceeds that budget, Router starts with older images already followed by a model response, caches their bytes, and replaces them with retrievable references. The latest images, fresh image-tool results, and images whose age cannot be determined safely remain inline. If required content still exceeds the budget, Router reports an error so you can split the task or adjust the budget.

首次使用时,先开启并保存此功能,再点击 复制接入配置,将片段合并到 Codex 的 config.toml 并重新加载 Codex。片段同时包含图片 MCP 和 [features.tool_registry] 下的 turn_metadata_includes_tool_info = true,用于提供可验证的机器工具信息,兼容代码模式中的工具调用。已有同名表时合并字段,不要重复添加。完成接入后,历史图片开关和供应商预算保存后对后续请求实时生效,无需再次重载。

For first-time setup, enable and save the feature, select Copy Codex configuration, merge the snippet into Codex's config.toml, and reload Codex. The snippet includes both image MCP and turn_metadata_includes_tool_info = true under [features.tool_registry]. This supplies verifiable tool metadata, including for code-mode tool calls. Merge fields into existing tables instead of adding duplicate tables. Once connected, later changes to the image-history switch and provider budgets apply to subsequent requests without another reload.

模型通过 list_history_images 查询当前会话档案,再用 read_history_image 读回指定图片。识别到上下文压缩请求时,Router 还会缓存其中可识别的内联图片,并持久保存会话图片索引,让压缩后的会话继续找到旧图。读回会产生新的图片工具结果,按当前图片保留。工具沿用代理 API Key 鉴权,也可供局域网客户端使用,不要求客户端能访问代理电脑的文件路径。

The model uses list_history_images to browse the conversation's archive and read_history_image to retrieve a picture. For recognized compaction requests, Router also caches the identifiable inline images and persists the conversation's image index so later turns can find older pictures. Retrieval produces a fresh image-tool result, which is retained as a current image. These tools use the Router API key and work for LAN clients without requiring access to filesystem paths on the proxy host.

缓存位于 ~/.codex-model-router/image-cache/,默认总容量 512 MiB;满时明确报错,不会自动删除旧图片。在 设置 页可以刷新占用、打开目录或清理缓存。清理会使旧图片引用失效,但不会删除 generated-images 中的生成原图;关闭功能也不会自动清理文件。配置导出备份不包含图片缓存。

The cache lives in ~/.codex-model-router/image-cache/ with a default total capacity of 512 MiB. A full cache produces an explicit error; older images are not deleted automatically. Settings lets you refresh usage, open the directory, or clear the cache. Clearing invalidates old image references but leaves originals in generated-images untouched. Disabling the feature does not delete cached files, and configuration backups do not include the image cache.

缓存可能包含用户上传的私人图片,保存的是 Codex 实际发送给 Router 的副本,不一定是用户原始文件。Router 的 MCP 读回返回相同的缓存图片字节,不进行二次压缩或生成;Codex 接收工具结果后仍可能再次做图片预处理。

Cached content can include private uploaded pictures. Router preserves the copy actually sent by Codex, which may differ from the user's original file. MCP retrieval returns the same cached image bytes without recompression or regeneration; Codex may still preprocess an image again after receiving the tool result.

此功能只减少 Router → 供应商 的请求体,Codex 发给 Router 的原始请求大小不变,因此本地接收上限仍然适用。缺少稳定会话标识、无法确认读图工具可用,或使用依赖服务端历史的增量请求时,Router 会保守地透传图片。它不能保证消除所有 413,也不能让会话无限增长;上游自身的文字、图片或接口限制仍需满足。

This feature reduces only the Router → provider request body. It does not shrink the original request sent by Codex, so the local receiving limit continues to apply. Router conservatively forwards images unchanged when a stable conversation identifier or verifiable retrieval tools are unavailable, or when requests rely on incremental server-side history. It does not guarantee removal of every 413 error or support unlimited history; the provider's text, image, and API limits still apply.

备份与迁移 / Backup and migration

Router 把用户设置保存在 ~/.codex-model-router/config.json,把 Codex 模型能力保存在同目录的 models.json。随扩展版本更新的 model-sample.json 只是生成和更新模型目录的样板,不存放你的个人设置。Codex 的 config.toml 仍由你自行维护。

Router stores user settings in ~/.codex-model-router/config.json and Codex model capabilities in the neighboring models.json. The version-managed model-sample.json is a template for creating and updating the catalog, not a store for your personal settings. You continue to manage Codex's config.toml yourself.

设置 页可以把 config.json 与 models.json 导出为一份 JSON 备份,并从该备份导入。导入前会显示模型和供应商数量,确认后覆盖本机两份配置;导入后重新加载 Codex 以读取模型目录。备份包含明文 API Key,请按凭证文件保管;model-sample.json 随已安装的扩展提供,无需打包进备份。迁移到另一台机器后,还要核对 Codex 的接入配置、监听端口和供应商可达性。

Settings can export config.json and models.json as one JSON backup and import that backup later. Before import, Router shows the model and provider counts; confirmation replaces both local files. Reload Codex afterward to read the catalog. The backup contains API keys in plain text, so handle it as a credential file. model-sample.json comes with the installed extension and is not part of the backup. On another machine, verify the Codex connection settings, listener port, and provider reachability.

适用场景 / When to use it

当多个供应商提供兼容的 Responses 接口,或者同一模型有不同上游渠道时,Router 可以让 Codex 使用固定别名,在配置面板里切换后续请求的目标。它也适合保留备用别名,以便给不同会话选择不同映射;修改一个共享别名会影响所有使用它的会话后续请求。

Router is useful when several providers offer compatible Responses APIs, or when the same model is available through several upstream channels. Codex can keep a stable alias while you change the destination for later requests. Reserve aliases can give different conversations different mappings; changing a shared alias affects future requests from every conversation using it.

Router 不会把 Chat Completions 接口转换为 Responses,也不会替供应商补齐不支持的工具调用、压缩或图片能力。上游报错会返回给 Codex,代理不会自动换供应商重试。模型目录中填写的能力应与实际模型匹配,尤其是上下文、图片输入和推理档位。

Router does not convert Chat Completions to Responses or add tool calling, compaction, or image features missing from a provider. Upstream errors go back to Codex; the proxy does not automatically retry with another provider. Catalog capabilities should match the actual model, especially context size, image input, and reasoning levels.

隐私与运行边界 / Privacy and runtime boundaries

API Key 按本扩展的设计明文保存在本机 config.json,配置页可以显示它,复制的接入片段也包含原样的 Bearer 凭证。请限制配置文件和导出备份的访问权限。代理默认只监听 127.0.0.1;局域网模式绑定 0.0.0.0,覆盖所有 IPv4 网卡,若主机有公网接口也可能对公网开放。HTTP 请求仍是明文传输。短密钥无法抵御猜测,Bearer 认证也不能防止同一网络中能监听流量的人读取请求;请仅在可信局域网使用,并检查防火墙。关闭详细日志时只记录别名、供应商、实际模型、状态和耗时;开启后才旁路解析上游返回的 token 用量。日志不记录请求正文、图片内容或 API Key。

By design, API keys are stored in plain text in the local config.json; copied connection snippets contain the same literal Bearer key. Restrict access to the configuration and exported backups. The proxy listens on 127.0.0.1 by default. LAN mode binds 0.0.0.0, covering every IPv4 interface and potentially exposing the port through a public interface. HTTP traffic is unencrypted, short keys are easy to guess, and Bearer authentication does not protect traffic from someone who can observe the network. Use LAN mode only on trusted networks and check your firewall. With detailed logging off, logs contain only aliases, providers, actual models, status, and duration; when enabled, Router also parses upstream token usage. Request bodies, image contents, and API keys are not logged.

详细日志开启后,Responses 和压缩接口的 token 统计由旁路解析,不会改动或等待客户端响应。当前支持未压缩的 JSON 与 SSE;HTTP 内容编码为 gzip 或 br 时仍原样透传,用量显示为 n/a。

With detailed logging enabled, Responses and compaction token statistics are parsed separately without modifying or holding back client responses. Uncompressed JSON and SSE are supported; HTTP bodies encoded with gzip or br are forwarded unchanged and their usage is shown as n/a.

代理随 VS Code 扩展主机运行;关闭全部相关窗口或停用扩展会停止监听。多个窗口可以复用同一配置、密钥、端口和监听范围,但正在进行的请求不会在宿主窗口退出时迁移。Remote SSH、WSL 或容器环境中,Codex 进程必须能访问运行 Router 的主机地址;远程场景需要自行核对连通性。

The proxy runs with the VS Code extension host; closing all relevant windows or disabling the extension stops its listener. Multiple windows can share the same configuration, key, port, and listen mode, but in-flight requests do not migrate if the host window exits. Under Remote SSH, WSL, or containers, the Codex process must be able to reach the Router host; verify connectivity in your remote setup.

本项目使用 MIT 许可证。版本变更见扩展详情页的 Changelog。

This project is licensed under MIT. See the extension's Changelog page for release notes.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft