Checked 2026-10-31

LibreChat custom endpoint setup

One custom endpoint in librechat.yaml puts every RelaySwitch model in LibreChat's endpoint selector. A models.default list keeps the picker short, and a small titleModel keeps the title requests cheap.

A LibreChat custom endpoint is one entry under endpoints.custom in librechat.yaml: a name, an API key, a base URL and a model list. Point it at https://api.relayswitch.io/v1 and the chat models on the Models page answer in LibreChat, billed per token to a prepaid balance.

The one decision is models.fetch. With it on, LibreChat reads the key's whole list, and the catalog holds 338 per-token models today. This guide lists the models by hand so the picker shows the ones you use, then covers the title model, what a chat costs and the check.

01What you need

  • LibreChat running from its Docker Compose files, with librechat.yaml in the project root.
  • A RelaySwitch key. Sign in with an email code at the console and create one. Keys start with sk-relay-.
  • A balance. Top-ups start at $10, by card or crypto, with no subscription. Before the first top-up the console chat runs 12 free turns a day for comparing models.

02The custom endpoint in librechat.yaml

Put the key in .env and reference it from the YAML. LibreChat's docs call the environment-variable reference the recommended form for apiKey.

bash
1# .env
2RELAYSWITCH_KEY=sk-relay-...
yaml
1# librechat.yaml
2version: 1.3.18
3cache: true
4endpoints:
5 custom:
6 - name: 'RelaySwitch'
7 apiKey: '${RELAYSWITCH_KEY}'
8 baseURL: 'https://api.relayswitch.io/v1'
9 models:
10 default:
11 - 'claude-sonnet-5-5'
12 - 'gpt-5.5'
13 - 'gemini-3.5-flash'
14 - 'deepseek-v4-pro'
15 - 'glm-5.3'
16 fetch: false
17 titleConvo: true
18 titleModel: 'claude-haiku-5-5'
19 modelDisplayLabel: 'RelaySwitch'
  • name: the title in the endpoint selector. Required, unique.
  • apiKey: ${RELAYSWITCH_KEY} reads the variable from .env. A literal key or user_provided (each user pastes their own) also work.
  • baseURL: https://api.relayswitch.io/v1, with the /v1. LibreChat appends /chat/completions itself, as its OpenAI-compatible examples (Mistral at https://api.mistral.ai/v1) show. Leave directEndpoint unset; that is for a URL that is already the full completions path.
  • models.default: the ids in the picker. Required; with fetch: false this list is the picker.
  • titleConvo and titleModel: the automatic chat title and the model that writes it. Omitted, titles are written by the conversation's model.
  • modelDisplayLabel: the label beside the AI icon in the chat; defaults to “AI”.

dropParams is not needed: the API accepts the sampling fields LibreChat sends. Add it only if a model page lists a parameter the model ignores.

03Mount the file and restart

Docker users mount librechat.yaml into the container. In docker-compose.override.yml, keep the volume mount uncommented:

yaml
1# docker-compose.override.yml
2services:
3 api:
4 volumes:
5 - type: bind
6 source: ./librechat.yaml
7 target: /app/librechat.yaml

Configuration changes take effect after a restart: docker compose down && docker compose up -d. The endpoint then appears in the selector under the name you gave it, with the models in models.default.

04Which models to list

Prices per million tokens and context windows, read from the live catalog when this page was built. The last column is one chat turn of 2,000 tokens in and 500 out.

ModelInputOutputContextOne turn
Claude Sonnet 5.5$1.20$3.001M tokens$0.0039
GPT-5.5$1.80$9.001.1M tokens$0.0081
Gemini 3.5 Flash$1.50$9.001M tokens$0.0075
DeepSeek V4 Pro 0423$0.792$2.3761M tokens$0.0028
GLM 5.3$0.3276$1.02961M tokens$0.0012
Claude Haiku 5.5$0.06$0.151M tokens$0.0002

USD, read from the RelaySwitch catalog at build time. Context is the developer's stated window.

Use the id exactly as the Models page prints it, not the display name. To add a model later, add its id to models.default and restart. The Claude ids answer the OpenAI format here, so one endpoint covers them with the rest.

05What a chat costs

One new chat on Claude Sonnet 5.5, first reply only: 2,000 tokens in and 500 out come to $0.0039. LibreChat sends the whole conversation on every turn, so input grows with the thread.

With titleConvo on, each new chat adds one title request of about 1,000 tokens in and 20 out: $0.0013 on Claude Sonnet 5.5, $0.000063 on Claude Haiku 5.5. Over 50 new chats a day that is $0.063 against $0.0032, which is why the example sets titleModel.

Each request shows on the console's Usage page with its tokens and charge. See how pricing works for cached input and the rest of the billing rules.

06Check it

From the machine that runs LibreChat, list the models the key can call:

bash
1curl https://api.relayswitch.io/v1/models -H "Authorization: Bearer sk-relay-..."

Then send one streamed request the way LibreChat does. -i prints the headers, including the request id.

bash
1curl -i https://api.relayswitch.io/v1/chat/completions \
2 -H "Authorization: Bearer sk-relay-..." \
3 -H "Content-Type: application/json" \
4 -d '{"model": "claude-sonnet-5-5", "messages": [{"role": "user", "content": "Say ok."}], "stream": true}'

If both work and LibreChat does not, the problem is in the YAML or the mount. The API docs list every endpoint and error.

07Errors and fixes

  • The endpoint is missing from the selector: the file is not mounted, or the YAML did not parse. Check the container log after docker compose up.
  • 401: the key is wrong, revoked or the variable name in .env does not match the one in apiKey.
  • 402: the balance is too low. Top up in the console and the next message goes through.
  • 404: a model id in models.default is not in the catalog, or a display name was typed where the id belongs.
  • 429: the key hit its rate limit. Wait and retry; every user of one endpoint shares one key and one limit.
  • Every model in the catalog shows up: fetch is on. Set it to false and keep the list in models.default.

08Sources

Field names, the baseURL convention, the env-var reference and the mount are from LibreChat's own docs, read 2026-10-31: Custom Endpoint Object Structure and Custom Endpoints quick start. Prices are from the live catalog at build time.

Questions

Where does the LibreChat custom endpoint go?
In librechat.yaml in the project root, under endpoints.custom as one list item with name, apiKey, baseURL and models. Docker users mount the file through docker-compose.override.yml and restart.
Does the baseURL include /v1?
Yes: https://api.relayswitch.io/v1. LibreChat appends /chat/completions to it, the same way its Mistral and OpenRouter examples carry a /v1 base. The gateway also accepts a doubled /v1/v1 path, so a pasted URL with an extra segment still answers.
Can each LibreChat user bring their own key?
Yes. Set apiKey to user_provided and each user enters a key in the endpoint's settings; each pays from their own balance. With an env-var reference, every user of the instance chats on the one key you set.
What is a LibreChat YAML example for an OpenAI-compatible API?
The block above: version 1.3.18, endpoints.custom with name, apiKey as an env-var reference, baseURL https://api.relayswitch.io/v1, models.default listing the ids, fetch false, titleConvo true with a small titleModel, and modelDisplayLabel.
How much does LibreChat cost on this key?
LibreChat itself is free software; the tokens are what you pay, at the live prices in the table ($0.0039 for a first reply on Claude Sonnet 5.5 today), from a prepaid balance that starts at $10. No subscription.

Every model in one LibreChat endpoint

Prepaid from $10 by card or crypto. No KYC, no subscription.