BitNet icon indicating copy to clipboard operation
BitNet copied to clipboard

Feature request: document/support llama-server HTTP endpoint for OpenAI-compatible serving

Open parthalon025 opened this issue 8 months ago • 1 comments

Background

setup_env.py already builds llama-server as part of the cmake step (it lives at build/bin/llama-server after a successful build). This binary provides a fully OpenAI-compatible HTTP API (/v1/chat/completions, /v1/completions, /v1/models) — the same interface as llama.cpp's server.

The README currently only documents run_inference.py for inference. The server binary is silently present but undiscovered by most users.

What this unlocks

  • Drop-in replacement for OpenAI API in downstream tools (LangChain, Open WebUI, custom apps) without code changes
  • Persistent model loading (no 2-3s cold-start per request)
  • Integration with job queues or proxy layers that speak OpenAI protocol

Minimal usage (after build)

./build/bin/llama-server     --model models/BitNet-b1.58-2B-4T-gguf/ggml-model-i2_s.gguf     --host 127.0.0.1     --port 8080     --parallel 1     --ctx-size 4096

# Then:
curl http://127.0.0.1:8080/v1/chat/completions   -d '{"model":"bitnet","messages":[{"role":"user","content":"Hello"}]}'

Question

Would the team be interested in a PR that:

  1. Documents this capability in the README (a single section — no code changes)
  2. Optionally adds a minimal Python wrapper script (consistent with the repo's Python-first style) to make the invocation discoverable

Happy to contribute either or both if there's interest. Flagging as a question first rather than opening a cold PR.

parthalon025 avatar Mar 12 '26 16:03 parthalon025

I could connect to Open WebUI, but it returns errors:

To run the server:

python run_inference_server.py -m models/Falcon3-10B-Instruct-1.58bit/ggml-model-i2_s.gguf --host 127.0.0.1 --port 8080

Connect on Open WebUI as OpenAI API with the URL http://127.0.0.1:8080/v1, use a bearer token, and type anything as the token.

The model should be available for you on chats already, but when trying to talk I receive:

Response payload is not completed: <TransferEncodingError: 400, message='Not enough data to satisfy transfer length header.'>

And the server dies with the error:

Error occurred while running command: Command '['build/bin/llama-server', '-m', 'models/Falcon3-10B-Instruct-1.58bit/ggml-model-i2_s.gguf', '-c', '2048', '-t', '2', '-n', '4096', '-ngl', '0', '--temp', '0.8', '--host', '127.0.0.1', '--port', '8080', '--no-mmap', '-np', '1', '-b', '1', '-nocb']' died with <Signals.SIGBUS: 10>.

arlm avatar Apr 03 '26 16:04 arlm