Eai. API
(eai v1.0.0)
Copy Markdown
HTTP API for Eai — OpenAI-compatible Chat Completions endpoint.
Exposes eai's LLM engine over HTTP so external tools (chatgpt-on-wechat, custom bots, n8n, etc.) can use it as a drop-in OpenAI replacement.
Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /health | Health check + version |
| GET | /v1/models | List available LLM models |
| POST | /v1/chat/completions | Chat completions (OpenAI format) |
Configuration
config :eai, :api,
port: 4000,
host: "0.0.0.0"Usage
# Start manually (auto-started with Application)
Eai.API.start()
# curl example
curl -X POST http://localhost:4000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"deepseek","messages":[{"role":"user","content":"hello"}]}'