OpenAI-compatible server (llama-tornado --server): /v1/chat/completions + /v1/completions, streaming, zero-dep#135
Open
mikepapadim wants to merge 1 commit into
Conversation
…, /v1/chat/completions + /v1/completions (streaming SSE + non-stream), /v1/models, /health; dependency-free JSON; reusable serialized InferenceService over one GPU context; smoke-test script
Member
Author
|
@orionpapadakis OpenAI-compatible server off feat/mma_cuda — zero-dep JDK HttpServer, /v1/chat/completions + /v1/completions (SSE streaming + full), /v1/models, /health. Reusable InferenceService seam over one GPU context. 11/11 smoke tests (coherence, streaming, sequential no-KV-bleed, 5× concurrency, error codes) on Llama-1B. Next: wire onto the continuous batched engine (#129) for concurrent throughput. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OpenAI-compatible server (
llama-tornado --server)Serve any GPULlama3 model behind the HTTP API OpenAI clients already speak — zero external dependencies (JDK
HttpServer+ a hand-rolled JSON codec), streaming and non-streaming.Endpoints
POST /v1/chat/completions— chat, SSE streaming ("stream":true) or full JSON;usagetoken counts,finish_reason.POST /v1/completions— text completion (prompt as a single user turn).GET /v1/models·GET /health.Any OpenAI SDK works by pointing
base_urlat it. Errors use the OpenAI error shape (400 bad JSON / missing field, 405 wrong method, 500 generation).Design (reusable)
server/InferenceService— the reuse seam: holds oneState+ one compile-onceTornadoVMMasterPlan, serializes generation on the single GPU context, streams decoded tokens through a callback, returns full text + token counts. KV cache is overwritten from position 0 each request (state reused, no per-request reallocation; the model's start token is captured at construction and restored per request).server/OpenAIServer— HTTP layer: multi-threaded accept (clients queue cleanly), SSE writer, OpenAI request/response mapping.server/Json— dependency-free recursive-descent JSON reader/writer.Tested —
scripts/server-smoke-test.sh(11/11) on RTX 4090, Llama-3.2-1B"Paris","The capital of France is Paris."), correctusage.[DONE].messages, 405 GET.Scope / follow-up
Single-request-at-a-time over the proven single-token decode path — correct and drop-in for all supported models (Llama/Mistral/Qwen3/…). Wiring it onto the continuous batched-decode engine (PR #129) for concurrent-request throughput is the natural v2; the
InferenceServiceseam is where that swaps in.@orionpapadakis — standalone off
feat/mma_cuda, review welcome.🤖 Generated with Claude Code