Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,14 @@ Available templates:

- **[next](./templates/next)** - Next.js application with Echo
- **[react](./templates/react)** - Vite React application with Echo
- **[nextjsChatbot](./templates/nextjs-chatbot)** - Next.js with Echo and Vercel AI SDK
- **[assistantUi](./templates/assistant-ui)** - Next.js with Echo and Assistant UI
- **[next-chat](./templates/next-chat)** - Next.js chatbot with Echo and Vercel AI SDK
- **[assistant-ui](./templates/assistant-ui)** - Next.js with Echo and Assistant UI
- **[echo-cli](./templates/echo-cli)** - CLI tool for AI chat with Echo (API keys + crypto wallets)

Or run `npx echo-start my-app` to choose interactively.

**Note:** The CLI template (`echo-cli`) requires manual installation from the repository as it's a command-line tool rather than a web application. See the [templates README](./templates/README.md) for details.

# Development

Fill out `packages/app/control/.env` and `packages/app/server/.env`. Then...
Expand Down
82 changes: 81 additions & 1 deletion packages/app/control/docs/getting-started/templates.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -416,4 +416,84 @@ Next.js application demonstrating Echo as an Auth.js provider for authentication
</Tab>
</Tabs>
</Step>
</Steps>
</Steps>

## Echo CLI (Echodex)

A command-line interface for AI chat powered by Echo with support for both API key and crypto wallet payments via the X402 protocol.

[View on GitHub](https://github.com/Merit-Systems/echo/tree/master/templates/echo-cli)

<Callout type="info">
**Note:** Unlike web-based templates, the CLI tool requires manual installation from the repository as it's not available through `echo-start`.
</Callout>

### Features

- **Dual Authentication**: Echo API keys or WalletConnect for flexible payment options
Comment thread
sachigoyal marked this conversation as resolved.
- **Multi-Model Support**: GPT-4o, GPT-5, GPT-5 Mini, GPT-5 Nano
- **X402 Protocol**: Pay-per-use with crypto wallets
- **Conversation Management**: Resume and export chat history
- **Secure Storage**: OS keychain integration
- **Real-time Usage Tracking**: View balance and costs

<Steps>
<Step>
### Create an Echo App
Go to [echo.merit.systems/new](https://echo.merit.systems/new) to get an `app_id`.
</Step>

<Step>
### Clone and Install
The CLI template is available in the Echo repository:

```sh lineNumbers
git clone https://github.com/Merit-Systems/echo.git
cd echo/templates/echo-cli
pnpm install
pnpm build
```
</Step>

<Step>
### Authenticate
Start by logging in to Echo:

```sh lineNumbers
echodex login
```

Choose between:
- **Echo API Key**: Opens your browser to create an API key
- **WalletConnect**: Displays a QR code for mobile wallet authentication
</Step>

<Step>
### Start Chatting
Once authenticated, start a chat session:

```sh lineNumbers
echodex
```

Or use other commands:
```sh lineNumbers
echodex model # Select AI model
echodex resume # Resume last conversation
echodex history # View conversation history
echodex export # Export as JSON
echodex profile # View profile and balance
```
</Step>
</Steps>

### Global Installation (Optional)

To use `echodex` globally on your system:

```sh lineNumbers
cd echo/templates/echo-cli
pnpm link --global
```

For more details, see the [CLI template README](https://github.com/Merit-Systems/echo/tree/master/templates/echo-cli#readme).
1 change: 1 addition & 0 deletions packages/app/control/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ We provide a variety of ready-to-use templates to help you get started quickly w
- **Auth.js (NextAuth)** — Next.js app with Echo as an Auth.js provider
- **React Chat** — Chat interface for React apps
- **React Image** — Image generation for React apps
- **CLI** — Command-line tool for AI chat with Echo (API keys + crypto wallets)

All templates are available through `echo-start` or in the [GitHub repository](https://github.com/Merit-Systems/echo/tree/master/templates). Visit our [templates documentation](/docs/getting-started/templates) for detailed setup instructions.

40 changes: 40 additions & 0 deletions templates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,46 @@ npx echo-start@latest --template assistant-ui

---

### CLI Templates

#### Echo CLI (`echo-cli`)

A command-line interface for AI chat powered by Echo with support for both API key and crypto wallet payments.

**Note:** This template is different from web-based templates. Install it directly from the repository:

```bash
git clone https://github.com/Merit-Systems/echo.git
cd echo/templates/echo-cli
pnpm install
pnpm build
```

**Features:**

- Dual authentication: Echo API keys or WalletConnect
- Multi-model support (GPT-4o, GPT-5, etc.)
- X402 protocol for crypto payments
- Conversation history and resume
- Secure OS keychain credential storage
- Export conversations as JSON
- Profile and usage management

**Usage:**

```bash
echodex login # Authenticate
echodex # Start chat
echodex model # Select AI model
echodex resume # Resume conversation
echodex history # View history
echodex export # Export as JSON
echodex profile # View profile
echodex logout # Sign out
```

---

### Feature-Specific Templates

#### Next.js Chat (`next-chat`)
Expand Down
4 changes: 4 additions & 0 deletions templates/echo-cli/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
dist
.env*
.pnpm-store
215 changes: 215 additions & 0 deletions templates/echo-cli/README.md
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)
Loading
Loading