Skip to main content

Overview

LibreChat is an open-source, self-hosted chat interface. Adding the AI Gateway as a custom endpoint routes every conversation through Orq.ai, exposing the full model catalog with unified tracing and cost tracking.
Custom endpoints exist only in librechat.yaml; LibreChat has no UI for adding an OpenAI-compatible provider. This page covers model routing and tracing only.

Prerequisites

Setup

1

Install LibreChat

Clone the repository and create the environment file. For other install methods, see the LibreChat Docker guide:
git clone https://github.com/danny-avila/LibreChat.git
cd LibreChat
cp .env.example .env
2

Add the API key to .env

Add the key to the LibreChat .env file:
ORQ_API_KEY=<orq-api-key>
Replace <orq-api-key> with the key from Organization > API Keys.
3

Add the AI Gateway endpoint to librechat.yaml

Add a custom endpoint under a single top-level endpoints key:
endpoints:
  custom:
    - name: "orq"
      apiKey: "${ORQ_API_KEY}"
      baseURL: "https://api.orq.ai/v3/router"
      models:
        default: ["openai/gpt-4o", "anthropic/claude-sonnet-4-6"]
        fetch: true
      titleConvo: true
      titleModel: "openai/gpt-4o-mini"
      modelDisplayLabel: "orq"
With fetch: true, the picker is populated live from the AI Gateway, so every enabled model appears automatically; default is only a fallback. Use provider-prefixed IDs (for example openai/gpt-4o) from Workspace Settings → Models.
4

Mount the config and restart

LibreChat reads librechat.yaml only when it is mounted into the container. After mounting, recreate the containers so the new .env and config are loaded:
docker compose down && docker compose up -d
Apple Silicon: the default MongoDB image requires AVX instructions that Apple Silicon does not expose under virtualization, so the mongodb container crash-loops. Pin mongo:4.4.18 in docker-compose.override.yml to fix it.

Configuration Reference

FieldDescription
nameEndpoint label shown in the model picker.
apiKeyReferences the .env variable holding the Orq.ai key, e.g. ${ORQ_API_KEY}.
baseURLSet to https://api.orq.ai/v3/router for all AI Gateway models.
models.fetchWhen true, populates the picker live from the catalog. Recommended.
models.defaultFallback list of provider-prefixed IDs.
titleConvoWhen true, fires a second call to titleModel to name each conversation.
titleModelModel used to generate conversation titles.

Troubleshooting

The custom endpoint did not load. Confirm ORQ_API_KEY is set in .env, that there is exactly one top-level endpoints key in librechat.yaml, and that the file is mounted into the container. See the LibreChat config docs.
The endpoint is running with fetch: false. Set fetch: true to populate the picker from the AI Gateway catalog, and confirm baseURL is https://api.orq.ai/v3/router.
Confirm apiKey resolves to a valid Orq.ai API key and baseURL is https://api.orq.ai/v3/router. Requests sent to another endpoint will not appear in Traces.
titleConvo: true fires a second call to titleModel to name the conversation. This is expected. Set titleConvo: false to disable it, or point titleModel at a cheaper model.

Verification

Select the orq endpoint in the model picker, choose a model, and send a message. The response appears in the chat, and the request appears in Orq.ai Traces with the selected model identifier.