-
Notifications
You must be signed in to change notification settings - Fork 90
feat: echo cli template #675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
zdql
merged 6 commits into
Merit-Systems:master
from
sachigoyal:sachi/echo-cli-template
Nov 11, 2025
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5b7d31f
feat: echo cli template
sachigoyal 5ac5f6a
fix
sachigoyal c498d33
fix
sachigoyal 0c50e7f
refactored constants
sachigoyal 17330f6
feat: added clear-history, and render prev messages on resume
sachigoyal 0a4388d
feat: local wallet
sachigoyal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| node_modules | ||
| dist | ||
| .env* | ||
| .pnpm-store |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,215 @@ | ||
| # Echodex | ||
|
|
||
| A command-line interface for AI chat powered by [Echo](https://echo.merit.systems) with support for both API key and crypto wallet payments. | ||
|
|
||
| ## Features | ||
|
|
||
| - **Dual Authentication**: Echo API keys or WalletConnect for flexible payment options | ||
| - **Multi-Model Support**: GPT-4o, GPT-5, GPT-5 Mini, GPT-5 Nano | ||
| - **X402 Protocol**: Pay-per-use with crypto wallets via the X402 payment protocol | ||
| - **Conversation Management**: Resume previous conversations and export chat history | ||
| - **Secure Storage**: OS keychain integration for credential storage | ||
| - **Real-time Usage Tracking**: View your balance and usage in real-time | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| - Node.js 18.0.0 or higher | ||
| - pnpm 10.0.0 or higher | ||
| - An Echo account (sign up at [echo.merit.systems](https://echo.merit.systems)) | ||
|
|
||
| ## Installation | ||
|
|
||
| Clone the repository and install dependencies: | ||
|
|
||
| ```bash | ||
| git clone https://github.com/Merit-Systems/echo.git | ||
| cd echo/templates/echo-cli | ||
| pnpm install | ||
| pnpm build | ||
| ``` | ||
|
|
||
| ### Global Installation (Optional) | ||
|
|
||
| To use `echodex` globally: | ||
|
|
||
| ```bash | ||
| pnpm link --global | ||
| ``` | ||
|
|
||
| Or use it directly: | ||
|
|
||
| ```bash | ||
| pnpm start | ||
| ``` | ||
|
|
||
| ## Quick Start | ||
|
|
||
| 1. **Authenticate with Echo** | ||
|
|
||
| ```bash | ||
| echodex login | ||
| ``` | ||
|
|
||
| Choose between: | ||
| - **Echo API Key**: Opens your browser to create an API key | ||
| - **WalletConnect**: Displays a QR code for mobile wallet authentication | ||
|
|
||
| 2. **Start chatting** | ||
|
|
||
| ```bash | ||
| echodex | ||
| ``` | ||
|
|
||
| 3. **Select a model** (optional) | ||
|
|
||
| ```bash | ||
| echodex model | ||
| ``` | ||
|
|
||
| ## Commands | ||
|
|
||
| ### Authentication | ||
|
|
||
| ```bash | ||
| echodex login # Authenticate with Echo (API key or wallet) | ||
| echodex logout # Sign out and clear credentials | ||
| ``` | ||
|
|
||
| ### Chat | ||
|
|
||
| ```bash | ||
| echodex # Start a new chat session | ||
| echodex resume # Resume your last conversation | ||
| ``` | ||
|
|
||
| ### Model Management | ||
|
|
||
| ```bash | ||
| echodex model # Select a different AI model | ||
| ``` | ||
|
|
||
| ### History | ||
|
|
||
| ```bash | ||
| echodex history # View your conversation history | ||
| echodex export # Export conversations as JSON | ||
| ``` | ||
|
|
||
| ### Profile | ||
|
|
||
| ```bash | ||
| echodex profile # View your Echo profile and balance | ||
| ``` | ||
|
|
||
| ## Authentication Methods | ||
|
|
||
| ### Echo API Key | ||
|
|
||
| The Echo API Key method creates an API key via your web browser: | ||
|
|
||
| 1. Run `echodex login` and select "Echo API Key" | ||
| 2. Your browser will open to echo.merit.systems | ||
| 3. Sign in and create an API key | ||
| 4. The key is securely stored in your OS keychain | ||
|
|
||
| ### WalletConnect | ||
|
|
||
| The WalletConnect method uses the X402 payment protocol: | ||
|
|
||
| 1. Run `echodex login` and select "WalletConnect" | ||
| 2. Scan the QR code with your mobile wallet (e.g., MetaMask, Rainbow) | ||
| 3. Approve the connection | ||
| 4. Pay for AI usage directly from your wallet | ||
|
|
||
| ## Configuration | ||
|
|
||
| Configuration is stored in: | ||
| - **Credentials**: OS keychain (secure) | ||
| - **Settings**: `~/.config/echodex/` (platform-specific) | ||
|
|
||
| ### Available Models | ||
|
|
||
| - GPT-4o | ||
| - GPT-5 | ||
| - GPT-5 Mini | ||
| - GPT-5 Nano | ||
|
|
||
| Switch models anytime with `echodex model`. | ||
|
|
||
| ## Tech Stack | ||
|
|
||
| - **TypeScript**: ESNext with strict mode | ||
| - **Echo SDK**: TypeScript SDK for Echo integration | ||
| - **Vercel AI SDK**: Streaming AI responses | ||
| - **WalletConnect**: Crypto wallet authentication | ||
| - **X402 Protocol**: Decentralized payment protocol | ||
| - **Keytar**: Secure credential storage | ||
| - **Conf**: Configuration management | ||
| - **Zod**: Runtime validation | ||
| - **Commander**: CLI framework | ||
| - **Clack Prompts**: Interactive CLI prompts | ||
|
|
||
| ## Development | ||
|
|
||
| ### Running in Development | ||
|
|
||
| ```bash | ||
| pnpm dev | ||
| ``` | ||
|
|
||
| ### Building | ||
|
|
||
| ```bash | ||
| pnpm build | ||
| ``` | ||
|
|
||
| ### Project Structure | ||
|
|
||
| ``` | ||
| src/ | ||
| ├── auth/ # Authentication logic (API key & WalletConnect) | ||
| ├── config/ # Configuration, models, and constants | ||
| ├── core/ # Core features (chat, history, profile) | ||
| ├── utils/ # Utility functions | ||
| ├── validation/ # Zod schemas and validators | ||
| └── index.ts # CLI entry point | ||
| ``` | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### Keychain Access | ||
|
|
||
| If you encounter keychain access issues on macOS: | ||
| - Grant Terminal/iTerm2 access in System Preferences → Privacy & Security | ||
|
|
||
| ### Connection Issues | ||
|
|
||
| If WalletConnect fails: | ||
| - Ensure you have a stable internet connection | ||
| - Try regenerating the QR code | ||
| - Check that your wallet supports WalletConnect v2 | ||
|
|
||
| ### Balance Issues | ||
|
|
||
| If your balance isn't updating: | ||
| - Run `echodex profile` to refresh | ||
| - Ensure you're authenticated (run `echodex login` again if needed) | ||
|
|
||
| ## Support | ||
|
|
||
| - **Documentation**: [echo.merit.systems/docs](https://echo.merit.systems/docs) | ||
| - **Platform**: [echo.merit.systems](https://echo.merit.systems) | ||
| - **GitHub**: [github.com/Merit-Systems/echo](https://github.com/Merit-Systems/echo) | ||
| - **Discord**: [discord.gg/merit](https://discord.gg/merit) | ||
|
|
||
| ## Contributing | ||
|
|
||
| See [CONTRIBUTING.md](../../CONTRIBUTING.md) for contribution guidelines. | ||
|
|
||
| ## License | ||
|
|
||
| MIT | ||
|
|
||
| --- | ||
|
|
||
| Built with ❤️ by [Merit Systems](https://merit.systems) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.