Eai.API (eai v1.0.1)

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

MethodPathDescription
GET/healthHealth check + version
GET/v1/modelsList available LLM models
POST/v1/chat/completionsChat 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"}]}'

Summary

Functions

start()