Package Exports
- @letuscode/openrouter-cli
- @letuscode/openrouter-cli/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@letuscode/openrouter-cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
openrouter-cli
Releases are automated: Conventional Commits determine version bumps and semantic-release publishes stable builds from main and prereleases on the beta channel from dev branches. Use npm run commit for a guided, standards-compliant commit message.
CLI tool for OpenRouter (OpenAI-compatible). Early v0.1.0 skeleton.
Installation
- npm:
npm i -g @letuscode/openrouter-cli(or run locally withnpx @letuscode/openrouter-cli)
Setup
- Set API key via env:
export OPENROUTER_API_KEY=...(orOPENAI_API_KEY) - Or persist it:
openrouter config --api-key sk-...
Defaults
- Domain:
https://openrouter.ai/api/v1 - Model:
meta-llama/llama-3.1-8b-instruct
Commands
openrouter config [--domain URL] [--model NAME] [--api-key KEY]openrouter test— calls/modelsto verify connectivityopenrouter ask "your question" [-m MODEL] [-s SYSTEM] [--no-stream]openrouter repl— interactive chat (streaming). Commands:exit,/model,/system
Config
- Stored at
~/.config/openrouter-cli/config.jsonwith chmod 600 when possible. - API keys are never logged; printed configs redact the key.
Publishing Stable releases (main)
- Conventional Commits drive versioning via semantic-release.
- Merge to
mainwithfeat,fix, orBREAKING CHANGEcommits triggers release:- Publishes to npm with the next semver.
- Creates Git tag (
vX.Y.Z) and GitHub Release.
Pre-releases
- Beta snapshots publish from dev branches (
story/**,feature/**,release/**). - Install beta builds:
npm i @letuscode/openrouter-cli@beta - Driven by commit messages; semver prerelease scheme.
- Beta builds are npm-only; stable tags are created on
main.
Contributing
- Commit style: Conventional Commits (e.g.,
feat: add repl /help,fix: handle URL join) drive releases. - Local hooks (Husky):
- commit-msg: commitlint enforces Conventional Commits.
- pre-commit: lint-staged runs ESLint with
--fixon staged files. - pre-push: runs
npm testandnpm run build.
- Setup: run
npm installonce to install hooks (postinstall runshusky install). - Manual runs:
npx commitlint --from HEAD~1 --to HEAD(check last commit)npx lint-staged(run staged linting)npm run lint && npm test && npm run build
Conventional Commits examples
feat: add config command to update modelfix: preserve /api/v1 path when joining URLsdocs: add contributing sectionchore: set up semantic-releaserefactor: extract URL join helperperf: speed up SSE parsingtest: add URL join testsfeat!: change default modelwith a footer:BREAKING CHANGE: default model is now meta-llama/llama-3.1-8b-instruct
Guided commit (Commitizen)
- Run
npm run commitfor an interactive prompt that produces a valid Conventional Commit message.
License
- MIT