Demo and API contract test for Daptin's OpenAI-compatible LLM endpoints.
Key idea: This webapp uses the official OpenAI JS SDK pointed at Daptin. If the SDK works without patches, the API contract is proven compatible with any downstream client.
| Test | Validates |
|---|---|
GET /v1/models |
Model listing returns {object: "list", data: [...]} |
POST /v1/chat/completions |
Non-streaming: correct chat.completion object, choices, usage |
POST /v1/chat/completions (stream) |
SSE format: data: {...}\n\n, chunk objects, [DONE] terminator |
POST /v1/completions |
Legacy endpoint maps prompt to chat |
| Error: invalid model | Returns 404 with {error: {message, type}} |
| Error: missing model | Returns 400 with error object |
npm install
node server.js
# Open http://localhost:7777
# Enter your Daptin URL + JWT token in the config barcp .env.example .env.local
# Edit .env.local with your Daptin credentials and LLM API key
npm install
node scripts/setup.js # creates credential + llm_provider in Daptin
node server.jsexport LLM_API_KEY=sk-...
docker compose up
# Daptin at :6336, Demo at :7777Browser (openai JS SDK)
|
v
Daptin (:6336)
/v1/chat/completions --> llm_provider table --> GoAI SDK --> OpenAI / Anthropic / Vertex / etc.
/v1/models
/v1/embeddings
^
|
Demo (:7777) -- serves UI + runs contract tests
The demo webapp makes direct fetch() calls using the exact same JSON format as the OpenAI SDK. Each test validates response structure field-by-field against the OpenAI spec.
MIT