Local OpenAI-compatible servers (llama.cpp, LM Studio)

Overview

The OpenAI compatible provider connects mouaif to any OpenAI-shaped HTTP endpoint. Two of the most common are local inference servers you run yourself: llama.cpp's llama-server (default http://127.0.0.1:8080/v1) and LM Studio (http://127.0.0.1:1234/v1). Neither requires an API key, so an OpenAI-compatible connection may now be saved with a blank key and a custom base URL. When no key is stored, mouaif sends no Authorization header — a local server that runs unauthenticated accepts the request, and a hosted endpoint that really needs a key still fails cleanly with a 401 you can act on.

Usage

Point a connection at llama.cpp

  1. Start llama.cpp's server (the OpenAI-compatible surface lives under /v1):

llama-server -m ./model.gguf --port 8080
  1. In mouaif, open Settings → Providers → + Add provider.

  2. Choose OpenAI compatible.

  3. Set API base URL to the server's /v1 root — for llama.cpp that is http://127.0.0.1:8080/v1.

  4. Leave the provider API key field empty.

  5. Save provider. A blank key on a key-optional provider is accepted; the row shows no key.

  6. In the project's Models editor add a model whose provider is openai-compatible and whose id is the served model name, then use the model picker's refresh (↻) to list the server's models live.

// <projectDir>/.mouaif.json
{
  "models": [
    { "id": "local-model", "provider": "openai-compatible", "label": "llama.cpp (local)" }
  ]
}

LM Studio

Identical flow with the base URL http://127.0.0.1:1234/v1 and the LM Studio model identifier as id. LM Studio does not require a key either.

Hosted OpenAI-shaped endpoints

Hosted providers (OpenAI, Together, Groq, and the first-class Azure/Mistral/DeepSeek connections) still require a key. The Settings form refuses to save an OpenAI-compatible connection with a blank key only when the chosen provider is not key-optional; for openai-compatible you may leave it blank, but a hosted base URL without a key will return a 401 from upstream.

Behavior