This page covers the OpenChinaCode-specific workflow: GLM/Kimi/DeepSeek provider setup, custom slash commands, task policy routing, smart compaction, LSP diagnostics, and Playwright testing.
OpenChinaCode installs as a separate command, so it can coexist with upstream opencode.
OpenChinaCode uses independent config and data paths. Do not put API keys in the repository.
Use this for personal defaults: model, task policy overrides, LSP, compaction, and MCP.
Written by openchinacode providers login. File mode is restricted when written by the CLI.
Use this when one codebase needs a different task policy or testing setup.
| Provider | Purpose | Protocol | Notes |
|---|---|---|---|
zhipuai-pay2go |
GLM / BigModel pay-as-you-go | OpenAI compatible | Base URL is fixed to https://open.bigmodel.cn/api/paas/v4. |
moonshotai-cn |
Kimi / Moonshot China | OpenAI compatible | Used for fast implementation, review, summarize, and quick routes. |
deepseek |
DeepSeek official API | OpenAI compatible | Used for debug/test-fix loops and low-cost judge paths. |
Additional providers are declared in config under provider, with no code changes required. A typical use is a multi-model subscription endpoint such as the Volcengine Ark agent plan (/api/plan/v3), which proxies GLM, Kimi, DeepSeek, and Doubao models behind one base URL and one API key:
Model names containing kimi-k3 or deepseek-v4 automatically inherit the China request transforms and variants (#high/#max, plus #none for deepseek) when reasoning is true; declare variants and interleaved explicitly for other names. Key precedence: options.apiKey > auth.json > env vars. Custom providers appear in the TUI model picker after restart; openchinacode providers login covers only the three built-ins. Use a provider id other than volcengine-ark, which is reserved for native media auth.
OpenChinaCode-specific commands are grouped under OpenChinaCode in the TUI command palette.
| Command | Usage | Effect |
|---|---|---|
/auto-maxtokens |
/auto-maxtokens heuristic/auto-maxtokens llm deepseek/deepseek-v4-flash |
Controls sliding output-token budgeting. Heuristic is the recommended daily mode; LLM mode uses a low-cost judge for ambiguous turns. |
/compact |
/compact/compact keep 3/compact keep auto |
Runs smart compaction. keep N also preserves the latest N raw user turns and follow-up assistant/tool messages. |
/lsp |
/lsp status/lsp on/lsp off |
Enables language-server diagnostics so the model can see and fix type, syntax, and reference errors. |
/sessions |
/sessions/resume/continue |
Opens the session picker. Use arrow keys to switch between current-project and all-project sessions. |
/task-policy |
/task-policy/task-policy compaction/task-policy on/task-policy off/task-policy extra-on/task-policy extra-off/task-policy extra-status |
Opens the local TUI task-route table. on/off hot-toggles the entire task policy and task subagent entry; extra-on/extra-off toggles the extra task router; extra-status shows current state. Does not call the model or inject the table into conversation. |
/soul |
/soul/soul rigorous/soul friendly/soul custom |
Selects the conversation persona. custom saves to .openchinacode/souls/custom.md and writes soul.active + soul.custom_path to project config. Refreshes the instance for new turns. Does not call the model. |
/permissions |
/permissions |
Opens the project permission policy panel. Choose Trust All, Safe, Ask Everything, Readonly, or Reset. Writes to ./.openchinacode/openchinacode.jsonc and applies a runtime override immediately. |
/task-classify |
/task-classify do a full code review |
Asks the current model to explain task kind, complexity, route, and classification signals. |
/test-mcp |
/test-mcp on/test-mcp headed/test-mcp off |
Writes Playwright MCP config and hot-connects or disconnects it from inside the TUI. |
/browser-check |
/browser-check http://127.0.0.1:5173 |
Prompts the agent to run browser-level checks, preferably through Playwright MCP. |
/integration-test |
/integration-test check login flow |
Prompts the agent to use the OpenChinaCode integration-test workflow: run, inspect report, define bug, fix, rerun. |
/media-auth |
/media-auth/media-auth <ARK_API_KEY> |
Saves the Volcengine Ark API key for native image and video generation. |
/image-generate |
/image-generate/image-generate a cyberpunk cat mascot |
Opens the ByteDance Seedream 5.0 Pro image generation wizard with optional inline prompt. |
/video-generate |
/video-generate/video-generate a 5s product promo |
Opens the ByteDance Seedance 2.0 Mini video generation wizard with optional inline prompt. |
/ocr-auth |
/ocr-auth/ocr-auth <API_KEY> <SECRET_KEY> |
Saves Baidu Unlimited-OCR API Key and Secret Key for ocr_extract. Stored in ~/.local/share/openchinacode/auth.json under provider baidu-unlimited-ocr. Env fallback: BAIDU_OCR_API_KEY + BAIDU_OCR_SECRET_KEY. |
/ocr |
/ocr/ocr /path/to/document.pdf |
Opens the Baidu Unlimited-OCR document parsing wizard. Supports PDF, OFD, DOC, DOCX, TXT, WPS, PPT, PPTX, and image formats. Results saved to /tmp/openchinacode/ocr as Markdown + JSON + metadata. |
Subagents are routed by task kind and complexity. General tasks inherit the parent model; specialized tasks use opinionated GLM/Kimi/DeepSeek defaults.
| Task kind | Quick | Medium | Complex |
|---|---|---|---|
general | inherit | inherit | inherit |
plan | GLM-5.2 high | GLM-5.2 high | GLM-5.2 max |
architecture | GLM-5.2 high | GLM-5.2 high | GLM-5.2 max |
refactor | GLM-5.2 high | GLM-5.2 high | GLM-5.2 max |
review | Kimi K3 high | GLM-5.2 high | GLM-5.2 max |
implement | Kimi K3 high | GLM-5.2 high | GLM-5.2 max |
explore | Kimi K3 high | Kimi K3 high | GLM-5.2 max |
visual_check | GLM-5V Turbo | GLM-5V Turbo | GLM-5V Turbo |
debug | DeepSeek V4 Pro high | DeepSeek V4 Pro high | DeepSeek V4 Pro max |
test_fix | DeepSeek V4 Pro high | DeepSeek V4 Pro high | DeepSeek V4 Pro max |
summarize | Kimi K3 high | GLM-5.2 high | GLM-5.2 max |
compaction | GLM-5.2 high | Kimi K3 high | Kimi K3 high |
Put this in ~/.config/openchinacode/openchinacode.jsonc or in a project-level OpenChinaCode config.
When enabled, ordinary prompts pass through a fast LLM judge that can automatically insert a routed subtask — no explicit /task call needed. Disabled by default.
Explicit task/subagent calls trigger the built-in route table — GLM for planning, Kimi for speed, DeepSeek for debug.
A fast judge (DeepSeek V4 Flash) inspects each ordinary prompt and inserts a subtask with task_kind + complexity when delegation is appropriate.
Use /task-policy extra-on / extra-off / extra-status, or set task_policy.extra_router.enabled in config.
OpenChinaCode compaction is routed through task policy and defaults to moonshotai-cn/kimi-k3#high. It uses three layers: general summary, active-task extraction, and minimal raw recent tail.
A judge model first emits a stable JSON profile, then OpenChinaCode builds a fixed Markdown compaction prompt from that profile.
The recent active task is extracted at higher granularity than the general summary, so long debugging or refactor context survives.
/compact keep N asks OpenChinaCode to keep the latest N raw user turns and their following assistant/tool messages.
Open the session picker with /sessions (aliases /resume, /continue). Use arrow keys to switch scope.
Press ← / → to toggle between Current Project (with pin/unpin) and All Projects (global session list).
Selecting another project's session offers: open the original project, or fork the session into the current directory.
Delete (with confirmation) and rename are available for any session in either scope.
Use /lsp on. When enabled, language-server diagnostics can be fed into the model during code edits.
Use /test-mcp on. This writes Playwright MCP config and hot-connects it without leaving OpenChinaCode.
Visual checks route to zhipuai-pay2go/glm-5v-turbo. Animation checks should prefer DOM/CSS telemetry and pixel diffs.
OpenChinaCode can generate images and videos through Volcengine Ark, powered by ByteDance Seedream 5.0 Pro and Seedance 2.0 Mini.
Run /media-auth in the TUI, or set the ARK_API_KEY environment variable. The key is stored in ~/.local/share/openchinacode/auth.json under provider volcengine-ark.
Up to 2K resolution, 1:1 to 21:9 aspect ratios, up to 10 reference images (local paths, URLs, or data URIs), PNG or JPEG output.
4–15 second clips, 480p or 720p, adaptive to 21:9 ratios, up to 9 reference images, 3 reference video URLs, strict first/last frame control, and generated audio.
Describe what you want in plain language, or run /image-generate / /video-generate with an optional prompt. When key parameters are missing, the agent asks follow-up questions instead of guessing. Generated files are downloaded immediately to /tmp/openchinacode/media/images and /tmp/openchinacode/media/videos with matching metadata JSON.
OpenChinaCode integrates Baidu Unlimited-OCR for cloud-native document parsing. Submit PDFs, Office docs, or images and get structured Markdown and JSON back — no local GPU or inference environment required.
Run /ocr-auth in the TUI, or set BAIDU_OCR_API_KEY and BAIDU_OCR_SECRET_KEY environment variables. Keys are stored in ~/.local/share/openchinacode/auth.json under provider baidu-unlimited-ocr.
Documents: pdf, ofd, doc, docx, txt, wps, ppt, pptx. Images: jpg, jpeg, png, bmp, tif, tiff. Output saved to /tmp/openchinacode/ocr as Markdown + JSON + metadata.
Run /ocr with optional file paths, or Ctrl+V paste a document into the TUI. Document files always route to OCR; images only route to OCR when you explicitly ask to extract text, parse tables, or convert to Markdown. Regular screenshots and UI images still go to the visual model.
Subagent rows in the TUI show the selected provider, model, variant, task classification, and route source.