Initial commit: Discord-Claude Gateway with event-driven agent runtime
This commit is contained in:
26
README.md
26
README.md
@@ -19,8 +19,8 @@ All inputs — Discord messages, heartbeat timers, cron jobs, lifecycle hooks
|
||||
## Prerequisites
|
||||
|
||||
- **Node.js** 18+
|
||||
- **Claude Code CLI** — [Install Claude Code](https://docs.anthropic.com/en/docs/claude-code/getting-started) and sign in with your subscription
|
||||
- **Discord Bot Token** — [Create a bot](https://discord.com/developers/applications) with Message Content Intent enabled
|
||||
- **Anthropic API Key** — Get one from [console.anthropic.com](https://console.anthropic.com/) (this is separate from a Claude Code CLI subscription)
|
||||
|
||||
## Quick Start
|
||||
|
||||
@@ -28,9 +28,11 @@ All inputs — Discord messages, heartbeat timers, cron jobs, lifecycle hooks
|
||||
# Install dependencies
|
||||
npm install
|
||||
|
||||
# Make sure Claude Code CLI is installed and you're signed in
|
||||
claude --version
|
||||
|
||||
# Set required environment variables
|
||||
export DISCORD_BOT_TOKEN=your-discord-bot-token
|
||||
export ANTHROPIC_API_KEY=your-anthropic-api-key
|
||||
|
||||
# Create config directory with persona files
|
||||
mkdir config
|
||||
@@ -65,11 +67,11 @@ All settings are via environment variables:
|
||||
| Variable | Required | Default | Description |
|
||||
|----------|----------|---------|-------------|
|
||||
| `DISCORD_BOT_TOKEN` | Yes | — | Discord bot token |
|
||||
| `ANTHROPIC_API_KEY` | Yes | — | Anthropic API key from [console.anthropic.com](https://console.anthropic.com/) |
|
||||
| `ALLOWED_TOOLS` | No | `Read,Write,Edit,Glob,Grep,WebSearch,WebFetch` | Comma-separated Agent SDK tools |
|
||||
| `PERMISSION_MODE` | No | `bypassPermissions` | Agent SDK permission mode |
|
||||
| `CLAUDE_CLI_PATH` | No | `claude` | Path to the Claude Code CLI binary |
|
||||
| `ALLOWED_TOOLS` | No | `Read,Write,Edit,Glob,Grep,WebSearch,WebFetch` | Comma-separated Claude Code tools |
|
||||
| `PERMISSION_MODE` | No | `bypassPermissions` | Claude Code permission mode |
|
||||
| `QUERY_TIMEOUT_MS` | No | `120000` | Query timeout in milliseconds |
|
||||
| `MAX_CONCURRENT_QUERIES` | No | `5` | Max simultaneous Agent SDK queries |
|
||||
| `MAX_CONCURRENT_QUERIES` | No | `5` | Max simultaneous Claude queries |
|
||||
| `CONFIG_DIR` | No | `./config` | Path to markdown config directory |
|
||||
| `MAX_QUEUE_DEPTH` | No | `100` | Max events in the queue |
|
||||
| `OUTPUT_CHANNEL_ID` | No | — | Discord channel for heartbeat/cron output |
|
||||
@@ -196,14 +198,14 @@ npm run build
|
||||
npm start
|
||||
```
|
||||
|
||||
## API Key vs Claude Code Subscription
|
||||
## Claude Code CLI vs API Key
|
||||
|
||||
The Claude Agent SDK requires an **Anthropic API key** (`ANTHROPIC_API_KEY`), which is separate from a Claude Code CLI subscription. Get one at [console.anthropic.com](https://console.anthropic.com/). API usage is billed per-token.
|
||||
This gateway uses the **Claude Code CLI** (`claude -p`) instead of the Anthropic API directly. This means:
|
||||
|
||||
The SDK also supports:
|
||||
- **Amazon Bedrock**: set `CLAUDE_CODE_USE_BEDROCK=1` + AWS credentials
|
||||
- **Google Vertex AI**: set `CLAUDE_CODE_USE_VERTEX=1` + GCP credentials
|
||||
- **Azure AI Foundry**: set `CLAUDE_CODE_USE_FOUNDRY=1` + Azure credentials
|
||||
- You use your existing **Claude Code subscription** — no separate API key needed
|
||||
- Just sign in with `claude` in your terminal and you're good to go
|
||||
- The gateway shells out to `claude -p "prompt" --output-format json` for each query
|
||||
- Set `CLAUDE_CLI_PATH` if `claude` isn't in your PATH
|
||||
|
||||
## License
|
||||
|
||||
|
||||
Reference in New Issue
Block a user