Use LibreChat with a private API

Connect LibreChat to the private Morse API: set it up, pick a model, and check it works.

LibreChat is an open-source, self-hosted chat app that puts many providers' models in one interface. It speaks the OpenAI API, so it works with Morse: give it the base URL https://inference.trymorse.ai/v1 and a Morse API key, and its requests run on Morse's private inference, where Morse keeps nothing and no provider learns who you are.

Before you start

In the console, open API keys and make a key for LibreChat alone, with a spend limit, so a runaway session can't spend all your credits. See Limit a key.

Then add it to the .env file in your LibreChat folder:

.env
MORSE_API_KEY=sk_morse_...

Set up LibreChat

  1. Add Morse as an endpoint

    Add Morse under endpoints.custom in librechat.yaml, in your LibreChat folder. It names Morse's base URL and the variable your key is in. fetch: true lists every model Morse serves, and default is the list LibreChat shows first.

    librechat.yaml
    version: 1.3.19
    cache: true
    endpoints:
      custom:
        - name: "Morse"
          apiKey: "${MORSE_API_KEY}"
          baseURL: "https://inference.trymorse.ai/v1"
          models:
            default: ["moonshotai/kimi-k2.7-code"]
            fetch: true
          titleConvo: true
          titleModel: "current_model"
          modelDisplayLabel: "Morse"
  2. Mount the file

    With Docker, copy docker-compose.override.yml.example to docker-compose.override.yml and mount the file there:

    docker-compose.override.yml
    services:
      api:
        volumes:
          - type: bind
            source: ./librechat.yaml
            target: /app/librechat.yaml
  3. Restart LibreChat

    LibreChat reads the file and the key as it starts.

    Terminal
    docker compose down && docker compose up -d

Which model to pick

ModelContextInput / outputWhy
moonshotai/kimi-k2.7-code262.1K$0.95 / $4Kimi's coding model. It doesn't reason, so it starts writing sooner.
moonshotai/kimi-k3.1-pro1M$2 / $10Reasons, and reads images.
z-ai/glm-5.31M$1.40 / $4.40Reasons, and takes tools at TEE too.
deepseek/deepseek-v4-pro-08131M$1.32 / $3.96Reasons, at a lower price.
z-ai/glm-5.3-flash1M$0.15 / $0.50Cheap and fast for small edits, and takes tools at TEE too.

Prices are in dollars per million tokens, on each model's default endpoint. Every model is on the models page.

Check it works

Open LibreChat, choose Morse in the endpoint menu, then moonshotai/kimi-k2.7-code, and send a message. The reply streams in from Morse, and LibreChat titles the chat with the same model.

Keep it private

A request runs on its model's default privacy tier. To hold LibreChat to a tier, such as one where only attested hardware reads your prompts, set a privacy floor on its key. See Privacy tiers and Provider routing.

If something goes wrong

What you seeWhat to do
401The key is missing or wrong. Check that MORSE_API_KEY is set where LibreChat starts, and that the key isn't revoked.
402Add credits, or raise the key's limit. Morse holds credit for a request's output limit before it starts. See Holds.
404Use a model's id exactly as the table above writes it, lab and all.

Every code is in Errors. For other tools, see Coding agents and editors.