Discover MCPs & agents
Loading MCPs and agents…
Loading MCPs and agents…
OpenAI-compatible API server for simonw's llm cli
Jump to setup instructionsFetched from the repository for this visit.
A lightweight, OpenAI-compatible API gateway for simonw's llm cli. This gateway provides a unified interface for model interactions with robust logging and metrics.
pip install llm
llm install llm-model-gateway
# Serve all available models
llm serve
# Serve specific model
llm serve -m gpt-4
# Custom host and port
llm serve -h 0.0.0.0 -p 8080 --reload
curl http://localhost:8000/v1/models
curl http://localhost:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-pro",
"messages": [{"role": "user", "content": "Hello!"}],
"stream": false
}'
Example response:
{
"id": "chatcmpl-8c96c0cf-f166-4cdf-8132-d6ddefaed27c",
"object": "chat.completion",
"created": 1735505968,
"model": "gemini-pro",
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "Hi there! How can I help you today?"
},
"finish_reason": "stop"
}]
}
The gateway provides two main endpoints:
from openai import OpenAI
client = OpenAI(
base_url="http://localhost:8000/v1",
api_key="dummy" # API key not checked
)
# Non-streaming request
response = client.chat.completions.create(
messages=[{"role": "user", "content": "Hello!"}],
model="gpt-4"
)
print(response.choices[0].message.content)
# Streaming request
for chunk in client.chat.completions.create(
messages=[{"role": "user", "content": "Hello!"}],
model="gpt-4",
stream=True
):
print(chunk.choices[0].delta.content or "", end="")
LLM_USER_PATH: Custom directory for logs and data
llm_model_gateway.log: Event logginglogs.db: SQLite metrics databaseEvery request is logged with:
# Clone repository
git clone https://github.com/irthomasthomas/llm-model-gateway
cd llm-model-gateway
# Set up environment
python -m venv venv
source venv/bin/activate
pip install -e ".[dev]"
Common issues and solutions:
Contributions welcome! Please feel free to submit:
Apache License 2.0 - See LICENSE for details.
GitHub checked 160h ago - refresh overdue. Recently viewed repositories target hourly refresh.
Find a documented setup for your client. No sign-in, installation, or tool execution.
If this MCP is also published on mcpchannel.ai, you can subscribe from Browse and use the gateway config there instead.