{"repo": "beijumeiyoufasheng/mimo-codex-bridge", "files": {"README.md": {"673da478cf79e2686aa01600273e2196a6eea573": {"t": 1785595275.9852297, "n": 3726, "h": "75e6c552219c9622", "c": "
\n
\n English | 中文\n
\n\n\n A lightweight protocol conversion proxy that enables OpenAI Codex to use Xiaomi's MIMO models.\n
\n\n---\n\n## Features\n\n- **Auto Billing Detection** - Automatically detects billing mode based on API Key prefix (`sk-` / `tp-`)\n- **Thinking Mode** - Supports MIMO's `reasoning_content` for chain-of-thought reasoning\n- **Tools Support** - Full conversion of function calling between Responses API and Chat Completions\n- **Streaming** - Real-time streaming response with SSE events\n- **cc-switch Integration** - Manage multiple accounts via [cc-switch](https://github.com/farion1231/cc-switch)\n- **Portable** - Can be packaged as a standalone .exe file\n\n## Quick Start\n\n### Install Dependencies\n```bash\npip install -r requirements.txt\n```\n\n### Run the Proxy\n\n**Pay-as-you-go (API Key: sk-xxxxx)**\n```bash\npython proxy.py --api-key sk-xxxxx\n```\n\n**Token Plan (API Key: tp-xxxxx)**\n```bash\npython proxy.py --api-key tp-xxxxx\n```\n\n**Auto-write Codex Config**\n```bash\npython proxy.py --api-key sk-xxxxx --write-codex\n```\n\n**Enable Admin Authentication**\n```bash\npython proxy.py --api-key sk-xxxxx --admin-token your-secret-token\n```\n\n### Package as exe\n```bash\nbuild.bat\n# Output: dist/mimo-proxy.exe\n```\n\n## cc-switch Integration\n\n[cc-switch](https://github.com/farion1231/cc-switch) is a desktop app for managing multiple AI CLI tool configurations.\n\n1. Start the proxy:\n ```bash\n python proxy.py --api-key sk-xxxxx\n ```\n\n2. In cc-switch, add a custom provider:\n - **Base URL**: `http://127.0.0.1:8888/v1`\n - **API Key**: Your MIMO API Key\n\n3. Or use `--write-codex` to auto-write Codex config:\n ```bash\n python proxy.py --api-key sk-xxxxx --write-codex\n ```\n\n## Parameters\n\n| Parameter | Description |\n|-----------|-------------|\n| `--api-key` | MIMO API Key (required). Pay-as-you-go: `sk-xxxxx`, Token Plan: `tp-xxxxx` |\n| `--backend` | Custom backend URL (optional, auto-detected by API Key) |\n| `--port` | Proxy listening port (default: 8888) |\n| `--host` | Proxy listening address (default: 127.0.0.1) |\n| `--no-thinking` | Disable thinking mode |\n| `--write-codex` | Auto-write Codex config file |\n| `--codex-dir` | Custom Codex config directory (default: ~/.codex) |\n| `--admin-token` | Admin authentication token (optional) |\n\n## API Endpoints\n\n| Endpoint | Method | Description |\n|----------|--------|-------------|\n| `/v1/responses` | POST | Responses API main endpoint |\n| `/v1/models` | GET | Model list (passthrough) |\n| `/config` | GET | Get current config |\n| `/config` | POST | Update config |\n| `/health` | GET | Health check |\n\n## Billing Modes\n\n| Mode | API Key Format | Backend URL |\n|------|---------------|-------------|\n| Pay-as-you-go | `sk-xxxxx` | `https://api.xiaomimimo.com/v1` |\n| Token Plan | `tp-xxxxx` | `https://token-plan-cn.xiaomimimo.com/v1` |\n\n## Get API Key\n\n1. Visit [MIMO Platform](https://platform.xiaomimimo.com)\n2. Pay-as-you-go: Go to [API Keys](https://platform.xiaomimimo.com/#/console/api-keys)\n3. Token Plan: Go to [Subscription Management](https://platform.xiaomimimo.com/#/console/plan-manage)\n\n## Security\n\n- `/config` endpoint supports Bearer Token authentication via `--admin-token`\n- Without `--admin-token`, config endpoint allows unauthenticated access (for local development)\n- API Keys are truncated in logs (only first 10 characters shown)\n\n## References\n\n- [MIMO Documentation](https://platform.xiaomimimo.com/docs/zh-CN/welcome)\n- [Claude Code Guide](https://platform.xiaomimimo.com/docs/zh-CN/integration/claudecode)\n- [cc-switch GitHub](https://github.com/farion1231/cc-switch)\n"}}, "README_CN.md": {"673da478cf79e2686aa01600273e2196a6eea573": {"t": 1785674304.2234957, "n": 2772, "h": "8a7ddff53b97698f", "c": "\n
\n English | 中文\n
\n\n\n 轻量级协议转换代理,让 OpenAI Codex 能够使用小米 MIMO 模型。\n
\n\n---\n\n## 功能特性\n\n- **自动计费检测** - 根据 API Key 前缀(`sk-` / `tp-`)自动检测计费模式\n- **思考模式** - 支持 MIMO 的 `reasoning_content` 链式思考\n- **Tools 支持** - 完整转换 Responses API 和 Chat Completions 之间的函数调用\n- **流式响应** - 实时 SSE 事件流式传输\n- **cc-switch 集成** - 通过 [cc-switch](https://github.com/farion1231/cc-switch) 管理多个账号\n- **便携打包** - 可打包为独立的 exe 文件\n\n## 快速开始\n\n### 安装依赖\n```bash\npip install -r requirements.txt\n```\n\n### 运行代理\n\n**按量付费 (API Key: sk-xxxxx)**\n```bash\npython proxy.py --api-key sk-xxxxx\n```\n\n**Token Plan (API Key: tp-xxxxx)**\n```bash\npython proxy.py --api-key tp-xxxxx\n```\n\n**自动写入 Codex 配置**\n```bash\npython proxy.py --api-key sk-xxxxx --write-codex\n```\n\n**启用管理认证**\n```bash\npython proxy.py --api-key sk-xxxxx --admin-token your-secret-token\n```\n\n### 打包为 exe\n```bash\nbuild.bat\n# 输出: dist/mimo-proxy.exe\n```\n\n## cc-switch 集成\n\n[cc-switch](https://github.com/farion1231/cc-switch) 是一个管理多个 AI CLI 工具配置的桌面应用。\n\n1. 启动代理:\n ```bash\n python proxy.py --api-key sk-xxxxx\n ```\n\n2. 在 cc-switch 中添加自定义 provider:\n - **Base URL**: `http://127.0.0.1:8888/v1`\n - **API Key**: 你的 MIMO API Key\n\n3. 或使用 `--write-codex` 自动写入 Codex 配置:\n ```bash\n python proxy.py --api-key sk-xxxxx --write-codex\n ```\n\n## 参数说明\n\n| 参数 | 说明 |\n|------|------|\n| `--api-key` | MIMO API Key(必需)。按量付费: `sk-xxxxx`,Token Plan: `tp-xxxxx` |\n| `--backend` | 自定义后端地址(可选,默认根据 API Key 自动选择) |\n| `--port` | 代理监听端口(默认: 8888) |\n| `--host` | 代理监听地址(默认: 127.0.0.1) |\n| `--no-thinking` | 禁用思考模式 |\n| `--write-codex` | 自动写入 Codex 配置文件 |\n| `--codex-dir` | 自定义 Codex 配置目录(默认: ~/.codex) |\n| `--admin-token` | 管理认证 token(可选) |\n\n## API 端点\n\n| 端点 | 方法 | 说明 |\n|------|------|------|\n| `/v1/responses` | POST | Responses API 主端点 |\n| `/v1/models` | GET | 模型列表(透传) |\n| `/config` | GET | 获取当前配置 |\n| `/config` | POST | 更新配置 |\n| `/health` | GET | 健康检查 |\n\n## 计费模式\n\n| 模式 | API Key 格式 | 后端地址 |\n|------|-------------|---------|\n| 按量付费 | `sk-xxxxx` | `https://api.xiaomimimo.com/v1` |\n| Token Plan | `tp-xxxxx` | `https://token-plan-cn.xiaomimimo.com/v1` |\n\n## 获取 API Key\n\n1. 访问 [MIMO 开放平台](https://platform.xiaomimimo.com)\n2. 按量付费: 前往 [API Keys](https://platform.xiaomimimo.com/#/console/api-keys)\n3. Token Plan: 前往 [订阅管理](https://platform.xiaomimimo.com/#/console/plan-manage)\n\n## 安全说明\n\n- `/config` 端点支持通过 `--admin-token` 参数启用 Bearer Token 认证\n- 不设置 `--admin-token` 时,配置端点允许无认证访问(适用于本地开发)\n- API Key 在日志中会被截断显示(仅显示前 10 个字符)\n\n## 参考文档\n\n- [MIMO 官方文档](https://platform.xiaomimimo.com/docs/zh-CN/welcome)\n- [Claude Code 配置指南](https://platform.xiaomimimo.com/docs/zh-CN/integration/claudecode)\n- [cc-switch GitHub](https://github.com/farion1231/cc-switch)\n"}}}}