This project provides a flexible and efficient Express.js backend that acts as a proxy for Large Language Model (LLM) API calls. It's designed to facilitate single or multiple LLM interactions while allowing for response improvements in multi-call scenarios.
When the number of calls is set to 1 (default), the backend acts as a simple proxy:
When the number of calls is set to more than 1, the backend performs the following steps:
Clone the repository:
git clone <repository-url>
cd llm-backend-proxy
Install dependencies:
npm install
node server.js
Send POST requests to http://localhost:3000/execute with the following:
Headers:
x-llm-endpoint: The URL of the LLM API endpointx-llm-apikey: Your API key for the LLM servicex-llm-num-calls: (Optional) Number of LLM calls to make (default is 1)Body (JSON):
{
"model": "your-model-name",
"messages": [
{"role": "system", "content": "Your system message"},
{"role": "user", "content": "Your user message"}
]
}
Build the Docker image:
docker build -t llm-backend .
Run the Docker container:
docker run -p 3000:3000 -d llm-backend
PORT environment variable.The server will return appropriate error messages for missing headers or failed API calls.
Contributions are welcome! Please feel free to submit a Pull Request.
[Specify your license here]
Content type
Image
Digest
sha256:8d3b5b324…
Size
70.7 MB
Last updated
about 2 years ago
docker pull goshops/llm-agentic-wrapper