A lightweight Node.js server providing an ELIZA chatbot through an OpenAI-compatible API. Perfect for testing chatbot applications without requiring an actual LLM.
npm install
npm startServer runs on http://localhost:3000 (set PORT environment variable to customize).
POST /v1/chat/completions - OpenAI-compatible chat endpoint
Authentication: Authorization: Bearer <any-token> (use "badtoken" to test auth failures)
Request:
{
"model": "eliza-1.0",
"messages": [{"role": "user", "content": "Hello!"}],
"stream": false
}Response:
{
"id": "chatcmpl-1234567890",
"object": "chat.completion",
"created": 1677610602,
"model": "eliza-1.0",
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello... I'm glad you could drop by today."
},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 10,
"completion_tokens": 8,
"total_tokens": 18
}
}GET /v1/models- List available modelsGET /health- Health check
!- Single long paragraph (~85 tokens)!!- Two paragraphs (~170 tokens)!!!- Three paragraphs (~260 tokens)
Perfect for testing "re-generate reply" functionality with varied content.
@- Single random code block in various programming languages@@- Three random code blocks in various programming languages@@@- Five random code blocks in various programming languages
Each code block is formatted as a fenced markdown code block with a brief explanation text. Supported languages include Python, SQL, Bash, JavaScript, HTML, CSS, Java, C++, Go, and Rust.
>/>>/>>>- Increase speed (5x/10x/100x baseline)</<</<<<- Decrease speed / reset to baseline (50 tokens/sec)
)/))/)))- Add latency (500ms/2.5s/5s)(/((/(((- Reduce latency / reset to baseline (50ms)
|- Single random markdown table with varied content||- 2-3 random markdown tables with varied content|||- 3-4 random markdown tables with varied content
Each table includes different markdown formatting features like complex content, code snippets, links, line breaks, and various table structures for comprehensive testing.
%- Simple text with plain URLs and basic markdown links%%- Multiple paragraphs with various link formats and styles%%%- Complex content including markdown tables with embedded links
Generates content with links in various formats (plain URLs, markdown links in paragraphs, and links within tables) with flavor text inspired by the intersection of Douglas Adams' wit, Ted Nelson's Xanadu vision, and Tim Berners-Lee's web invention.
$- A single wry markdown paragraph about money, adorned with visuals$$- Two rich paragraphs with imagery, horizontal rules, and emojis$$$- Three richly formatted paragraphs for maximum markdown variety
These responses focus on reflective, tongue-in-cheek commentary about moneyβno tables or code fencesβwhile showcasing markdown images, horizontal rules, and expressive emoji.
&- Single file with complex emoji modifiers (skin tones, ZWJ sequences)&&- Two files with diverse emoji combinations&&&- Three files with maximum emoji complexity
Content featuring human-animal relationships with extensive use of emoji modifiers including skin tone variations (π¨πΎβπΌ π©π»βπ¬), gender+profession ZWJ sequences (πβπ¦Ί π¨π½ββοΈ), multi-person families (π¨βπ©βπ§βπ¦), keycap sequences (#οΈβ£ *οΈβ£), flag tags (π΄σ §σ ’σ ³σ £σ ΄σ Ώ), and variation selectors (βοΈ). Includes tables, formatted prose, and unformatted prose to stress-test terminal rendering.
~- Single file with CJK, Arabic, or mixed scripts~~- Two files with diverse language combinations~~~- Three files with maximum script complexity
Multilingual content testing complex text rendering including CJK (Chinese δΈζ, Japanese ζ₯ζ¬θͺ, Korean νκ΅μ΄), RTL scripts (Arabic Ψ§ΩΨΉΨ±Ψ¨ΩΨ©, Hebrew Χ’ΧΧ¨ΧΧͺ), South Asian scripts (Devanagari ΰ€Ήΰ€Ώΰ€¨ΰ₯ΰ€¦ΰ₯, Bengali বাΰ¦ΰ¦²ΰ¦Ύ), Southeast Asian (Thai ΰΉΰΈΰΈ’, Khmer ααΆααΆααααα), Cyrillic (Π ΡΡΡΠΊΠΈΠΉ), and others. Features bidirectional text, multiple number systems (Ω‘Ω’Ω£ ΰΉΰΉΰΉ ΰ₯§ΰ₯¨ΰ₯©), currency symbols (ο·Ό βͺ βΉ ΰΈΏ), and complex tables mixing scripts.
system- Returns the system prompt from the API request (if any) in a markdown code blockraw- Returns the complete raw API payload as formatted JSON in a markdown code block
These commands help debug API integrations by showing exactly what data was sent to the server. If no system prompt was provided, the system command returns "No system prompt was submitted."
# Basic chat
curl -X POST http://localhost:3000/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer test-token" \
-d '{"model": "eliza-1.0", "messages": [{"role": "user", "content": "Hello!"}]}'
# Streaming
curl -X POST http://localhost:3000/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer test-token" \
-d '{"model": "eliza-1.0", "messages": [{"role": "user", "content": "Hello!"}], "stream": true}'const response = await fetch('http://localhost:3000/v1/chat/completions', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer test-token'
},
body: JSON.stringify({
model: 'eliza-1.0',
messages: [{ role: 'user', content: 'Hello!' }]
})
});
const data = await response.json();
console.log(data.choices[0].message.content);The chatbot recognizes classic ELIZA patterns:
- Needs: "I need..." β "Why do you need...?"
- Feelings: "I feel..." β "Tell me more about these feelings."
- Questions: "Why..." β "Why don't you tell me the reason why...?"
- Statements: "I am..." β "How long have you been...?"
The server uses a filesystem-based content management system that allows server developers to easily add new test content without modifying the core bot logic.
test-content/
βββ config.toml # Main configuration file
βββ code-blocks/ # Programming language examples
β βββ python/ # Python code samples
β βββ javascript/ # JavaScript code samples
β βββ sql/ # SQL query examples
β βββ bash/ # Shell script examples
β βββ html/ # HTML markup examples
β βββ css/ # CSS styling examples
β βββ java/ # Java code examples
β βββ cpp/ # C++ code examples
β βββ go/ # Go code examples
β βββ rust/ # Rust code examples
βββ long-responses/ # Extended paragraph content
βββ rich-markdown/ # Rich markdown paragraphs with imagery
βββ tables/ # Markdown table examples
βββ links/ # Content with embedded links
βββ terminal-breaking-emoji/ # Complex emoji with modifiers
βββ international-text/ # Multilingual and multi-script content
Code Blocks: Add new files to the appropriate language directory under test-content/code-blocks/. Files should contain complete, runnable code examples with proper file extensions (.py, .js, .sql, etc.).
Long Responses: Add .txt files to test-content/long-responses/. Each file should contain one coherent paragraph of 80-120 words.
Rich Markdown: Add .md files to test-content/rich-markdown/. Each file should feature expressive paragraphs without tables or code fences, optionally including horizontal rules, images, and emoji for visual richness.
Tables: Add .md files to test-content/tables/. Each file should contain one complete markdown table with headers and data.
Links: Add content files to test-content/links/. Support plain URLs, markdown links, and table-embedded links.
Terminal-Breaking Emoji: Add .md files to test-content/terminal-breaking-emoji/. Content should include complex emoji with skin tone modifiers, ZWJ sequences, multi-person groupings, keycap sequences, and flag tags to stress-test terminal rendering.
International Text: Add .md files to test-content/international-text/. Include content in various scripts (CJK, Arabic, Hebrew, Devanagari, Thai, Cyrillic, etc.) with bidirectional text, multiple number systems, and mixed-script tables.
The test-content/config.toml file controls content categories, command mappings, and system settings. The system automatically discovers new content files without requiring configuration changes.
- Use descriptive filenames that indicate the content purpose
- Maintain consistent file extensions for each content type
- Organize code blocks by programming language
- Keep content files focused on single examples or concepts
- Ensure all content is properly formatted and readable
The server is organized into focused, single-responsibility modules:
index.js- Main entry point, starts the serverserver.js- HTTP server logic and API endpointseliza-bot.js- ELIZA chatbot implementation using ContentManagerlib/content-manager.js- Content loading and management systemlib/config-loader.js- TOML configuration file handlingtest-content/- Filesystem-based content organizationconfig.toml- Content system configurationcode-blocks/- Programming language examples by languagelong-responses/- Extended paragraph content filesrich-markdown/- Rich markdown paragraphs with imagery and emojitables/- Markdown table exampleslinks/- Content with various link formatsterminal-breaking-emoji/- Complex emoji with modifiers and ZWJ sequencesinternational-text/- Multilingual content with diverse scripts
The server uses minimal dependencies:
smol-toml- TOML configuration file parsing- Node.js built-in modules (
http,url,fs,path)
ELIZA Patterns: Edit the patterns array in the ElizaBot class within eliza-bot.js.
Test Content: Add files to appropriate directories under test-content/. The system automatically discovers and loads new content.
API Endpoints: Modify the request handling logic in server.js.
Server Configuration: Update the startup logic in index.js.
Content System: Modify lib/content-manager.js for content loading behavior or test-content/config.toml for content settings.
CC0-1.0 - Public Domain