A lightweight Express.js server that implements a translation layer between the two main LLM APIs currently available, Responses API and Chat Completions. Works with any Chat Completion API, local or remotely hosted.
Try responses.js right now, no installation needed!
Not implemented: remote function calling, file upload, stateful API, etc.
# Clone the repository
git clone https://github.com/huggingface/responses.js.git
cd responses.js
# Install dependencies
pnpm install
# Start the development server
pnpm dev
The server will be available at http://localhost:3000.
Explore the various capabilities with our example scripts located in the ./examples folder:
# Basic text input
pnpm run example text
# Multi-turn conversations
pnpm run example multi_turn
# Text + image input
pnpm run example image
# Streaming responses
pnpm run example streaming
# Structured output
pnpm run example structured_output
pnpm run example structured_output_streaming
# Function calling
pnpm run example function
pnpm run example function_streaming
pnpm dev) on http://localhost:3000API_KEY environment variable set with your LLM provider's API key# Run all tests
pnpm test
# Run specific test patterns
pnpm test --grep "streaming"
pnpm test --grep "function"
pnpm test --grep "structured"
Experience the API through our interactive web interface, adapted from the openai-responses-starter-app.
# Create demo/.env
cat > demo/.env << EOF
MODEL="moonshotai/Kimi-K2-Instruct:groq"
OPENAI_BASE_URL=http://localhost:3000/v1
OPENAI_API_KEY=${HF_TOKEN:-<your-huggingface-token>}
EOF
pnpm demo:install
pnpm demo:dev
The demo will be available at http://localhost:3001.
You can run the server in a production-ready container using Docker.
docker build -t responses.js .
docker run -p 3000:3000 responses.js
The server will be available at http://localhost:3000.
responses.js/
├── demo/ # Interactive chat UI demo
├── examples/ # Example scripts using openai-node client
├── src/
│ ├── index.ts # Application entry point
│ ├── server.ts # Express app configuration and route definitions
│ ├── routes/ # API route implementations
│ ├── middleware/ # Middleware (validation, logging, etc.)
│ └── schemas/ # Zod validation schemas
├── scripts/ # Utility and build scripts
├── package.json # Package configuration and dependencies
└── README.md # This file
Note: This project is in active development. The roadmap below represents our current priorities and may evolve. Do not take anything for granted.
We welcome contributions! Please feel free to submit issues, feature requests, or pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.
TypeScript
70.7%
JavaScript
27.4%
A lightweight Express.js server that implements a translation layer between the two main LLM APIs currently available, Responses API and Chat Completions. Works with any Chat Completion API, local or remotely hosted.
Try responses.js right now, no installation needed!
Not implemented: remote function calling, file upload, stateful API, etc.
# Clone the repository
git clone https://github.com/huggingface/responses.js.git
cd responses.js
# Install dependencies
pnpm install
# Start the development server
pnpm dev
The server will be available at http://localhost:3000.
Explore the various capabilities with our example scripts located in the ./examples folder:
# Basic text input
pnpm run example text
# Multi-turn conversations
pnpm run example multi_turn
# Text + image input
pnpm run example image
# Streaming responses
pnpm run example streaming
# Structured output
pnpm run example structured_output
pnpm run example structured_output_streaming
# Function calling
pnpm run example function
pnpm run example function_streaming
pnpm dev) on http://localhost:3000API_KEY environment variable set with your LLM provider's API key# Run all tests
pnpm test
# Run specific test patterns
pnpm test --grep "streaming"
pnpm test --grep "function"
pnpm test --grep "structured"
Experience the API through our interactive web interface, adapted from the openai-responses-starter-app.
# Create demo/.env
cat > demo/.env << EOF
MODEL="moonshotai/Kimi-K2-Instruct:groq"
OPENAI_BASE_URL=http://localhost:3000/v1
OPENAI_API_KEY=${HF_TOKEN:-<your-huggingface-token>}
EOF
pnpm demo:install
pnpm demo:dev
The demo will be available at http://localhost:3001.
You can run the server in a production-ready container using Docker.
docker build -t responses.js .
docker run -p 3000:3000 responses.js
The server will be available at http://localhost:3000.
responses.js/
├── demo/ # Interactive chat UI demo
├── examples/ # Example scripts using openai-node client
├── src/
│ ├── index.ts # Application entry point
│ ├── server.ts # Express app configuration and route definitions
│ ├── routes/ # API route implementations
│ ├── middleware/ # Middleware (validation, logging, etc.)
│ └── schemas/ # Zod validation schemas
├── scripts/ # Utility and build scripts
├── package.json # Package configuration and dependencies
└── README.md # This file
Note: This project is in active development. The roadmap below represents our current priorities and may evolve. Do not take anything for granted.
We welcome contributions! Please feel free to submit issues, feature requests, or pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.
TypeScript
70.7%
JavaScript
27.4%