Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

OpenAI-compatible API

mirmir serve listens on http://127.0.0.1:8080 by default. The 0.2.0 public HTTP contract contains:

MethodPathPurpose
GET/healthServer and private protocol versions.
GET/v1/modelsModels ready in the shared runtime.
POST/v1/chat/completionsText or single-image chat, JSON or SSE.
POST/v1/embeddingsSingle or batched text embeddings.
POST/v1/rerankTEI-style document relevance scoring.

The dashboard management API under /api/mirmir/v1 is private to the embedded web application. It is versioned separately and is not an OpenAI client API.

Quick start

mirmir serve
curl http://127.0.0.1:8080/health
curl http://127.0.0.1:8080/v1/models

Bearer authentication is optional on loopback unless an API key has been configured. When configured, send it on every /v1 request:

curl http://127.0.0.1:8080/v1/models \
  -H "Authorization: Bearer $MIRMIR_HTTP_API_KEY"

Errors

Errors use an OpenAI-style envelope:

{
  "error": {
    "message": "model is not loaded",
    "type": "invalid_request_error",
    "param": null,
    "code": "not_found"
  }
}

MiRMiR maps invalid requests to 400, authentication to 401, permission failures to 403, missing resources to 404, state conflicts to 409, capacity exhaustion to 429, unavailable runtime state to 503, and unexpected runtime failures to 500.