OpenAI-compatible inference shim for local-first AI memory stacks.
If you are new: think of this as a translator. It lets local inference backends (like Ollama) look like OpenAI APIs so other tools can integrate with minimal code changes.
- Many memory/agent frameworks expect OpenAI-style endpoints
- Local model runtimes often use different APIs
- This service normalizes those differences
GET /healthPOST /embed(legacy helper)POST /v1/embeddings(OpenAI-compatible)POST /v1/chat/completions(OpenAI-compatible)
- For embeddings: forwards to Ollama
/api/embeddings - For chat: forwards to Ollama
/api/chat - If embedding call fails, returns a deterministic fallback embedding (for scaffolding only)
- Node.js 22+
- npm 10+
- Optional: Ollama running locally or reachable remotely
npm install
npm run devHealth:
curl -s http://localhost:8081/health | jq .PORT(default8081)OLLAMA_BASE_URL(defaulthttp://localhost:11434)OLLAMA_EMBED_MODEL(defaultnomic-embed-text)OLLAMA_CHAT_MODEL(defaultllama3.1:8b)INFER_API_KEY(optional bearer token for endpoint protection)
If INFER_API_KEY is set, clients must send:
Authorization: Bearer <INFER_API_KEY>curl -s http://localhost:8081/v1/embeddings \
-H 'content-type: application/json' \
-d '{"model":"nomic-embed-text","input":["fox","memory"]}'curl -s http://localhost:8081/v1/chat/completions \
-H 'content-type: application/json' \
-d '{
"model":"llama3.1:8b",
"messages":[{"role":"user","content":"Say hi in one sentence."}]
}'npm run build
npm startMIT (see LICENSE)