English · 简体中文
Connect any compatible coding harness to local OpenCode sessions. The adapter discovers currently available models, verifies them with real smoke tests, then creates or resumes an exact session in a directory you choose.
This repository is a local session adapter: a Python CLI, plus a Codex Skill wrapper. It does not install OpenCode, and it is not an official OpenCode product.
- Refresh live OpenCode model metadata and keep Go / Zen routes distinct.
- Find models whose public input, output, and cache prices are all zero, then smoke-test them in parallel.
- Start a headless OpenCode session on
127.0.0.1with a one-time password, or resume the same session by ID. - Return structured results (
session_id, actual model, reply, cleanup status) so the calling harness can inspect the repository itself.
Codex, Claude Code, Grok Build, and other tools can call the Python CLI. Codex users can also invoke $codex-opencode-session after installing the Skill.
Recorded on 2026-08-27 with Windows, Python 3.14, and OpenCode 1.18.23. Free-model availability changes with region, promotions, quota, and load. Treat the table as one real snapshot, not a guarantee.
| Route | Model | Result | Evidence |
|---|---|---|---|
| OpenCode Go | muse-spark-1.2-contributor |
Passed | Exact reply OPENCODE_SESSION_OK; current default model |
| OpenCode Zen | nemotron-3-ultra-free |
Passed | First smoke test passed |
| OpenCode Zen | nemotron-3.5-lightning-free |
Passed | Second smoke test passed |
| OpenCode Zen | big-pickle |
Quota limited | Two timeouts; endpoint returned FreeUsageLimitError |
| OpenCode Zen | hy3-free |
Quota limited | Two timeouts; endpoint returned FreeUsageLimitError |
| OpenCode Zen | mimo-v2.5-free |
Quota limited | Two timeouts; endpoint returned FreeUsageLimitError |
| OpenCode Zen | muse-spark-1.2-contributor-free |
Quota limited | Two timeouts; endpoint returned FreeUsageLimitError |
Go is a paid subscription. The current default Muse Contributor model is on the Go roster, so it is not a zero-cost model. Zen is the route that currently lists publicly zero-priced models. Confirm prices in the OpenCode Zen docs and OpenCode Go docs.
You need Python 3.10+ and a logged-in OpenCode CLI.
git clone https://github.com/ZiChenWang114514/Any-to-OpenCode.git `
"$env:USERPROFILE\.codex\skills\codex-opencode-session"The clone destination is the Codex Skill id, codex-opencode-session. Reopen Codex after installing if you want $codex-opencode-session. Other harnesses can run scripts/opencode_session.py directly.
python "$env:USERPROFILE\.codex\skills\codex-opencode-session\scripts\opencode_session.py" `
status --jsonpython "$env:USERPROFILE\.codex\skills\codex-opencode-session\scripts\opencode_session.py" `
free-pool `
--dir "C:\path\to\safe-dir" `
--provider opencode `
--parallel 3 `
--timeout 300 `
--jsonfree-pool does not guess from the word free in a model name. It reads live metadata, keeps only active models whose public prices are all zero, then checks reply, actual model, and test-session cleanup.
python "$env:USERPROFILE\.codex\skills\codex-opencode-session\scripts\opencode_session.py" `
invoke `
--dir "C:\path\to\repo" `
--model "opencode/nemotron-3-ultra-free" `
--agent plan `
--title "review-api" `
--prompt "Review this project's API and list verifiable change suggestions." `
--jsonEach real task should use its own invoke process, directory, model, title, and prompt. Free endpoints often throttle concurrent work; start with two or three jobs. After the reply, inspect the repository and run its own tests.
python "$env:USERPROFILE\.codex\skills\codex-opencode-session\scripts\opencode_session.py" `
invoke `
--dir "C:\path\to\repo" `
--session-id "ses_xxxxx" `
--prompt "Continue from the previous review." `
--jsonUse the original working directory and the exact session_id.
| Command | Purpose | Sessions |
|---|---|---|
status |
Check CLI, version, database, and default model | None created |
free-pool |
Discover zero-cost models and smoke-test them in parallel | Test sessions are deleted |
invoke |
Create or resume a real OpenCode session | Formal sessions are kept |
smoke-test |
Verify one model and the local API | Test session is deleted |
Each call picks a free port, listens only on 127.0.0.1, and generates a random password. The helper stops only the process tree it started. It does not kill the OpenCode desktop app, TUI, or other services.
The default is stored in references/defaults.json:
{
"model": "opencode-go/muse-spark-1.2-contributor"
}A --model provider/model flag on one call overrides the default. Use --variant high only when that variant exists in live metadata.
OpenCode Go uses opencode-go/.... OpenCode Zen uses opencode/.... Model IDs, subscriptions, and credentials are not interchangeable.
Give the agent the repository path, the permission mode, and the outcome you want. For Codex:
Use $codex-opencode-session in C:\path\to\repo.
Check status, then start a plan-mode session that reviews the API
and reports verifiable issues. Do not edit files.
Keep the request to the task. The adapter already knows how to discover models, isolate sessions, and return JSON.
- Zen free models are promotional. Refresh
free-poolbefore a batch of jobs. 429, timeouts, empty replies, or a mismatchedactual_modelmean that attempt failed. Do not rotate accounts to bypass provider limits.- Some free endpoints collect prompts and replies for model improvement. NVIDIA Nemotron trial endpoints may log requests for safety and product work. See Zen Privacy. Do not send secrets or private data to those routes.
- Unattended
buildallows tool execution. Use it only in a directory and task the user has already authorized. Read-only review uses--agent plan. - OpenCode stores API keys in its own login flow. Do not put keys in command arguments, logs, README files, or git commits.
.
├─ SKILL.md
├─ agents/openai.yaml
├─ references/defaults.json
├─ references/operation-protocol.md
├─ scripts/opencode_session.py
├─ tests/test_opencode_session.py
└─ assets/readme/
python -m py_compile .\scripts\opencode_session.py
python -m unittest discover -s .\tests -v
python .\scripts\opencode_session.py status --jsonEvery command accepts --json. The shared fields are schema_version, ok, target, command, provider, workdir, session_id, requested_model, actual_model, result, warnings, and error. Adapter-specific evidence remains alongside them.
| Repository | Target |
|---|---|
| Any-to-Grok-Build | Grok Build |
| Any-to-Kimi-Code | Kimi Code |
| Any-to-ZCode | ZCode / GLM |
| Any-to-DeepSeek-Harness | DeepSeek Harness |
| Any-to-Codex | Codex CLI |
| Any-to-Claude-Code | Claude Code |
| Any-to-Pi | Pi |
| Any-to-Antigravity | Google Antigravity CLI |
MIT © 2026 Zichen Wang