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:
2

Add the API key to .env

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

Add the AI Gateway endpoint to librechat.yaml

Add a custom endpoint under a single top-level endpoints key:
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:
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

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.