node --version # Requires 18+
npm install
# Install OpenCode CLI
npm install -g opencode-ai@1.19.0
# Or curl -fsSL https://opencode.ai/install | bashcp config.json.example config.json
npm startOn start, the OpenCode backend is launched on demand, then the proxy starts.
| Command | Description |
|---|---|
npm test |
All unit tests (Jest, tests/unit) |
npm run test:integration |
Docker-backed integration tests |
npm run test:stream |
Live-backend streaming smoke test (manual) |
Docker verification:
docker compose up -d --build
docker compose logs -fOpenCode2API/
├── index.js # Entry and config loading
├── src/
│ ├── proxy.js # Core proxy logic
│ └── tool-runtime/ # Tool bridge runtime (contracts/parser/policy/registry/router/validator)
├── tests/
│ ├── unit/ # Jest unit tests (npm test)
│ ├── integration/ # Docker-backed integration tests
│ └── manual/ # Live-backend smoke tests, not in CI
├── docs/ # Docs (zh/ + en/)
├── entrypoint.sh # Docker entrypoint
├── Dockerfile
└── docker-compose.yml
Use Conventional Commits:
feat: add new feature
fix: fix bug
docs: update documentation
refactor: refactor code
test: add tests
chore: update build/ci
- Fork the repo and create a feature branch:
git checkout -b feature/your-feature - Commit changes, make sure
npm testpasses - Push the branch and open a Pull Request
See CONTRIBUTING.md.
MIT License · See LICENSE