Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Claude API Server

A REST API wrapper for the Claude CLI.


TL;DR - Get Running in 30 Seconds

Prerequisites: Node.js 18+ and Claude CLI authenticated (claude login)

npx clauditorium

Or install globally:

npm install -g clauditorium
clauditorium

Test it:

curl -X POST http://localhost:5051/ask \
  -H "Content-Type: application/json" \
  -d '{"prompt": "Hello!"}'

That's it. Server runs on http://localhost:5051.


Features

  • Simple REST API for Claude
  • Multi-turn chat with message history
  • Configurable via environment variables
  • Request tracking with unique IDs
  • Minimal dependencies (Express + cors)

Installation

# Run directly with npx (no install needed)
npx clauditorium

# Or install globally
npm install -g clauditorium

# Or install locally in a project
npm install clauditorium

API Endpoints

Endpoint Method Description
/ask POST Send a prompt, get a response
/chat POST Chat with message history
/health GET Health check
/version GET Version info

POST /ask

curl -X POST http://localhost:5051/ask \
  -H "Content-Type: application/json" \
  -d '{"prompt": "What is the capital of France?"}'

POST /chat

curl -X POST http://localhost:5051/chat \
  -H "Content-Type: application/json" \
  -d '{
    "messages": [
      {"role": "user", "content": "Hello!"},
      {"role": "assistant", "content": "Hi! How can I help?"},
      {"role": "user", "content": "What is 2+2?"}
    ],
    "system": "You are a helpful assistant."
  }'

Configuration

Set these environment variables to customize behavior:

Variable Default Description
CLAUDE_API_HOST 127.0.0.1 Server host
CLAUDE_API_PORT 5051 Server port
CLAUDE_API_TIMEOUT 120 Request timeout (seconds)
CLAUDE_API_CORS false Enable CORS
CLAUDE_API_LOG_LEVEL INFO Log level

Example:

CLAUDE_API_PORT=8080 clauditorium

Troubleshooting

"Claude CLI not found"

# Verify Claude CLI is installed
which claude
claude --version

"Authentication required"

claude login

Request timeouts

CLAUDE_API_TIMEOUT=300 clauditorium

CORS errors in browser

CLAUDE_API_CORS=true clauditorium

License

MIT - see LICENSE

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages