mimo2codex-proxy
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesemimo2codex Proxy Skill
mimo2codex Proxy Skill
Overview
概述
mimo2codex is a local proxy server that translates between OpenAI Codex's Responses API () and upstream LLM providers using Chat Completions API. It enables the latest Codex CLI and desktop app to work with:
wire_api = "responses"- Xiaomi MiMo (V2.5 Pro, V2 Flash, V2 Omni)
- DeepSeek (V4 Pro, V4 Flash, Reasoner)
- Generic OpenAI-compatible providers (Qwen, GLM, Kimi, Ollama, vLLM, LM Studio)
Key features:
- Per-request model routing (send → MiMo,
mimo-v2.5-pro→ DeepSeek)deepseek-v4-pro - Automatic MiMo round-trip handling (v0.2.3+)
reasoning_content - Built-in admin webui at
http://127.0.0.1:8788/admin/ - Tool calling, web search, vision (model-dependent)
- sqlite persistence for logs and token stats
mimo2codex 是一款本地代理服务器,可在OpenAI Codex的Responses API()与使用Chat Completions API的上游大语言模型(LLM)提供商之间进行转换。它能让最新版Codex CLI和桌面应用与以下模型兼容:
wire_api = "responses"- 小米MiMo(V2.5 Pro、V2 Flash、V2 Omni)
- DeepSeek(V4 Pro、V4 Flash、Reasoner)
- 通用OpenAI兼容提供商(Qwen、GLM、Kimi、Ollama、vLLM、LM Studio)
核心特性:
- 按请求路由模型(发送→ 转发至MiMo,
mimo-v2.5-pro→ 转发至DeepSeek)deepseek-v4-pro - 自动处理MiMo的往返逻辑(v0.2.3及以上版本)
reasoning_content - 内置管理WebUI,访问地址为
http://127.0.0.1:8788/admin/ - 工具调用、网页搜索、视觉能力(取决于模型支持情况)
- 使用sqlite持久化存储日志与token统计数据
Installation
安装
npm (recommended)
npm(推荐方式)
bash
npm install -g mimo2codexbash
npm install -g mimo2codexcurl one-liner
curl一键安装
bash
undefinedbash
undefinedmacOS/Linux
macOS/Linux
Windows PowerShell
Windows PowerShell
undefinedundefinedGit clone (for development)
Git克隆(用于开发)
bash
git clone https://github.com/7as0nch/mimo2codex
cd mimo2codex
npm install
npm run build
npm link # registers `mimo2codex` globallyRequirements: Node.js ≥ 18
bash
git clone https://github.com/7as0nch/mimo2codex
cd mimo2codex
npm install
npm run build
npm link # 全局注册`mimo2codex`命令要求:Node.js ≥ 18
Quick Start
快速开始
1. Get API Keys
1. 获取API密钥
- MiMo: platform.xiaomimimo.com → Console → API Keys (or
sk-prefix)tp- - DeepSeek: api-docs.deepseek.com → API Keys (prefix)
sk-
- MiMo:访问platform.xiaomimimo.com → 控制台 → API密钥(前缀为或
sk-)tp- - DeepSeek:访问api-docs.deepseek.com → API密钥(前缀为)
sk-
2. Configure Environment Variables
2. 配置环境变量
Built-in loader (v0.2.8+, recommended):
bash
undefined内置加载器(v0.2.8及以上版本,推荐):
bash
undefinedInitialize .env file in ~/.mimo2codex/
在~/.mimo2codex/目录下初始化.env文件
mimo2codex init
mimo2codex init
Edit ~/.mimo2codex/.env and add your keys:
编辑~/.mimo2codex/.env并添加你的密钥:
MIMO_API_KEY=sk-your-mimo-key
MIMO_API_KEY=sk-your-mimo-key
DS_API_KEY=sk-your-deepseek-key
DS_API_KEY=sk-your-deepseek-key
Start (auto-loads .env)
启动代理(自动加载.env文件)
mimo2codex
**Manual environment variables:**
```bashmimo2codex
**手动配置环境变量**:
```bashMiMo only
仅使用MiMo
export MIMO_API_KEY=sk-your-mimo-key
mimo2codex
export MIMO_API_KEY=sk-your-mimo-key
mimo2codex
DeepSeek only
仅使用DeepSeek
export DS_API_KEY=sk-your-deepseek-key
mimo2codex --model ds
export DS_API_KEY=sk-your-deepseek-key
mimo2codex --model ds
Both providers (per-request routing)
同时启用两个提供商(按请求路由)
export MIMO_API_KEY=sk-your-mimo-key
export DS_API_KEY=sk-your-deepseek-key
mimo2codex
undefinedexport MIMO_API_KEY=sk-your-mimo-key
export DS_API_KEY=sk-your-deepseek-key
mimo2codex
undefined3. Configure Codex
3. 配置Codex
The startup banner prints the required snippets. Copy them to:
macOS/Linux:
~/.codex/auth.json~/.codex/config.toml
Windows:
%USERPROFILE%\.codex\auth.json%USERPROFILE%\.codex\config.toml
Example :
auth.jsonjson
{
"base_url": "http://127.0.0.1:8788",
"api_key": "fake_api_key"
}Example :
config.tomltoml
wire_api = "responses"
model = "mimo-v2.5-pro"启动时的横幅会显示所需的配置代码片段。将其复制到对应路径:
macOS/Linux:
~/.codex/auth.json~/.codex/config.toml
Windows:
%USERPROFILE%\.codex\auth.json%USERPROFILE%\.codex\config.toml
示例:
auth.jsonjson
{
"base_url": "http://127.0.0.1:8788",
"api_key": "fake_api_key"
}示例:
config.tomltoml
wire_api = "responses"
model = "mimo-v2.5-pro"4. Start Codex
4. 启动Codex
bash
codexbash
codexCLI Commands
CLI命令
Core Commands
核心命令
bash
undefinedbash
undefinedStart proxy (MiMo default)
启动代理(默认使用MiMo)
mimo2codex
mimo2codex
Start with DeepSeek as default
启动代理并设置DeepSeek为默认提供商
mimo2codex --model ds
mimo2codex --model ds
Custom port
使用自定义端口
mimo2codex --port 9000
mimo2codex --port 9000
Custom data directory
使用自定义数据目录
mimo2codex --data-dir /path/to/data
mimo2codex --data-dir /path/to/data
Disable reasoning display (still round-trips for MiMo)
禁用推理内容显示(仍会为MiMo保留往返逻辑)
mimo2codex --no-reasoning
mimo2codex --no-reasoning
Disable .env auto-loading
禁用.env自动加载
mimo2codex --no-load-env
undefinedmimo2codex --no-load-env
undefinedUtility Commands
实用命令
bash
undefinedbash
undefinedInitialize .env file
初始化.env文件
mimo2codex init
mimo2codex init
Print cc-switch snippets
打印cc-switch配置片段
mimo2codex print-cc-switch
mimo2codex print-cc-switch
Show version
显示版本
mimo2codex --version
mimo2codex --version
Show help
显示帮助信息
mimo2codex --help
undefinedmimo2codex --help
undefinedConfiguration
配置说明
Environment Variables
环境变量
| Variable | Provider | Required |
|---|---|---|
| MiMo | For MiMo models |
| DeepSeek | For DeepSeek models |
| Qwen | For Qwen models |
| GLM | For GLM models |
| Kimi | For Kimi models |
| OpenAI | For OpenAI models |
| - | Custom Codex config directory |
| 变量名 | 提供商 | 是否必填 |
|---|---|---|
| MiMo | 使用MiMo模型时必填 |
| DeepSeek | 使用DeepSeek模型时必填 |
| Qwen | 使用Qwen模型时必填 |
| GLM | 使用GLM模型时必填 |
| Kimi | 使用Kimi模型时必填 |
| OpenAI | 使用OpenAI模型时必填 |
| - | 自定义Codex配置目录 |
CLI Flags
CLI参数
| Flag | Default | Description |
|---|---|---|
| | Proxy server port |
| | Proxy server host |
| | Default provider ( |
| | Data/logs directory |
| | Hide reasoning from terminal |
| | Disable .env auto-loading |
| | Log level (debug/info/warn/error) |
| 参数 | 默认值 | 描述 |
|---|---|---|
| | 代理服务器端口 |
| | 代理服务器主机地址 |
| | 默认提供商( |
| | 数据/日志存储目录 |
| | 在终端隐藏推理内容 |
| | 禁用.env文件自动加载 |
| | 日志级别(debug/info/warn/error) |
Model Routing
模型路由
Built-in Model IDs
内置模型ID
MiMo:
- (default)
mimo-v2.5-pro mimo-v2-flash- (vision)
mimo-v2.5 - (vision)
mimo-v2-omni
DeepSeek:
- (default)
deepseek-v4-pro deepseek-v4-flashdeepseek-chatdeepseek-reasoner
MiMo:
- (默认)
mimo-v2.5-pro mimo-v2-flash- (支持视觉)
mimo-v2.5 - (支持视觉)
mimo-v2-omni
DeepSeek:
- (默认)
deepseek-v4-pro deepseek-v4-flashdeepseek-chatdeepseek-reasoner
Routing Logic
路由逻辑
- Explicit match: If client sends , routes to MiMo (if key configured)
mimo-v2.5-pro - Fallback: If client sends unknown model (e.g. ), routes to
gpt-4oprovider's default--model - Provider disabled: If client sends but no
qwen3-max, falls back toQWEN_API_KEYprovider--model
Example routing with both keys configured:
bash
export MIMO_API_KEY=sk-mimo-key
export DS_API_KEY=sk-deepseek-key
mimo2codex # default fallback: mimo- 精准匹配:如果客户端发送,则路由到MiMo(需已配置密钥)
mimo-v2.5-pro - ** fallback逻辑**:如果客户端发送未知模型(例如),则路由到
gpt-4o指定的默认提供商的默认模型--model - 提供商未启用:如果客户端发送但未配置
qwen3-max,则 fallback到QWEN_API_KEY指定的提供商--model
示例:配置双提供商密钥后的路由
bash
export MIMO_API_KEY=sk-mimo-key
export DS_API_KEY=sk-deepseek-key
mimo2codex # 默认fallback:mimoIn Codex config.toml:
在Codex的config.toml中:
model = "deepseek-v4-pro" → Routes to DeepSeek
model = "deepseek-v4-pro" → 路由到DeepSeek
model = "mimo-v2.5-pro" → Routes to MiMo
model = "mimo-v2.5-pro" → 路由到MiMo
model = "gpt-4o" → Falls back to mimo-v2.5-pro
model = "gpt-4o" → Fallback到mimo-v2.5-pro
undefinedundefinedAdmin Web UI
管理WebUI
Access at (port matches )
http://127.0.0.1:8788/admin/--port访问地址:(端口与参数一致)
http://127.0.0.1:8788/admin/--portFeatures
功能特性
- Dashboard: Token usage charts, cache hit rates, request stats
- Models: View all available models, test with ⚡Probe button
- Providers: View/edit provider configs from
providers.json - Logs: Browse chat logs with filtering
- Settings: Configure Codex paths, manage aliases
- Codex Enable: One-click write of and
auth.json(replaces cc-switch)config.toml
- 仪表盘:token使用量图表、缓存命中率、请求统计
- 模型管理:查看所有可用模型,点击⚡Probe按钮测试连接
- 提供商管理:查看/编辑中的提供商配置
providers.json - 日志管理:浏览聊天日志并支持过滤
- 设置:配置Codex路径、管理模型别名
- Codex启用:一键写入和
auth.json配置(替代cc-switch)config.toml
Codex Enable (v0.2.6+)
Codex启用(v0.2.6及以上版本)
- Open
http://127.0.0.1:8788/admin/ - Click "Codex Enable" tab
- Select model and click "Apply"
- Automatically backs up existing configs (first OpenAI backup preserved permanently)
Runtime override mode: Switch models without restarting Codex (experimental)
- 打开
http://127.0.0.1:8788/admin/ - 点击“Codex Enable”标签页
- 选择模型并点击“Apply”
- 自动备份现有配置(首次OpenAI配置会永久保留)
运行时覆盖模式:无需重启Codex即可切换模型(实验性功能)
Adding Custom Providers
添加自定义提供商
Edit (created after first run):
~/.mimo2codex/providers.jsonjson
{
"providers": [
{
"name": "qwen",
"baseUrl": "https://dashscope.aliyuncs.com/compatible-mode/v1",
"apiKeyEnvVar": "QWEN_API_KEY",
"defaultModel": "qwen3-max",
"models": ["qwen3-max", "qwen-turbo"],
"aliases": {
"qwen3": "qwen3-max"
},
"supportsWebSearch": true
}
]
}Provider schema:
| Field | Type | Description |
|---|---|---|
| string | Unique provider identifier |
| string | OpenAI-compatible base URL |
| string | Environment variable name |
| string | Model ID for fallback |
| string[] | Supported model IDs |
| object | Model alias mappings |
| boolean | Enable web search tool |
编辑(首次运行后自动创建):
~/.mimo2codex/providers.jsonjson
{
"providers": [
{
"name": "qwen",
"baseUrl": "https://dashscope.aliyuncs.com/compatible-mode/v1",
"apiKeyEnvVar": "QWEN_API_KEY",
"defaultModel": "qwen3-max",
"models": ["qwen3-max", "qwen-turbo"],
"aliases": {
"qwen3": "qwen3-max"
},
"supportsWebSearch": true
}
]
}提供商配置 schema:
| 字段 | 类型 | 描述 |
|---|---|---|
| string | 唯一提供商标识符 |
| string | OpenAI兼容的基础URL |
| string | 环境变量名称 |
| string | fallback使用的模型ID |
| string[] | 支持的模型ID列表 |
| object | 模型别名映射 |
| boolean | 是否启用网页搜索工具 |
Example: Ollama
示例:Ollama
json
{
"name": "ollama",
"baseUrl": "http://localhost:11434/v1",
"apiKeyEnvVar": "OLLAMA_API_KEY",
"defaultModel": "llama3.2",
"models": ["llama3.2", "qwen2.5-coder"],
"aliases": {
"llama": "llama3.2"
},
"supportsWebSearch": false
}bash
export OLLAMA_API_KEY=ollama # Any non-empty value
mimo2codexIn Codex :
config.tomltoml
model = "llama3.2"json
{
"name": "ollama",
"baseUrl": "http://localhost:11434/v1",
"apiKeyEnvVar": "OLLAMA_API_KEY",
"defaultModel": "llama3.2",
"models": ["llama3.2", "qwen2.5-coder"],
"aliases": {
"llama": "llama3.2"
},
"supportsWebSearch": false
}bash
export OLLAMA_API_KEY=ollama # 任意非空值即可
mimo2codex在Codex的中配置:
config.tomltoml
model = "llama3.2"Tool Calling
工具调用
Supported Tools
支持的工具
- Function tools: Custom JSON schemas
- local_shell: Execute shell commands
- MCP tools: Via parameter
namespace - web_search: MiMo native (auto-enabled for MiMo, skipped for DeepSeek)
- 函数工具:自定义JSON schema
- local_shell:执行Shell命令
- MCP工具:通过参数调用
namespace - web_search:MiMo原生支持(自动为MiMo启用,DeepSeek会忽略此工具调用)
Web Search
网页搜索
MiMo: Translates Codex's tool to MiMo's native builtin. Requires plugin activation in MiMo console.
web_searchDeepSeek: Web search not supported — tool calls are stripped.
MiMo:将Codex的工具转换为MiMo的原生内置工具,需在MiMo控制台激活对应插件。
web_searchDeepSeek:不支持网页搜索——工具调用会被自动移除。
Example Tool Call
工具调用示例
typescript
// Codex sends:
{
"model": "mimo-v2.5-pro",
"tools": [
{
"type": "function",
"function": {
"name": "get_weather",
"parameters": {
"type": "object",
"properties": {
"location": { "type": "string" }
}
}
}
}
]
}
// mimo2codex translates to MiMo Chat Completions:
{
"model": "mimo-v2.5-pro",
"tools": [
{
"type": "function",
"function": { ... }
}
]
}typescript
// Codex发送的请求:
{
"model": "mimo-v2.5-pro",
"tools": [
{
"type": "function",
"function": {
"name": "get_weather",
"parameters": {
"type": "object",
"properties": {
"location": { "type": "string" }
}
}
}
}
]
}
// mimo2codex转换为MiMo Chat Completions请求:
{
"model": "mimo-v2.5-pro",
"tools": [
{
"type": "function",
"function": { ... }
}
]
}Vision Support
视觉能力支持
Supported models:
- (MiMo)
mimo-v2.5 - (MiMo)
mimo-v2-omni
Non-vision models (, , DeepSeek models): Images are auto-stripped with placeholder text.
mimo-v2.5-promimo-v2-flash支持的模型:
- (MiMo)
mimo-v2.5 - (MiMo)
mimo-v2-omni
非视觉模型(、、DeepSeek系列模型):图片会被自动移除并替换为占位文本。
mimo-v2.5-promimo-v2-flashExample Vision Request
视觉请求示例
In Codex :
config.tomltoml
model = "mimo-v2.5"bash
codex
> Describe this image: /path/to/image.jpgmimo2codex forwards the image URL/base64 to MiMo's vision model.
在Codex的中配置:
config.tomltoml
model = "mimo-v2.5"bash
codex
> Describe this image: /path/to/image.jpgmimo2codex会将图片URL/base64转发至MiMo的视觉模型。
MiMo reasoning_content Round-Trip
MiMo reasoning_content 往返处理
Problem: MiMo requires every assistant message with to echo back its on the next turn. Without this, MiMo returns 400 errors or hallucinates.
tool_callsreasoning_contentSolution: mimo2codex ≥ 0.2.3 automatically stores and re-inserts on subsequent turns.
reasoning_content问题:MiMo要求所有包含的助手消息,在后续对话轮次中必须回显之前的。如果缺少该内容,MiMo会返回400错误或产生幻觉。
tool_callsreasoning_content解决方案:mimo2codex ≥ 0.2.3版本会自动存储并在后续对话轮次中重新插入。
reasoning_contentExample
示例
typescript
// Turn 1: MiMo returns
{
"role": "assistant",
"content": "",
"tool_calls": [...],
"reasoning_content": "I need to search the web"
}
// Turn 2: mimo2codex auto-injects reasoning_content
{
"role": "assistant",
"content": "",
"tool_calls": [...],
"reasoning_content": "I need to search the web" // ← auto-added
}Flag: hides reasoning from terminal but preserves round-trip.
--no-reasoningtypescript
// 第一轮:MiMo返回的内容
{
"role": "assistant",
"content": "",
"tool_calls": [...],
"reasoning_content": "I need to search the web"
}
// 第二轮:mimo2codex自动注入reasoning_content
{
"role": "assistant",
"content": "",
"tool_calls": [...],
"reasoning_content": "I need to search the web" // ← 自动添加
}参数:会在终端隐藏推理内容,但仍会保留往返逻辑。
--no-reasoningCommon Patterns
常见配置模式
Multi-Provider Setup
多提供商配置
bash
undefinedbash
undefined.env file (~/.mimo2codex/.env)
.env文件(路径:~/.mimo2codex/.env)
MIMO_API_KEY=sk-mimo-key
DS_API_KEY=sk-deepseek-key
QWEN_API_KEY=sk-qwen-key
MIMO_API_KEY=sk-mimo-key
DS_API_KEY=sk-deepseek-key
QWEN_API_KEY=sk-qwen-key
Start proxy
启动代理
mimo2codex
mimo2codex
Codex config.toml - switch models dynamically:
Codex的config.toml - 动态切换模型:
model = "mimo-v2.5-pro"
model = "mimo-v2.5-pro"
model = "deepseek-v4-pro"
model = "deepseek-v4-pro"
model = "qwen3-max"
model = "qwen3-max"
undefinedundefinedTesting Model Connections
测试模型连接
Use the admin UI's ⚡Probe button:
- Open
http://127.0.0.1:8788/admin/ - Go to "Codex Enable" or "Models" tab
- Click ⚡Probe next to any model
- Validates key, baseUrl, and model ID end-to-end
使用管理UI的**⚡Probe**按钮:
- 打开
http://127.0.0.1:8788/admin/ - 进入“Codex Enable”或“Models”标签页
- 点击任意模型旁的⚡Probe按钮
- 端到端验证密钥、baseUrl和模型ID是否有效
Token Usage Tracking
Token使用量追踪
bash
undefinedbash
undefinedStart proxy
启动代理
mimo2codex
mimo2codex
- Dashboard: Charts with cache hit overlay
- 仪表盘:带缓存命中率叠加的图表
- Green bars: Cache hits
- 绿色柱状图:缓存命中
- Gray ghosts: Prompt token totals
- 灰色虚影:提示token总量
- Window-wide hit rate summary
- 全局命中率汇总
undefinedundefinedCustom Codex Directory
自定义Codex目录
bash
undefinedbash
undefinedVia environment variable
通过环境变量配置
export CODEX_HOME=/custom/path
mimo2codex
export CODEX_HOME=/custom/path
mimo2codex
Via admin UI settings
通过管理UI设置
Navigate to Settings → Codex Path
进入Settings → Codex Path
undefinedundefinedTroubleshooting
故障排除
400 Errors with MiMo (Tool Calls)
MiMo工具调用返回400错误
Symptom: MiMo returns 400 or agent rambles instead of calling tools.
Cause: Missing round-trip.
reasoning_contentFix: Upgrade to mimo2codex ≥ 0.2.3
bash
npm update -g mimo2codex症状:MiMo返回400错误,或代理无意义地输出内容而非调用工具。
原因:缺少往返处理。
reasoning_content解决方法:升级mimo2codex至≥0.2.3版本
bash
npm update -g mimo2codexProvider Not Routing
提供商路由失败
Check:
- API key is set:
echo $MIMO_API_KEY - Provider is enabled in startup banner
- Model ID matches provider's catalog (case-sensitive)
bash
undefined检查项:
- API密钥已设置:
echo $MIMO_API_KEY - 启动横幅中显示提供商已启用
- 模型ID与提供商目录完全匹配(区分大小写)
bash
undefinedDebug with log level
启用调试日志排查
mimo2codex --log-level debug
undefinedmimo2codex --log-level debug
undefinedPort Already in Use
端口已被占用
bash
undefinedbash
undefinedChange port
修改端口
mimo2codex --port 9000
mimo2codex --port 9000
Update auth.json:
更新auth.json:
"base_url": "http://127.0.0.1:9000"
"base_url": "http://127.0.0.1:9000"
undefinedundefinedWeb Search Not Working
网页搜索无法使用
MiMo: Activate the web search plugin in MiMo Console → Plugins.
DeepSeek: Not supported (tool calls are stripped).
MiMo:在MiMo控制台 → 插件中激活网页搜索插件。
DeepSeek:不支持网页搜索(工具调用会被移除)。
Image Generation (/hatch)
图片生成(/hatch命令)
Codex's command calls OpenAI's client-side — mimo2codex cannot intercept this. Workaround: Use (see project README).
/hatchimage_genmimoskill/Codex的命令会在客户端调用OpenAI的接口——mimo2codex无法拦截该请求。解决方案:使用(详见项目README)。
/hatchimage_genmimoskill/.env Not Loading
.env文件未加载
bash
undefinedbash
undefinedVerify file location
验证文件位置
ls ~/.mimo2codex/.env
ls ~/.mimo2codex/.env
Check file syntax (no spaces around =)
检查文件语法(=号周围不能有空格)
cat ~/.mimo2codex/.env
cat ~/.mimo2codex/.env
Disable auto-loading if needed
必要时禁用自动加载
mimo2codex --no-load-env
undefinedmimo2codex --no-load-env
undefinedWindows PowerShell Execution Policy
Windows PowerShell执行策略问题
If fails:
irm | iexpowershell
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned如果执行失败:
irm | iexpowershell
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSignedIntegration with cc-switch
与cc-switch集成
Generate cc-switch snippets:
bash
mimo2codex print-cc-switchOutput example:
toml
[mimo-v2.5-pro]
model = "mimo-v2.5-pro"
wire_api = "responses"
base_url = "http://127.0.0.1:8788"
api_key = "fake_api_key"Copy to cc-switch config and use to switch.
cc mimo-v2.5-pro生成cc-switch配置片段:
bash
mimo2codex print-cc-switch示例输出:
toml
[mimo-v2.5-pro]
model = "mimo-v2.5-pro"
wire_api = "responses"
base_url = "http://127.0.0.1:8788"
api_key = "fake_api_key"将其复制到cc-switch配置文件中,使用命令切换模型。
cc mimo-v2.5-proData Persistence
数据持久化
Default location: (sqlite)
~/.mimo2codex/data.dbStored data:
- Chat logs (request/response pairs)
- Token usage stats
- Cache hit metrics
- Model mappings
Custom location:
bash
mimo2codex --data-dir /custom/path默认存储位置:(sqlite数据库)
~/.mimo2codex/data.db存储的数据:
- 聊天日志(请求/响应对)
- Token使用量统计
- 缓存命中指标
- 模型映射关系
自定义存储位置:
bash
mimo2codex --data-dir /custom/pathTypeScript API (for embedding)
TypeScript API(用于嵌入集成)
typescript
import { startServer } from 'mimo2codex';
const server = await startServer({
port: 8788,
host: '127.0.0.1',
dataDir: '~/.mimo2codex',
logLevel: 'info',
noReasoning: false,
loadEnv: true
});
// Server running at http://127.0.0.1:8788typescript
import { startServer } from 'mimo2codex';
const server = await startServer({
port: 8788,
host: '127.0.0.1',
dataDir: '~/.mimo2codex',
logLevel: 'info',
noReasoning: false,
loadEnv: true
});
// 服务器运行在http://127.0.0.1:8788